From 4a41ee6b1fc740d65599764b5ec053cab43d3089 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Mon, 29 Apr 2024 08:54:17 +0200 Subject: [PATCH] get_register_set() instead of getBitPSW(11) --- cpu.cpp | 6 +++--- cpu.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 8fdc6ac..29fcca1 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -137,7 +137,7 @@ void cpu::reset() uint16_t cpu::getRegister(const int nr, const rm_selection_t mode_selection) const { if (nr < 6) { - int set = getBitPSW(11); + int set = get_register_set(); return regs0_5[set][nr]; } @@ -157,7 +157,7 @@ uint16_t cpu::getRegister(const int nr, const rm_selection_t mode_selection) con void cpu::setRegister(const int nr, const uint16_t value, const rm_selection_t mode_selection) { if (nr < 6) { - int set = getBitPSW(11); + int set = get_register_set(); regs0_5[set][nr] = value; } @@ -204,7 +204,7 @@ bool cpu::put_result(const gam_rc_t & g, const uint16_t value) uint16_t cpu::addRegister(const int nr, const rm_selection_t mode_selection, const uint16_t value) { if (nr < 6) - return regs0_5[getBitPSW(11)][nr] += value; + return regs0_5[get_register_set()][nr] += value; if (nr == 6) { if (mode_selection == rm_prev) diff --git a/cpu.h b/cpu.h index 98d2430..fa02705 100644 --- a/cpu.h +++ b/cpu.h @@ -160,6 +160,7 @@ public: bool getBitPSW(const int bit) const; int getPSW_runmode() const { return psw >> 14; }; int getPSW_prev_runmode() const { return (psw >> 12) & 3; }; + bool get_register_set() const { return !!(psw & 04000); } void setPSW_c(const bool v); void setPSW_v(const bool v);