Sender: nate AT cartsys DOT com Message-ID: <377D4C68.16AD5C62@cartsys.com> Date: Fri, 02 Jul 1999 16:34:00 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Virtual Screens References: <7lgctl$7r4$1 AT news5 DOT svr DOT pol DOT co DOT uk> <930893939 DOT 241152 AT kyle DOT inet DOT net DOT nz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com David Mitchell wrote: > > This is how I do it. > Note: This code can be very much optimised! And the putPixel method is > missing the clipping code. I suggest that flipping be done as: dosmemput(vscreen, 0xa0000, 64000); instead. It's much safer and all of maybe 3 cycles slower (and nearptr_enable is an expensive DPMI call itself, although it isn't in the inner loop). If you insist on using the nearptr hack, then for the sake of your sanity use __djgpp_nearptr_disable whenever you can. > > char vscreen[64000]; > char *scrptr; > > void putPixel(int x, int y, char color) { > int offs; > > offs = 320*y + x; > > vscreen[offs] = color; > } > > void flip(void) { > memcpy(scrptr, virt, 64000); // #include > } > > int main(void) { > . > . > . > __djgpp_nearptr_enable(); // #include > for this. > scrptr = (char*) (__djgpp_conventional_base + 0xa0000); // note 4 > zeros because of > > // pmode > . > . > . > } > > David. > > PS the flip takes less than 1ms on a P200 -- Nate Eldredge nate AT cartsys DOT com