www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/22/05:05:37

Date: Wed, 22 Jul 1998 11:41:47 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: ALMICHVL <almichvl AT aol DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: far pointers and fp_seg
In-Reply-To: <1998072204331500.AAA16520@ladder03.news.aol.com>
Message-ID: <Pine.SUN.3.91.980722113333.10941U-100000@is>
MIME-Version: 1.0

On 22 Jul 1998, ALMICHVL wrote:

> hi i tried to run the following code in DJGPP but i having trouble is there
> anyone that can help ME?

The DJGPP FAQ can help you (see section 18.4 there).

> i want to extract the segment and the offset from a far pointer -USER FRONT
> USING  FP_SEG' and `FP_OFF) . 
> 
> 	_farpokeb(0x0000, 0x010e, FP_SEG(font));
> 	_farpokeb(0x0000, 0x010c, FP_OFF(font));
> }

This won't work.  _farpokeb is not just a replacement for poke in real-mode 
DOS compilers.  You need to understand what you are doing, to port such 
code to protected-mode programs.

Something like the following should work:

       _farpokew(_dos_ds, 0x010e, font_segment);
       _farpokew(_dos_ds, 0x010c, font_offset);

You didn't explain where does UserFont come in the code which uses this, 
so I cannot tell you how to compute font_segment and font_offset.

Also, please note that you should use _farpokew, not _farpokeb, since 
segment and offset are 16-bit integers, not bytes.

- Raw text -


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