summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2026-05-01 22:01:04 -0500
committer cracyc <cracyc@users.noreply.github.com>2026-05-01 22:01:04 -0500
commit67b67f83d7be409132832611ecdf191dbd4e7d01 (patch)
tree3e3abc5927d57217416a68b21a517ae678d853c9 /src/devices/cpu
parent8945f05060c1ea53fb2c56bc8408242c42c99b92 (diff)
i8087: fix fprem1
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/i386/x87ops.hxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/devices/cpu/i386/x87ops.hxx b/src/devices/cpu/i386/x87ops.hxx
index 374697227a4..a9c53159642 100644
--- a/src/devices/cpu/i386/x87ops.hxx
+++ b/src/devices/cpu/i386/x87ops.hxx
@@ -2303,13 +2303,21 @@ void i386_device::x87_fprem1(uint8_t modrm)
}
else
{
- extFloat80_t a = ST(0);
- extFloat80_t b = ST(1);
+ uint64_t q;
m_x87_sw &= ~X87_SW_C2;
- // TODO: Implement Cx bits
- result = extF80_rem(a, b);
+ if (!extFloat80_ieee754_remainder(ST(0), ST(1), result, q)) {
+ m_x87_sw &= ~(X87_SW_C0|X87_SW_C3|X87_SW_C1);
+ if (q & 1)
+ m_x87_sw |= X87_SW_C1;
+ if (q & 2)
+ m_x87_sw |= X87_SW_C3;
+ if (q & 4)
+ m_x87_sw |= X87_SW_C0;
+ }
+ else
+ m_x87_sw |= X87_SW_C2;
}
if (x87_check_exceptions())