From: "A.Appleyard" To: DJGPP AT sun DOT soe DOT clarkson DOT edu Date: Tue, 7 Feb 1995 09:05:50 GMT Subject: Re: Funny error in class (1) dj AT stealth DOT ctron DOT com (DJ Delorie) wrote:- > I don't recommend using the farns* [= _farnspeekw() etc, in ] > functions inside other functions. It's not safe. You don't know what someone > else might have done with the segment registers between calls. But my program is almost entirely composed of functions calling functions calling functions several deep! Hardly any of it is in main(). If I can only use the _farns*() functions in main(), I can't use them. Can I then use the _far*() functions that do specify a `selector', and put the `unsigned short selector' argument as 0? (2) In the peek and nspeek functions in , e.g.:- extern inline unsigned char _farpeekb( unsigned short selector, unsigned long offset) {unsigned char result; asm("movw %0,%%fs" : : "r" (selector)); asm(".byte 0x64\n" " movb (%1),%0" : "=r" ((int)result) : "r" (offset)); return result;} why not output straight to the result register al/ax/eax?, thus?:- extern inline unsigned char _farpeekb( unsigned short selector, unsigned long offset) { asm("movw %0,%%fs" : : "r" (selector)); asm(".byte 0x64\n" " movb (%1),%0" : %%al : "r" (offset)); }