cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/13/04:03:27

From: "François Poirier" <fpoirier AT aei DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointer to memory
Date: Sun, 10 Jan 1999 15:50:46 -0500
Organization: AEI Internet
Lines: 34
Message-ID: <369912A6.52079EC4@aei.ca>
References: <36985DB7 DOT C5C7D160 AT 2xtreme DOT net>
NNTP-Posting-Host: ppp-110-223.mtl.aei.ca
Mime-Version: 1.0
X-Mailer: Mozilla 4.05 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Use this:
#include <crt0.h>

       void * MK_FP (unsigned short seg, unsigned short ofs)
       {
         if ( !(_crt0_startup_flags & _CRT0_FLAG_NEARPTR) )
           if (!__djgpp_nearptr_enable ())
             return (void *)0;
         return (void *) (seg*16 + ofs + __djgpp_conventional_base);
       }

Alex Lowe wrote:

> I am trying to port some code, for reading the fonts in ROM for DOS.
> Anyway, what I need to do is to get the memory location of this... I
> have 2 pointers... segment and offset...
>
> And I want to have the pointers added, for example if the segement is
> 0xAA and the offset is 0x03 then I can make a pointer to 0xAD...
>
> The code I am trying to port looks like this:
>
> char *offset=regs.x.bp;
> char *segment=regs.x.es;
>
> char *font=*MK_FP(segment, offset);
>
> That is the code... the last line is the one I am having trouble with...
> Thanks for the info, I hoped I described this well enough.
>
> -- Alex



- Raw text -


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