www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/25/06:30:27

From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: FP_SEG() and FP_OFF() macros
Date: Wed, 25 Feb 1998 11:14:18 +0100
Organization: University of Ghent, Belgium
Lines: 35
Message-ID: <34F3EEFA.66FB@rug.ac.be>
References: <34F24DA5 DOT BF697D29 AT nosc DOT mil>
NNTP-Posting-Host: eduserv1.rug.ac.be
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Richard M. Myers wrote:
> 
> Hi,
> 
> Is there a DJGPP guru out there who can show me some code which I can
> use to replace the following references to FP_SEG and FP_OFF:
> 
> srb->buf_seg = FP_SEG(buf);
> srb->buf_off = FP_OFF(buf);

It depends.

First, if buf is a pointer variable you are probably mistaken because
djgpp uses flat addressing mode, which means that it does not know the
concept of segmented addressing. So you have only a 32-bit offset, no
segment address. Therefore it is not possible to convert this 'buf'
value into a (seg, ofs) pair.

Second possibility, you mean that buf is a linear address below the 1 MB
mark, in this case you can split this linear address into a real mode
segment address and an offset, which you can pass in turn to some
real-mode running program (like DOS). This is explained quite
understandable in the FAQ IIRC.

BTW there are a dozen of other possibilities. A little more
specifications on your part would be welcome.

> P.S.  Please email me if you can help as I don't follow this group

How rude.

-- 
 \ Vik /-_-_-_-_-_-_/   
  \___/ Heyndrickx /          
   \ /-_-_-_-_-_-_/

- Raw text -


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