Mail Archives: djgpp/1999/07/02/20:37:46
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 <mem.h>
> }
>
> int main(void) {
> .
> .
> .
> __djgpp_nearptr_enable(); // #include <sys/nearptr.h>
> 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
- Raw text -