get_register_set() instead of getBitPSW(11)

This commit is contained in:
folkert van heusden 2024-04-29 08:54:17 +02:00
parent 7f0f4ba4c5
commit 4a41ee6b1f
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 4 additions and 3 deletions

View file

@ -137,7 +137,7 @@ void cpu::reset()
uint16_t cpu::getRegister(const int nr, const rm_selection_t mode_selection) const uint16_t cpu::getRegister(const int nr, const rm_selection_t mode_selection) const
{ {
if (nr < 6) { if (nr < 6) {
int set = getBitPSW(11); int set = get_register_set();
return regs0_5[set][nr]; 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) void cpu::setRegister(const int nr, const uint16_t value, const rm_selection_t mode_selection)
{ {
if (nr < 6) { if (nr < 6) {
int set = getBitPSW(11); int set = get_register_set();
regs0_5[set][nr] = value; 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) uint16_t cpu::addRegister(const int nr, const rm_selection_t mode_selection, const uint16_t value)
{ {
if (nr < 6) if (nr < 6)
return regs0_5[getBitPSW(11)][nr] += value; return regs0_5[get_register_set()][nr] += value;
if (nr == 6) { if (nr == 6) {
if (mode_selection == rm_prev) if (mode_selection == rm_prev)

1
cpu.h
View file

@ -160,6 +160,7 @@ public:
bool getBitPSW(const int bit) const; bool getBitPSW(const int bit) const;
int getPSW_runmode() const { return psw >> 14; }; int getPSW_runmode() const { return psw >> 14; };
int getPSW_prev_runmode() const { return (psw >> 12) & 3; }; 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_c(const bool v);
void setPSW_v(const bool v); void setPSW_v(const bool v);