Mail Archives: djgpp/1998/11/10/05:00:56.1
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 -