-
Fatal error :/
IM trying to get into vga or svga mode in dos. Ive got my program to compile, but when i run it i get this fatal error:
A fatal exception 0D has occured at c166: 00000447
Any one know how to fix this, or what the problem is. Heres the code.
#include <iostream.h>
#include <conio.h>
unsigned char *Screen = (unsigned char *) 0xA0000000;
void initGraph (void)
{
__asm {
mov ax, 13h
int 10h
}
}
void finishGraph (void)
{
__asm {
mov ax, 03h
int 10h
}
}
void Plot (int x, int y, unsigned char color, unsigned char *buffer)
{
buffer[(y<<8)+(y<<6)+x] = color;
return;
}
int main (void)
{
initGraph();
Screen[0] = 3;
Plot(0, 0, 3, Screen);
getch();
finishGraph();
return 0;
}
Thanks.
-
If the program did work, why are you writing two consecutive pixels to offset 0 of the same color?
Fatal exception 0D is a General Protection Exception. This is most likely being caused by a null pointer in your code.
However, I copied your code exactly into my IDE and ran it. It works fine on my machine. I even tested it with different values and it worked. You don't need to include iostream.h for this code snippet.
If you are in a DOS shell, try rebooting the system and retrying the program. If you've been programming for some time on this code, chances are you have ran it many, many times. Sometimes, running the program with errors in the code may not crash the machine, but it will not allow other correctly coded programs to run. This makes it very hard to debug a program when it won't run regardless of whether or not it is correct.
This has happened to me while in a DOS shell. Even though your code is correct now, you may have ran it before when it was not. That error may have corrupted something which will require to you reboot the system. You might be able to close down the DOS shell and then go back into DOS and retry your program. Best bet though is to reboot, even reset, and retry.
-
what compiler are you using? i can't find any syntactical errors either...