Mail Archives: djgpp/1999/08/31/21:56:46
Davin McCall wrote:
> >It brings with it general
> >protection faults, page faults, and other things that, if you use nearptr,
> >are your fault, up to and including data loss.
>
> I successfully used the nearptr "hack" when writing a game last year.
> Most programming erros (access violations etc) were still caught, and I
> certainly didn't suffer any data loss.
If one is using a linear frame buffer (usually located high in 32-bit memory
space), one other option is to write a modified __djgpp_nearptr_enable() that
opens the segment limit just wide enough to include the video card address.
This at least prevents a stray pointer from wrapping and accessing DOS memory.
Thus, a buggy program may crash, but at least it's unlikely to bring down DOS.
I have been using this technique for several years now (both under DOS and
under Win95), and have yet to have a problem with it.
I haven't had any success in using this under NT, and I am curious if anyone
else has managed to write directly to video memory under NT.
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -