www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/15/10:31:28

Date: Sun, 15 Mar 1998 17:29:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: telford AT xenon DOT triode DOT net DOT au
cc: djgpp AT delorie DOT com
Subject: Re: DJGPP/NASM HELP!!
In-Reply-To: <6egjqf$ad6$1@hyperion.triode.net.au>
Message-ID: <Pine.SUN.3.91.980315171909.10467D-100000@is>
MIME-Version: 1.0

On 15 Mar 1998 telford AT xenon DOT triode DOT net DOT au wrote:

> What I found strange about pdcurses is that the FAR_POINTER macro
> added an offset of 0xe0000000 to the dos memory address for dosmemput().

This is a left-over from the days of DJGPP v1.x.  The memory map was
different there; in particular, the entire 1st Megabyte was mapped
beginning with 0xe0000000.  This scheme cannot work in DPMI (since there's
no way you can control where does the DPMI server loads your program), and
so it was abandoned in DJGPP v2.  You need to use `dosmemXXX' and/or the
farptr functions instead. 

> This caused crashes in the sample programs (such as firework.exe)
> right at the dosmemput() call.

`dosmemput' shouldn't crash unless you feed it with the 
0xe0000000-relative address.  This is wrong: dosmemXXX should get the 
liner address (seg*16+off), not the protected-mode address.

> Coming from a slightly different background to most DOS programmers,
> it seems to me that you should make the MMU work for you rather than
> against you. That's the whole idea of having source to the libraries.
> What you must do is create a mapping between the hardware that you
> want to use and some virtual memory space that you have easy access
> to.

This is how it works in DJGPP v2.  You have begin from some very old 
code, assumed it was right, and come to the wrong conclusions.  I suggest 
to read chapter 18 of the DJGPP FAQ list (v2/faq210b.zip from the same 
place you get DJGPP).

> Calls such as __djgpp_map_physical_memory() are fairly close to
> the ticket. Some older dpmi servers will fail with this though.

If you mean to use that to write to the video RAM, then the 
above-mentioned chapter 18 describes the various methods of doing so.

- Raw text -


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