summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2019-12-30 12:54:30 -0600
committer cracyc <cracyc@users.noreply.github.com>2019-12-30 12:54:30 -0600
commit585bcb58e156e619360cd548134eebdf10e4a758 (patch)
tree487866e286e5a0bc642be748b464a8c35acf0a65
parentd081683f0f81fef0006c7ae641f7729af1057081 (diff)
i8087: apply relevant changes (nw)
-rw-r--r--src/devices/machine/i8087.cpp34
-rw-r--r--src/devices/machine/i8087.h2
2 files changed, 22 insertions, 14 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();
diff --git a/src/devices/machine/i8087.h b/src/devices/machine/i8087.h
index 9344ca2e68e..aab97cd3305 100644
--- a/src/devices/machine/i8087.h
+++ b/src/devices/machine/i8087.h
@@ -76,7 +76,7 @@ private:
void set_stack_overflow();
int inc_stack();
int dec_stack();
- int check_exceptions();
+ int check_exceptions(bool store = false);
void write_cw(u16 cw);
floatx80 add(floatx80 a, floatx80 b);
floatx80 sub(floatx80 a, floatx80 b);