1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-08 14:25:05 +00:00

Apply new status before entering STOP loop.

This commit is contained in:
Thomas Harte
2022-06-15 10:50:03 -04:00
parent 733ffc0eee
commit 93615f6647

View File

@@ -27,6 +27,7 @@ enum ExecutionState: int {
Reset = std::numeric_limits<int>::min(), Reset = std::numeric_limits<int>::min(),
Decode, Decode,
WaitForDTACK, WaitForDTACK,
WaitForInterrupt,
StoreOperand, StoreOperand,
StoreOperand_bw, StoreOperand_bw,
@@ -377,14 +378,20 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor
} }
MoveToStateSpecific(WaitForDTACK); MoveToStateSpecific(WaitForDTACK);
// Spin in place until an interrupt arrives.
BeginState(STOP): BeginState(STOP):
IdleBus(1); // Apply the suffix status.
status_.set_status(operand_[0].w);
did_update_status();
[[fallthrough]];
BeginState(WaitForInterrupt):
// Spin in place until an interrupt arrives.
captured_interrupt_level_ = bus_interrupt_level_; captured_interrupt_level_ = bus_interrupt_level_;
if(status_.would_accept_interrupt(captured_interrupt_level_)) { if(status_.would_accept_interrupt(captured_interrupt_level_)) {
MoveToStateSpecific(DoInterrupt); MoveToStateSpecific(DoInterrupt);
} }
MoveToStateSpecific(STOP); IdleBus(1);
MoveToStateSpecific(WaitForInterrupt);
// Perform the RESET exception, which seeds the stack pointer and program // Perform the RESET exception, which seeds the stack pointer and program
// counter, populates the prefetch queue, and then moves to instruction dispatch. // counter, populates the prefetch queue, and then moves to instruction dispatch.