delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/09/22:34:34

Date: Tue, 9 Sep 1997 19:33:49 -0700 (PDT)
Message-Id: <199709100233.TAA28503@adit.ap.net>
Mime-Version: 1.0
To: bianchi AT magna DOT ing DOT unipi DOT it (Federico Bianchi), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Access to video memory under Windows NT

At 05:25  9/4/1997 GMT, Federico Bianchi wrote:
>Hello. I have been asked to have a DPMI GCC program accessing the screen memory
>'DOS-way'. Unfortunately, the virtual address which may be used under both
>plain DOS and Windows 95 appears not to work properly under Windows NT.
>
>Does anyone know whether there is a _documented_ and clean way to get a
>linear pointer to the frame buffer in VGA modes 03h (80x25, text) and 13h
>(320x200, 256 colours)?
>
>Thanks in advance for your help and kindness.
>
>				Federico Bianchi
>				bianchi AT magna DOT ing DOT unipi DOT it
>
>PS: I _know_ I can map the 0A000h real mode segment to a selector and the
>DPMI 1.0 specs, so please don't point me to them. I need a thing which can
>run under DPMI 0.9 and completely independent from the segment registers (i.e.,
>flat mode). I also think myself this is not a proper way to handle the console,
>but I was ordered to do it just that way.
Well, you can't do it without meddling with selectors somehow, since video
memory is not within your data space. A frequent way to do it is to use
DJGPP's ready-made _dos_ds selector and do something like:
_farpokeb(_dos_ds,0xA0000,BLUE);
But it sounds like that's unacceptable as well. The only way to do it
without the farptr functions is with the nearptr (AKA Fat DS) hack, which
involves changing the DS descriptor base to 0 and its limit to 0xffffffff.
But that's very dangerous, and to add injury to insult, not allowed by
Windows NT.
So I think the only solutions are those which you know about. 

PS. I just realized your question might be that the video memory is not at
the same place in different video modes. I.E, 0xB0000 for mono, 0xA0000 for
VGA. If that's the case, the address is documented for each video mode (see
Ralf Brown's Interrupt List). If that's not your question, ignore this. :)


Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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