delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/10/08:48:00

Date: Wed, 10 May 2000 08:23:58 -0400 (EDT)
Message-Id: <200005101223.IAA11810@indy.delorie.com>
From: Eli Zaretskii <eliz AT delorie DOT com>
To: LittleHelpNeeded <ummajera AT cc DOT umanitoba DOT ca>
CC: djgpp AT delorie DOT com
In-reply-to: <1f1200dc.77e75303@usw-ex0108-062.remarq.com> (message from
LittleHelpNeeded on Tue, 09 May 2000 11:59:31 -0700)
Subject: Re: __dpmi_paddr and DJGPP pointers
References: <034f2f50 DOT 765f03be AT usw-ex0108-062 DOT remarq DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: LittleHelpNeeded <ummajera AT cc DOT umanitoba DOT ca>
> Newsgroups: comp.os.msdos.djgpp
> Date: Tue, 09 May 2000 11:59:31 -0700
> 
> How do you change a __dpmi_paddr struct to a pointer like
> void* ???
> 
> ie. If you have
> 
> short selector;
> int offset;
> 
> How do you make it to
> 
> void *Pointer??

You cannot do that, unless the selector is identical to what _my_ds()
returns.  A pointer such as "void *Pointer" is actually an offset
relative to the base address of the selector loaded into the DS
register.  If you need to use an offset relative to another selector,
you need to use the farptr functions (_farpeekb, _farpokew, etc.).

Alternatively, you could enable nearptr method by calling
__djgpp_nearptr_enable, and adjust the offset accordingly.  But I
don't recommend that, since it disables part of the memory protection.

If your selector is the same as _my_ds(), simply do this:

   void *Pointer = (void *)offset;

- Raw text -


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