delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/03/26/23:45:07

From: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Segment and Offset of Variables -- HOW?
Date: Wed, 26 Mar 2003 22:32:44 CST
Organization: Rice University, Houston TX
Lines: 22
Message-ID: <3e827eec.sandmann@clio.rice.edu>
References: <n2n48vcfklse00bgdpdeu53ps2ep1bq5cv AT 4ax DOT com>
NNTP-Posting-Host: clio.rice.edu
X-Trace: joe.rice.edu 1048739843 9658 128.42.105.3 (27 Mar 2003 04:37:23 GMT)
X-Complaints-To: abuse AT rice DOT edu
NNTP-Posting-Date: 27 Mar 2003 04:37:23 GMT
X-NewsEditor: ED-1.5.9
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> I wish to know how I would obtain the Address of a Variable,

  char *Address;
  Address = &Variable;

> such that it can also be broken down into its Segment and Offset,

As has been pointed out repeatedly, DJGPP variables live in 32-bit
address space, so there is no Segment as you are thinking of it,
and the Offset is always 32 bits in size.

> its AOK it I can directly obtain the Segment and Offset information in
> separate calls.

The only reason you might think you want this information is passing
to some old-style DOS/BIOS interrupt.  If that is the case you must
have the data in the 1st megabyte of memory.  So you would need to
copy it from the DJGPP address space into the first megabyte, then 
get the segement:offset of where you passed it.  I suggest you look at
the FAQ for examples.  In any case, you will not be using FP_SEG or
FP_OFF at all, it's a re-write.

- Raw text -


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