From 3aaebeaf3e49c29bd629905c01172a7dad10d3a2 Mon Sep 17 00:00:00 2001 From: Ry Date: Sat, 17 Sep 2022 14:51:18 -0700 Subject: [PATCH] Always allow exceptions to occur, regardless of interrupt flag state --- src/cpu.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpu.rs b/src/cpu.rs index 49fecff..ecb684b 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -211,7 +211,8 @@ impl Cpu { } pub fn interrupt(&mut self, interrupt: Interrupt) { if DEBUG { println!("interrupt(): enabled: {}", self.flag.interrupt); } - if self.flag.interrupt { + let is_exception = if let Interrupt::Exception(_) = interrupt { true } else { false }; + if self.flag.interrupt || is_exception { match interrupt { Interrupt::Request(vector) => { self.handle_interrupt(vector as u16);