1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-27 06:35:04 +00:00

Don't allow setting of an invalid S.

This commit is contained in:
Thomas Harte 2023-08-07 09:19:20 -04:00
parent 0222dcf5ce
commit 42024c1573

View File

@ -30,7 +30,10 @@ uint16_t ProcessorBase::value_of(Register r) const {
void ProcessorBase::set_value_of(Register r, uint16_t value) {
switch (r) {
case Register::ProgramCounter: registers_.pc = value; break;
case Register::StackPointer: registers_.s.full = value; break;
case Register::StackPointer:
registers_.s.full = value;
if(registers_.emulation_flag) registers_.s.halves.high = 1;
break;
case Register::Flags: set_flags(uint8_t(value)); break;
case Register::A: registers_.a.full = value; break;
case Register::X: registers_.x.full = value & registers_.x_mask; break;