delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/05/20:31:23

From: Tudor <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: What's Segment and Offset?
Date: Mon, 05 May 1997 10:19:39 -0400
Organization: Communications Accesibles Montreal
Lines: 25
Message-ID: <336DEC7B.5782@cam.org>
References: <5kdl4b$lis AT news DOT interlog DOT com>
Reply-To: tudor AT cam DOT org
NNTP-Posting-Host: dynamicppp-193.hip.cam.org
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> 
> Hi,
> Can someone tell me what Segment (FP_SEG) and Offset (FP_OFF)?
If you use DJGPP those things don't exist because DJGPP has a flat
memory model. But in 16 bit compilers you have other memory models
(representations) : tiny, small, medium ,large, huge.
In all those memory models the memory you have (RAM) is partitioned in
64K segments (because of DOS's stupidity). So you can't have something
bigger than 64K in the same segments. If you need more data, you
allocate it in a new segment. The FP_SEG gives you the address where the
segment starts. Now, in this segment, your data has a relative (to the
segment start address) adress called the offset. FP_OFF gives you the
offset  of the data relative to the address that FP_SEG gives you.
to find the actual address in memory you add the two adresses.
you usually use these with pointers.
Again, in DJGPP these don't exist. You shouldn't bother with them.

> Thanks!
> Bye!

-- 
tudor 'at' cam 'dot' org
http://www.cam.org/~tudor
'This is Scott Nudds of the Borg. C is irrelevant.'

- Raw text -


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