delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/23/15:54:13

Message-Id: <m0wg9Vn-000S2ZC@ciati.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
Organization: INTI
To: wilsonl AT sfu DOT ca (Wilson Wang Shun Leung)
Date: Mon, 23 Jun 1997 17:09:57 +0000
MIME-Version: 1.0
Subject: Re: "far" pointer question
CC: djgpp AT delorie DOT com

wilsonl AT sfu DOT ca (Wilson Wang Shun Leung) wrote:

> But now my question is how I can convert the information
> I have to a pointer which I can actually use for
> read/write data.  What I now have is a selector (the
> content that goes to segment register) and a offset of
> zero.  
Look in the sys/farptr.h file, you'll find the macros to use these values.

> Can I just use the real mode calculation like
> this one:
>    int *port;
>    port = ((DWORD)selector) * 16  + offset
No way!.
 
> where DWORD is 32 bit wide and selector is 16 bit.
> 
> My specific questions are
>   Is the pointer I defined (port) 32 bit wide?
>   What if my offset is 32 bit wide? Then the above
>   calculation should be all wrong. 
All wrong, the value is a SELECTOR not a SEGMENT, you must put the selector in 
one of the segment (read selector ;-) registers and use the 32 pointer.

> Am I missing something? 
Yes, look the macros.

SET 
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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