www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/12/03:00:24

Date: Wed, 12 May 1999 09:58:13 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: buffer pointer....
In-Reply-To: <3737CA29.313E459B@geocities.com>
Message-ID: <Pine.SUN.3.91.990512095753.20820J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 11 May 1999, Derek wrote:

>   I was curious how I would get a segment:offset pair from a 32 bit
> address in djgpp?

You can't.  The data of your protected-mode programs almost always
sits above the 1MB mark, and real-mode seg:off addresses are only
20-bit wide, so they can only address the first megabyte of memory.

The solution is to move the data to a buffer in the low memory and
pass the seg:off address of that buffer.

> why you may ask? Because I need to get the segment:offset pair of a
> pointer to calculate it's 20 bit absolute address so I can use it in my
> sound routine(I'm *trying* to avoid using
> djgpp_near_pointer_enable();)....
> but being relativly new to protected mode programming I haven't a clue
> how to do this...

I think sections 18.2 and 18.4 of the DJGPP FAQ list have enough
information about this to get you off the ground.

- Raw text -


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