delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/10/05:00:56.1

Date: Tue, 10 Nov 1998 11:51:33 +0200 (EET)
From: Toni Rasanen <torasane AT mail DOT student DOT oulu DOT fi>
X-Sender: torasane AT tuomi DOT oulu DOT fi
To: djgpp AT delorie DOT com
Subject: Re: a bunch of not so newbie questions ( i think )
In-Reply-To: <7240rt$bdj$1@pollux.matav.net>
Message-ID: <Pine.SGI.3.95.981110114526.14961A-100000@tuomi.oulu.fi>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Sun, 8 Nov 1998, KECSKEMÉTI BALÁZS wrote:

> 1) What's in the segment registers under DJGPP?

Selectors. Usually, you DO NOT have to bother yourself
with them, but if you need (for some reason) to define
a selector of your own (I use a selector that points to
display memory - physical 0xA0000 or LFB space), that has
to be loaded in a segment register.

> 2) If i allocate some (DOS) memory in an external assembly
> function, then how do i access it in the C program? As i pointed
> out in 1), DJGPP pointers don't contain the selector, just the
> offset and DPMI function 100h gives me a just a single selector.

If you know the segment of DOS memory, you can calculate it's
linear address with formula adx=segment*0x10 + offset. Then,
there is pre-defined selector _dos_ds (or something like that)
which always points at DOS address space 0000:0000. 

To use this memory, load _dos_ds -selector into segment 
register and use adx calculated above as base.
(for example, you have segment 0x1100. Linear adx is 0x11000,
so you address 0x100th byte of that address by loading 
_dos_ds in a segment register and using index 0x11000+0x100 =
0x111000.

 ///           Toni Räsänen
///       torasane AT mail DOT student DOT oulu DOT fi

- Raw text -


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