www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/02/14:22:47

Xref: news2.mv.net comp.os.msdos.djgpp:737
From: alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (Alexander Lehmann)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help:Using far ptr from real mode interrupt
Date: 31 Jan 1996 14:27:29 GMT
Organization: Technische Hochschule Darmstadt
Lines: 34
Message-ID: <4enu8h$ukf@rs18.hrz.th-darmstadt.de>
References: <DM1B3I DOT L8y AT granite DOT mv DOT net>
NNTP-Posting-Host: hp61.rbg.informatik.th-darmstadt.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:

: On 30 Jan 1996, Casper Schougaard wrote:

: > The problem is when I try to print the OEM string using the supplied far pointer. I am
: > using the line;
: > 
: >       c = _farpeekb(_dos_ds, (ptr>>16)*16 + (unsigned short)ptr);
: > 

: What you do to `ptr' above doesn't change it a bit!  If you get a 
: segment/offset pair from a real-mode software interrupt, then you should 
: do this:

: 	c = _farpeekb(_dos_ds, (segment << 4) + offset);

: If that doesn't help, please tell how did you get that `ptr' above.

Both versions should do basically the same, the 1st one assumes a 32 bit
seg:offset combination, while the 2nd expects to vars.
Casper didn't specify what type ptr has, if it is unsigned long, it should
work, but if it is signed long, you could get negative number, if the
pointer is >=8000:0000.
Maybe you could just print the pointer before and after the calculation and
check if it looks correct with a calculator. (And maybe if it is the same
pointer value that you get with BC in real mode)

bye, Alexander

--
Alexander Lehmann,                                  |  "On the Internet,
alex AT hal DOT rhein-main DOT de  (plain, MIME, NeXT)         |   nobody knows
alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (plain)     |   you're a dog."
<URL:http://www.student.informatik.th-darmstadt.de/~alexlehm/>

- Raw text -


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