Mail Archives: djgpp/1997/01/12/20:38:17
im trying to write to a 65k screen mode using djgpp. i managed this quite easily
with the far pointer method, but it was slow so i decided to go for the nearptr
method instead. sadly i keep getting page faults and can't find the reason. can
anyone tell me where i've gone wrong..
thanks,
nik
---
code snippets and stuff...
#include <go32.h>
#include <dpmi.h>
#include <sys/nearptr.h>
__dpmi_meminfo mi;
unsigned long linear_address;
unsigned short *videoptr;
VBE_detect();
VBE_getModeInfo();
setmode(0x4111); // set 640x480x65k
mi.size=614400L; // 640x480x2 bytes long
mi.address=modeinfo.PhysBasePtr;
__dpmi_physical_address_mapping(&mi);
linear_address=mi.address;
videoptr=(unsigned short *)linear_address;
__djgpp_nearptr_enable();
videoptr[320+640*240+__djgpp_conventional_base]=0xffff;
__djgpp_nearptr_disable();
which should plot a white dot in the centre of the screen - but crashes instead :(
--
- Raw text -