summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/unsp/unsp_exxx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/unsp/unsp_exxx.cpp')
-rw-r--r--src/devices/cpu/unsp/unsp_exxx.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/devices/cpu/unsp/unsp_exxx.cpp b/src/devices/cpu/unsp/unsp_exxx.cpp
index 5a9a035d862..a516562abd8 100644
--- a/src/devices/cpu/unsp/unsp_exxx.cpp
+++ b/src/devices/cpu/unsp/unsp_exxx.cpp
@@ -42,8 +42,29 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
uint8_t bitop = (op & 0x0030) >> 4;
uint8_t rd = (op & 0x0e00) >> 9;
uint8_t rs = (op & 0x0007) >> 0;
- logerror("%s %s,%s\n", bitops[bitop], regs[rd], regs[rs]);
- unimplemented_opcode(op);
+
+ const uint8_t offset = (m_core->m_r[rs] & 0xf);
+
+ m_core->m_r[REG_SR] &= ~UNSP_Z;
+ m_core->m_r[REG_SR] |= BIT(m_core->m_r[rd], offset) ? 0 : UNSP_Z;
+
+ switch (bitop)
+ {
+ case 0x00: // tstb
+ return;
+
+ case 0x01: // setb
+ m_core->m_r[rd] |= (1 << offset);
+ return;
+
+ case 0x02: // clrb
+ m_core->m_r[rd] &= ~(1 << offset);
+ return;
+
+ case 0x03:
+ m_core->m_r[rd] ^= (1 << offset);
+ return;
+ }
return;
}
else if (((op & 0xf1c0) == 0xe040))
@@ -140,7 +161,7 @@ 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] & 0xf));
+ const uint8_t offset = (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;
@@ -171,11 +192,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 = (m_core->m_r[rs] & 0xf);
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)
{