Mail Archives: djgpp/1996/02/02/14:22:47
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 -