delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/21/09:53:31

Date: Mon, 21 Dec 1998 16:52:25 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Tim Czvetics <grunter AT tig DOT com DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: Question from a beginner
In-Reply-To: <75licm$pm9$1@toto.tig.com.au>
Message-ID: <Pine.SUN.3.91.981221164948.7687E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 22 Dec 1998, Tim Czvetics wrote:

> I am writing some code in which I use a pointer to an unsigned char, and I
> need to find the segment and offset of that pointer. How do I go about doing
> it?

You don't ;-).  Protected-mode pointers cannot be expressed as a segment 
and an offset, because your program puts data in extended memory, above 
1MB mark, while the real-mode segment:offset addresses can only address 
the first megabyte.

The DJGPP FAQ list (v2/faq211b.zip from the same place you get DJGPP) 
explains in chapter 18 how to call real-mode services that require 
seg:off pointers to buffers.  Please read it.

- Raw text -


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