delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/05/18:21:50

Date: Thu, 5 May 94 17:49:39 -0400
From: dj AT ctron DOT com (DJ Delorie)
To: arra AT dsd DOT camb DOT inmet DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Video memory: Native and Windows DOS

> I am using both C (djgpp) and Ada (djgpp port of DOS), and want to have
> Ada or C code directly reference the PC character mode video memory,
> normally at something like address 0xb8000.

The only portable way is to use dosmemget/dosmemput or the Screen
*functions* in <pc.h>.

> When running under GO32, the documentation says the first 1M memory is
> mapped 1:1, so it would appear that it would be possible to reference
> 0xb8000 directly, but this causes a GP protection. Further

Mapped 1:1, but not at offset zero.  It is mapped at 0xe0000000.

> documentation mentions that this area is (re?)mapped to 0xe00b8000, and
> in fact, this address (0xe00b8000) works fine.

But not in DPMI mode.

> However, neither 0xe00b8000 nor 0xb8000 work when running the same
> program in a DOS box under windows 3.11. I notice that some library
> routines use dosmemput, dosmemget, or movedata, which I suspect switch
> modes before accessing the "dos" memory. However, I want to directly

Actually, they use a different segment register to access the DOS
memory area.  They do not switch to real mode.

> Is there a way for a djgpp-compiled C or GNAT-compiled Ada program to
> directly access video memory in both native DOS AND also in a Windows
> DOS box? Even a solution that required a different video memory address
> in the two cases is acceptable, as long as the program can dynamically
> determine the correct video address based on its operating
> environment.

Always use the functions and not the pointer.


- Raw text -


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