Mail Archives: djgpp/1998/06/18/11:29:24
I am having trouble making a pointer to my VGA card memory using djgpp.
here is my code:
// start
#include <dos.h>
#include <iostream.h>
void setgmode()
{
union REGS r;
r.x.ax = 0x13;
int86(0x10, &r, &r);
}
int main()
{
setgmode(); // sets vga adapter to mode 13h
char * screen = (char *) 0xa0000000;
for (int x = 0; x < 320; x++)
for (int y = 0; y < 200; y++)
screen[y*320+y] = (char) y;
return 0;
}
//end
This compiles fine, but when I try to run it, I get the following:
General Protection Fault at eip=000015d4
eax=00000000 ebx=000221a0 ecx=00000000 edx=a0000000 esi=00000054
edi=0000a6d4
ebp=009c3fd4 esp=009c3fc8 program=C:\OWEN\CODE\A.EXE
cs: sel=00a7 base=8266e000 limit=009c3fff
ds: sel=00af base=8266e000 limit=009c3fff
es: sel=00af base=8266e000 limit=009c3fff
fs: sel=0087 base=0000a310 limit=0000ffff
gs: sel=00bf base=00000000 limit=ffffffff
ss: sel=00af base=8266e000 limit=009c3fff
Call frame traceback EIPs:
0x000015d4
0x00001b42
eek.
Am I declaring the pointer wrong? using it wrong? got the address wrong?
Owen Butler
- Raw text -