diff --git a/src/fpu/fpu_instructions.h b/src/fpu/fpu_instructions.h index bfc564ef..8b608249 100644 --- a/src/fpu/fpu_instructions.h +++ b/src/fpu/fpu_instructions.h @@ -118,12 +118,16 @@ static void FPU_ST80(PhysPt addr,Bitu reg) { } test; Bit64s sign80 = (fpu.regs[reg].ll&LONGTYPE(0x8000000000000000))?1:0; Bit64s exp80 = fpu.regs[reg].ll&LONGTYPE(0x7ff0000000000000); - Bit64s exp80final = (exp80>>52) - BIAS64 + BIAS80; + Bit64s exp80final = (exp80>>52); Bit64s mant80 = fpu.regs[reg].ll&LONGTYPE(0x000fffffffffffff); Bit64s mant80final = (mant80 << 11); - // Elvira wants the 8 and tcalc doesn't - if(fpu.regs[reg].d != 0) mant80final |= LONGTYPE(0x8000000000000000); - test.begin= (static_cast(sign80)<<15)| static_cast(exp80final); + if(fpu.regs[reg].d != 0){ //Zero is a special case + // Elvira wants the 8 and tcalc doesn't + mant80final |= LONGTYPE(0x8000000000000000); + //Ca-cyber doesn't like this when result is zero. + exp80final += (BIAS80 - BIAS64); + } + test.begin = (static_cast(sign80)<<15)| static_cast(exp80final); test.eind.ll = mant80final; mem_writed(addr,test.eind.l.lower); mem_writed(addr+4,test.eind.l.upper);