From a57160930457a92bf1838fc44defc06f64ea1b7f Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 25 Mar 2023 20:50:56 +0100 Subject: [PATCH] KKTB: PSW shall not be altered during an RTI --- cpu.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 62861a0..c966eb8 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -238,15 +238,10 @@ int cpu::getPSW_spl() const void cpu::setPSW(const uint16_t v, const bool limited) { - if (limited) { - psw |= v & 0174000; // current & previous mode can only be increased, 11 can only be set - - psw &= 0174000; // retain upper 5 bit - psw |= v & ~0174000; - } - else { - psw = v; - } + if (limited) + psw = (v & 0174037) | (psw & 0174340); + else + psw = v & 0174377; } void cpu::setPSW_flags_nzv(const uint16_t value, const word_mode_t word_mode)