Message-ID: <37CC1600.E9ABA4A0@cyberoptics.com> From: Eric Rudd Organization: CyberOptics X-Mailer: Mozilla 4.08 [en] (Win95; U) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Nearptr putpixel method? References: <199908242311 DOT TAA09745 AT delorie DOT com> <7q0kfa$rot$1 AT news DOT adamastor DOT ac DOT za> <7q19jj$ajq$1 AT news DOT adamastor DOT ac DOT za> <7qcucs$78c$1 AT solomon DOT cs DOT rose-hulman DOT edu> <37cb760e DOT 9341261 AT newsserver DOT cc DOT monash DOT edu DOT au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 24 Date: Tue, 31 Aug 1999 12:50:56 -0500 NNTP-Posting-Host: 38.196.92.243 X-Trace: client 936122041 38.196.92.243 (Tue, 31 Aug 1999 13:54:01 EDT) NNTP-Posting-Date: Tue, 31 Aug 1999 13:54:01 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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