1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-10-04 23:17:01 +00:00

Factor out would-accept-interrupt test, per uncertainty re: level 7.

This commit is contained in:
Thomas Harte
2022-06-03 08:31:35 -04:00
parent 6fcaf3571e
commit 02b6ea6c46
3 changed files with 12 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ void Executor<model, BusHandler>::signal_bus_error(FunctionCode code, uint32_t a
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::set_interrupt_level(int level) {
state_.interrupt_input_ = level;
state_.stopped &= state_.interrupt_input_ <= state_.status.interrupt_level;
state_.stopped &= !state_.status.would_accept_interrupt(level);
}
template <Model model, typename BusHandler>
@@ -324,7 +324,7 @@ template <Model model, typename BusHandler>
void Executor<model, BusHandler>::State::run(int &count) {
while(count--) {
// Check for a new interrupt.
if(interrupt_input > status.interrupt_level) {
if(status.would_accept_interrupt(interrupt_input)) {
const int vector = bus_handler_.acknowlege_interrupt(interrupt_input);
if(vector >= 0) {
raise_exception<false>(vector);