sanity checks
This commit is contained in:
parent
5df0b6f70f
commit
b0df42ad5e
1 changed files with 13 additions and 4 deletions
11
cpu.cpp
11
cpu.cpp
|
@ -149,6 +149,8 @@ uint16_t cpu::getRegister(const int nr, const rm_selection_t mode_selection) con
|
||||||
return sp[getPSW_runmode()];
|
return sp[getPSW_runmode()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(nr == 7);
|
||||||
|
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +168,7 @@ void cpu::setRegister(const int nr, const uint16_t value, const rm_selection_t m
|
||||||
sp[getPSW_runmode()] = value;
|
sp[getPSW_runmode()] = value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
assert(nr == 7);
|
||||||
pc = value;
|
pc = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +213,8 @@ uint16_t cpu::addRegister(const int nr, const rm_selection_t mode_selection, con
|
||||||
return sp[getPSW_runmode()] += value;
|
return sp[getPSW_runmode()] += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(nr == 7);
|
||||||
|
|
||||||
return pc += value;
|
return pc += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,9 +227,11 @@ void cpu::lowlevel_register_set(const uint8_t set, const uint8_t reg, const uint
|
||||||
regs0_5[set][reg] = value;
|
regs0_5[set][reg] = value;
|
||||||
else if (reg == 6)
|
else if (reg == 6)
|
||||||
sp[set == 0 ? 0 : 3] = value;
|
sp[set == 0 ? 0 : 3] = value;
|
||||||
else
|
else {
|
||||||
|
assert(reg == 7);
|
||||||
pc = value;
|
pc = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t cpu::lowlevel_register_get(const uint8_t set, const uint8_t reg)
|
uint16_t cpu::lowlevel_register_get(const uint8_t set, const uint8_t reg)
|
||||||
{
|
{
|
||||||
|
@ -237,6 +244,8 @@ uint16_t cpu::lowlevel_register_get(const uint8_t set, const uint8_t reg)
|
||||||
if (reg == 6)
|
if (reg == 6)
|
||||||
return sp[set == 0 ? 0 : 3];
|
return sp[set == 0 ? 0 : 3];
|
||||||
|
|
||||||
|
assert(reg == 7);
|
||||||
|
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue