diff options
author | 2023-04-25 17:39:03 +0700 | |
---|---|---|
committer | 2023-04-25 17:39:03 +0700 | |
commit | ec782b984fda90d90abc69d9e1ca29055604f8a7 (patch) | |
tree | 0b12083ab4d0c39b9fca6642d39c288e77533e90 /src/devices/cpu/m88000/m88000.cpp | |
parent | 5b567d4a37084065174316671fc33241b67f40bc (diff) |
m88000: fix subtraction borrow out
Diffstat (limited to 'src/devices/cpu/m88000/m88000.cpp')
-rw-r--r-- | src/devices/cpu/m88000/m88000.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/devices/cpu/m88000/m88000.cpp b/src/devices/cpu/m88000/m88000.cpp index 7fcea8dfece..9f2f2c65aae 100644 --- a/src/devices/cpu/m88000/m88000.cpp +++ b/src/devices/cpu/m88000/m88000.cpp @@ -794,7 +794,7 @@ void mc88100_device::execute(u32 const inst) u32 const data = m_r[S1] + ~m_r[S2] + 1; // compute borrow out - if (carry(m_r[S1], ~m_r[S2], data)) + if (carry(m_r[S1], ~m_r[S2] + 1, data)) m_cr[PSR] |= PSR_C; else m_cr[PSR] &= ~PSR_C; @@ -810,7 +810,7 @@ void mc88100_device::execute(u32 const inst) u32 const data = m_r[S1] + ~m_r[S2] + !bool(m_cr[PSR] & PSR_C); // compute borrow out - if (carry(m_r[S1], ~m_r[S2], data)) + if (carry(m_r[S1], ~m_r[S2] + !bool(m_cr[PSR] & PSR_C), data)) m_cr[PSR] |= PSR_C; else m_cr[PSR] &= ~PSR_C; @@ -901,7 +901,7 @@ void mc88100_device::execute(u32 const inst) u32 const data = m_r[S1] + ~m_r[S2] + 1; // compute borrow out - if (carry(m_r[S1], ~m_r[S2], data)) + if (carry(m_r[S1], ~m_r[S2] + 1, data)) m_cr[PSR] |= PSR_C; else m_cr[PSR] &= ~PSR_C; @@ -917,7 +917,7 @@ void mc88100_device::execute(u32 const inst) u32 const data = m_r[S1] + ~m_r[S2] + !bool(m_cr[PSR] & PSR_C); // compute borrow out - if (carry(m_r[S1], ~m_r[S2], data)) + if (carry(m_r[S1], ~m_r[S2] + !bool(m_cr[PSR] & PSR_C), data)) m_cr[PSR] |= PSR_C; else m_cr[PSR] &= ~PSR_C; @@ -1453,7 +1453,7 @@ u32 mc88100_device::cmp(u32 const src1, u32 const src2) const bool mc88100_device::carry(u32 const src1, u32 const src2, u32 const dest) const { - return ((BIT(src2, 31) && BIT(src1, 31)) || (!BIT(dest, 31) && (BIT(src2, 31) || BIT(src1, 31)))); + return BIT((src1 & src2) ^ ((src1 ^ src2) & ~dest), 31); } bool mc88100_device::overflow(u32 const src1, u32 const src2, u32 const dest) const |