1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-27 00:30:26 +00:00

Merge pull request #1149 from TomHarte/65816StackAgain

Add a between-instructions enforcement of SH = 1.
This commit is contained in:
Thomas Harte 2023-08-05 15:14:53 -04:00 committed by GitHub
commit 0222dcf5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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: {

View File

@ -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.
}
}