1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 19:16:34 +00:00

Add a between-instructions enforcement of SH = 1.

This commit is contained in:
Thomas Harte
2023-08-05 14:57:43 -04:00
parent cdb86022a6
commit c0eb401d04
2 changed files with 4 additions and 2 deletions
@@ -67,6 +67,9 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
last_operation_pc_ = registers_.pc;
last_operation_program_bank_ = uint8_t(registers_.program_bank >> 16);
memory_lock_ = false;
// Reenforce the top byte of S if applicable.
registers_.s.halves.high = stack_address();
} continue;
case OperationDecode: {
@@ -1131,11 +1131,10 @@ void ProcessorStorage::set_emulation_mode(bool enabled) {
set_m_x_flags(true, true);
registers_.e_masks[0] = 0xff00;
registers_.e_masks[1] = 0x00ff;
registers_.s.halves.high = 1;
} else {
registers_.e_masks[0] = 0x0000;
registers_.e_masks[1] = 0xffff;
registers_.s.halves.high = 1; // To pretend it was 1 all along; this implementation actually ignores
// the top byte while in emulation mode.
}
}