diff --git a/src/devices/cpu/unsp/unsp_extended.cpp b/src/devices/cpu/unsp/unsp_extended.cpp index b1cd206a626..948255ff610 100644 --- a/src/devices/cpu/unsp/unsp_extended.cpp +++ b/src/devices/cpu/unsp/unsp_extended.cpp @@ -240,7 +240,7 @@ void unsp_20_device::execute_extended_group(uint16_t op) if (aluop != 0x0d) r1 = read16(r2); m_core->m_r[ry] = (uint16_t)(m_core->m_r[ry] - 1); - if (m_core->m_r[ry] == 0xffff) + if (m_core->m_r[ry] == 0xffff && use_ds) m_core->m_r[REG_SR] -= 0x0400; break; case 0x2: // Rx, [Ry++] @@ -248,7 +248,7 @@ void unsp_20_device::execute_extended_group(uint16_t op) if (aluop != 0x0d) r1 = read16(r2); m_core->m_r[ry] = (uint16_t)(m_core->m_r[ry] + 1); - if (m_core->m_r[ry] == 0x0000) + if (m_core->m_r[ry] == 0x0000 && use_ds) m_core->m_r[REG_SR] += 0x0400; break; case 0x3: // Rx, [++Ry] diff --git a/src/devices/cpu/unsp/unsp_exxx.cpp b/src/devices/cpu/unsp/unsp_exxx.cpp index 07e8f056984..06ccd2e11f5 100644 --- a/src/devices/cpu/unsp/unsp_exxx.cpp +++ b/src/devices/cpu/unsp/unsp_exxx.cpp @@ -83,7 +83,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op) const uint16_t addr = m_core->m_r[rd]; const uint16_t orig = read16(addr); m_core->m_r[REG_SR] &= ~UNSP_Z; - m_core->m_r[REG_SR] |= BIT(m_core->m_r[rd], offset) ? 0 : UNSP_Z; + m_core->m_r[REG_SR] |= BIT(orig, offset) ? 0 : UNSP_Z; switch (bitop) { @@ -113,7 +113,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op) const uint32_t addr = m_core->m_r[rd] | (get_ds() << 16); const uint16_t orig = read16(addr); m_core->m_r[REG_SR] &= ~UNSP_Z; - m_core->m_r[REG_SR] |= BIT(m_core->m_r[rd], offset) ? 0 : UNSP_Z; + m_core->m_r[REG_SR] |= BIT(orig, offset) ? 0 : UNSP_Z; switch (bitop) { @@ -140,11 +140,11 @@ void unsp_12_device::execute_exxx_group(uint16_t op) const uint8_t bitop = (op & 0x0030) >> 4; const uint8_t rd = (op & 0x0e00) >> 9; const uint8_t rs = (op & 0x0007) >> 0; - const uint8_t offset = (1 << m_core->m_r[rs]); + const uint8_t offset = (1 << (m_core->m_r[rs] & 0xf)); const uint16_t addr = m_core->m_r[rd]; const uint16_t orig = read16(addr); m_core->m_r[REG_SR] &= ~UNSP_Z; - m_core->m_r[REG_SR] |= BIT(m_core->m_r[rd], offset) ? 0 : UNSP_Z; + m_core->m_r[REG_SR] |= BIT(orig, offset) ? 0 : UNSP_Z; switch (bitop) { diff --git a/src/devices/cpu/unsp/unsp_fxxx.cpp b/src/devices/cpu/unsp/unsp_fxxx.cpp index 638f8d27387..fabec7a8d70 100644 --- a/src/devices/cpu/unsp/unsp_fxxx.cpp +++ b/src/devices/cpu/unsp/unsp_fxxx.cpp @@ -250,7 +250,6 @@ inline void unsp_device::execute_fxxx_100_group(uint16_t op) void unsp_12_device::execute_divq(uint16_t op) { - uint32_t orig_dividend = 0; if (m_core->m_divq_bit == UINT_MAX) { m_core->m_divq_bit = 15; @@ -258,7 +257,6 @@ void unsp_12_device::execute_divq(uint16_t op) m_core->m_divq_divisor = m_core->m_r[REG_R2]; m_core->m_divq_a = 0; } - orig_dividend = m_core->m_divq_dividend; m_core->m_aq = BIT(m_core->m_divq_a, 31); if (m_core->m_aq) {