Pinched the following code from somewhere:
#include <dos.h>
//
// Save FPU state.
//
// This uses a magic spell taken from Intel application note AP-113.
//
void fpusave (char far* t)
{
//_ES = FP_SEG (t);
//_BX = FP_OFF (t);
__asm les bx,t
__asm fnstcw es:[bx] // save IEM bit status
__asm nop // delay while control word saved
__asm fndisi // disable BUSY signal
__asm mov ax, es:[bx] // get original control word in AX
__asm fsave es:[bx] // save FPU state
__asm fwait // wait for save to complete
__asm mov es:[bx],ax // put original control word in saved state
}
//
// Restore FPU state.
//
void fpurest (char far* t)
{
//_ES = FP_SEG (t);
//_BX = FP_OFF (t);
__asm les bx,t
__asm frstor es:[bx]
}
Found the compiler cannot recognise fndisi instruction.
Compiles with MS VC++ 1.5 and above and BCC as well.
When Obj2asmed the code generated by BC or VC,
fndisi (db e1)
is being intepreted as
fdisi (9b db e1)
Don't ask me what they mean as I haven't read into the Intel
data book yet...