www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/18/05:06:33

Date: Thu, 18 Sep 1997 12:03:56 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Alessandro Moure <moure AT sercomtel DOT com DOT br>
cc: djgpp AT delorie DOT com
Subject: Re: Memory address, protected mode, real mode... Arghhhhhhhhhh!
In-Reply-To: <34209575.19A4@sercomtel.com.br>
Message-ID: <Pine.SUN.3.91.970918120306.1776A-100000@is>
MIME-Version: 1.0

On Wed, 17 Sep 1997, Alessandro Moure wrote:

> 	My old code (16 bits) was:
> 
> #define MASK 0xFFFFFFFL
> #define BASEADD 0xD0000000L
> 
> 	for(counter = foo; counter < foo2; counter++)
> 	data[counter] = MASK & *(BASEADD + counter);
> 
> where data[] is float.

If data[] is an array of floats, then maybe the ``trash'' you get is
how float numbers look like when you treat them as ints?  You have
said that your DJGPP code is like this:

     unsigned long data;
     data = _farpeekl(_dos_ds, 0xD0000 + counter);

Here data is an unsigned long, not a float.  You need to convert it to
a float (e.g., by using a union of unsigned long and a float) to see
meaningful data.  Did you try this?

Another problem is that you advance the offset by one instead of by
sizeof(unsigned long).  farptr functions don't know about pointer
arithmetics, they always treat the offset as a byte offset.

- Raw text -


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