Mail Archives: djgpp/1997/09/18/05:06:33
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 -