From 4b0c51c2563d6b048ac37aeed561cf9b25116501 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 16 Mar 2020 22:24:07 +0100 Subject: ks0164: Z is set on bset/bclr (nw) --- src/devices/cpu/ks0164/ks0164.cpp | 13 +++++++++++-- src/devices/sound/ks0164.cpp | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/devices/cpu/ks0164/ks0164.cpp b/src/devices/cpu/ks0164/ks0164.cpp index 966d037d1a9..d3de46b9267 100644 --- a/src/devices/cpu/ks0164/ks0164.cpp +++ b/src/devices/cpu/ks0164/ks0164.cpp @@ -403,7 +403,12 @@ void ks0164_cpu_device::execute_run() case 2: { // Bit set in register // 1110 .rrr bbbb .001 - m_r[(opcode >> 8) & 7] |= 1 << ((opcode >> 4) & 0xf); + if(m_r[(opcode >> 8) & 7] & (1 << ((opcode >> 4) & 0xf))) + m_r[R_PSW] &= ~F_Z; + else { + m_r[R_PSW] |= F_Z; + m_r[(opcode >> 8) & 7] |= 1 << ((opcode >> 4) & 0xf); + } break; } @@ -557,7 +562,11 @@ void ks0164_cpu_device::execute_run() case 2: { // Bit clear in register // 1110 .rrr bbbb .001 - m_r[(opcode >> 8) & 7] &= ~(1 << ((opcode >> 4) & 0xf)); + if(m_r[(opcode >> 8) & 7] & (1 << ((opcode >> 4) & 0xf))) { + m_r[(opcode >> 8) & 7] &= ~(1 << ((opcode >> 4) & 0xf)); + m_r[R_PSW] &= ~F_Z; + } else + m_r[R_PSW] |= F_Z; break; } diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp index 774081c6acc..6746fba18d2 100644 --- a/src/devices/sound/ks0164.cpp +++ b/src/devices/sound/ks0164.cpp @@ -234,7 +234,7 @@ u16 ks0164_device::voice_r(offs_t offset) void ks0164_device::voice_w(offs_t offset, u16 data, u16 mem_mask) { COMBINE_DATA(&m_sregs[m_voice_select & 0x1f][offset]); - if(m_cpu->pc() < 0x5f94 || m_cpu->pc() > 0x5fc0) + if(1 || m_cpu->pc() < 0x5f94 || m_cpu->pc() > 0x5fc0) logerror("voice %02x.%02x = %04x (%04x)\n", m_voice_select & 0x1f, offset, m_sregs[m_voice_select & 0x1f][offset], m_cpu->pc()); } -- cgit v1.2.3