Mail Archives: djgpp/1997/05/07/15:22:31
Gautam N. Lad wrote:
> Ok, what's the 'definition' fo the term OFFSET!?
I don't know the exact definition. It's a displacement (movement) of
something relative to another thing... Hmm, that doesn't sound so
helpfull..
Let's say you have a variable in a segment. The adress of the variable
is 5 :). The segment's adress is 1000. Now FP_SEG(variable_pointer) will
give you 1000, and FP_OFF(variable_pointer) will give 5. Here, 5 is the
adress of the variable _realtive_ to the segments start adress-- it is
the offset (displacement) of your variable relative to the segment the
variable is in. So if you want the actual adress in memory you do FP_SEG
+ FP_OFF and get 1005. That is the actual adress of your variable in
memory...
Hope this is clearer...:)
> Thanks!
> Bye!
--
tudor 'at' cam 'dot' org
http://www.cam.org/~tudor
'This is Scott Nudds of the Borg. C is irrelevant.'
- Raw text -