diff options
Diffstat (limited to 'src/devices/machine/i8087.cpp')
-rw-r--r-- | src/devices/machine/i8087.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/devices/machine/i8087.cpp b/src/devices/machine/i8087.cpp index f0c96cadd3a..e203ee82d4e 100644 --- a/src/devices/machine/i8087.cpp +++ b/src/devices/machine/i8087.cpp @@ -434,7 +434,7 @@ int i8087_device::dec_stack() * *************************************/ -int i8087_device::check_exceptions() +int i8087_device::check_exceptions(bool store) { /* Update the exceptions from SoftFloat */ if (float_exception_flags & float_flag_invalid) @@ -457,13 +457,21 @@ int i8087_device::check_exceptions() m_sw |= X87_SW_PE; float_exception_flags &= ~float_flag_inexact; } + if (float_exception_flags & float_flag_divbyzero) + { + m_sw |= X87_SW_ZE; + float_exception_flags &= ~float_flag_divbyzero; + } + + u16 unmasked = (m_sw & ~m_cw) & 0x3f; if ((m_sw & ~m_cw) & 0x3f) { // interrupt handler if (!(m_cw & X87_CW_IEM)) { m_sw |= X87_SW_ES; m_int_handler(1); } logerror("Unmasked x87 exception (CW:%.4x, SW:%.4x)\n", m_cw, m_sw); - return 0; + if (store || !(unmasked & (X87_SW_OE | X87_SW_UE))) + return 0; } return 1; @@ -2761,7 +2769,7 @@ void i8087_device::fst_m32real(u8 modrm) value = ST(0); } - if (check_exceptions()) + if (check_exceptions(true)) { u32 m32real = floatx80_to_float32(value); WRITE32(ea, m32real); @@ -2786,7 +2794,7 @@ void i8087_device::fst_m64real(u8 modrm) value = ST(0); } - if (check_exceptions()) + if (check_exceptions(true)) { uint64_t m64real = floatx80_to_float64(value); WRITE64(ea, m64real); @@ -2833,7 +2841,7 @@ void i8087_device::fstp_m32real(u8 modrm) value = ST(0); } - if (check_exceptions()) + if (check_exceptions(true)) { u32 m32real = floatx80_to_float32(value); WRITE32(ea, m32real); @@ -2860,7 +2868,7 @@ void i8087_device::fstp_m64real(u8 modrm) u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { uint64_t m64real = floatx80_to_float64(value); WRITE64(ea, m64real); @@ -2886,7 +2894,7 @@ void i8087_device::fstp_m80real(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE80(ea, value); inc_stack(); @@ -2945,7 +2953,7 @@ void i8087_device::fist_m16int(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE16(ea, m16int); } @@ -2978,7 +2986,7 @@ void i8087_device::fist_m32int(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE32(ea, m32int); } @@ -3011,7 +3019,7 @@ void i8087_device::fistp_m16int(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE16(ea, m16int); inc_stack(); @@ -3045,7 +3053,7 @@ void i8087_device::fistp_m32int(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE32(ea, m32int); inc_stack(); @@ -3079,7 +3087,7 @@ void i8087_device::fistp_m64int(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE64(ea, m64int); inc_stack(); @@ -3114,7 +3122,7 @@ void i8087_device::fbstp(u8 modrm) } u32 ea = m_ea; - if (check_exceptions()) + if (check_exceptions(true)) { WRITE80(ea, result); inc_stack(); |