1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Merge pull request #1150 from TomHarte/65816Setter

Don't allow setting of an invalid S.
This commit is contained in:
Thomas Harte 2023-08-07 09:19:59 -04:00 committed by GitHub
commit b9bd3f9b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;