Mail Archives: djgpp/1994/10/05/19:24:41
> I need to know how to convert a standard memory address to segment
> offset notation. If I do this will it work? :
>
> segment = address / 16
>
> offset = address % 16
>
> or is that entirely wrong?
Yes. This is entirely wrong. You are making the understandable
assumption that the 32 bit address is a segment:offset style address.
The reason we like djgpp is that we DON'T have such a beast. Our 32
bit addresses are linear, contiguous. When you pass pointers, you are
not passing the segment address because it is implicit. CS, DS, and
SS are all the same. The address you get from an expression such as:
int foo;
int* pfoo = &foo;
is only the offset, &foo. If you want to pass segments to DOS, you
need to create an alias for the seg16:off32 that is seg16:off16. This
is where my knowledge of x86 carries us. There must be a function in
the go32 extender that permits such a conversion.
Marc Singer
elf AT netcom DOT com
- Raw text -