From 338b6fe4969bd327804e167319b659a9f0a791cb Mon Sep 17 00:00:00 2001 From: Ry Date: Mon, 10 Oct 2022 18:41:18 -0700 Subject: [PATCH] Only allow one of: exception, int, or soft int to occur during a cycle --- src/cpu.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cpu.rs b/src/cpu.rs index b32b6fa..edc2643 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -323,14 +323,12 @@ impl Cpu { self.handle_exception(vector, self.next_exception_operand); self.next_exception = None; self.next_exception_operand = None; - } - if let Some(vector) = self.next_soft_interrupt { + } else if let Some(vector) = self.next_soft_interrupt { if self.flag.interrupt { self.handle_interrupt(vector); self.next_soft_interrupt = None; } - } - if let Some(vector) = self.next_interrupt { + } else if let Some(vector) = self.next_interrupt { if self.flag.interrupt { self.handle_interrupt(vector); self.next_interrupt = None;