Mail Archives: djgpp/1999/08/09/09:24:28
George Kinney wrote:
>
> >> I would like to convert an address into a segment and an offset,I know
> >> how to do it with Borland C (use of FTP_SEG and FP_OFF), but with djgpp I
> >> have not found how to do it
> >>
> >> Thanks
Simple.
In protected mode, you have a selector and an offset. The final
address is simply selector + offset.
In real mode, you have a segment and an offset. The final address
is: segment * 16 + offset. That's where the 1 meg limit came from
(by multiplying the segment by 16 (or bit-shifting left by 4), that
gives
a 20 bit pointer, which makes the upward limit 1 meg (1 meg + 64K-15 if
you want to access some memory slightly over the top. This was used
as a hack for years to access more than 1 meg in real mode).
Chris
--
I know that I will never be politically correct,
and I don't give a damn about my lack of etiquette!
-- Meatloaf
- Raw text -