delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/03/12:25:51

From: "David Dean - [DS]Deaner666" <david AT deanhouse61 DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Virtual Screens
Date: Sat, 3 Jul 1999 14:54:49 +0100
Organization: Customer of Planet Online
Message-ID: <7ll4if$g3h$1@news5.svr.pol.co.uk>
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> <377D4C68 DOT 16AD5C62 AT cartsys DOT com>
NNTP-Posting-Host: modem-225.name45.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 931009935 16497 62.136.182.225 (3 Jul 1999 13:52:15 GMT)
NNTP-Posting-Date: 3 Jul 1999 13:52:15 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Lines: 68
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I actually worked out some protracted method of doing it myself using
dosmemput(), but I will take both pieces of advice into account because I
don't think my version is very well optimised at present. Thanks muchly
though.
Are the near pointer hacks really that bad? Surely its just the same as
programming in real mode rather than protected mode?

Nate Eldredge <nate AT cartsys DOT com> wrote in message
news:377D4C68 DOT 16AD5C62 AT cartsys 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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019