1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-26 10:29:31 +00:00

Corrects PBR/DBR resetting upon an exception.

This commit is contained in:
Thomas Harte 2020-12-29 15:27:49 -05:00
parent 114d48b076
commit e0b36c9c3d

View File

@ -407,14 +407,19 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
case OperationPrepareException:
data_buffer_.value = uint32_t((registers_.pc << 8) | get_flags());
registers_.program_bank = 0;
if(registers_.emulation_flag) {
if(!exception_is_interrupt_) data_buffer_.value |= Flag::Break;
data_buffer_.size = 3;
registers_.data_bank = 0;
++next_op_;
} else {
data_buffer_.value |= registers_.program_bank << 8;
data_buffer_.value |= registers_.program_bank << 8; // The PBR is always held such that
// PBR+PC produces a 24-bit address;
// therefore a shift by 8 is correct
// here — it matches the shift applied
// to .pc above.
data_buffer_.size = 4;
registers_.program_bank = 0;
}
registers_.flags.inverse_interrupt = 0;