From 61b8dfe1f222605f0358e5389219be0f1d0bdb21 Mon Sep 17 00:00:00 2001 From: omarandlorraine <64254276+omarandlorraine@users.noreply.github.com> Date: Sun, 26 Mar 2023 23:27:44 +0100 Subject: [PATCH] add single_step function (#62) Co-authored-by: Sam M W --- src/cpu.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cpu.rs b/src/cpu.rs index 0721a50..ff81865 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -415,6 +415,12 @@ impl CPU { }; } + pub fn single_step(&mut self) { + if let Some(decoded_instr) = self.fetch_next_and_decode() { + self.execute_instruction(decoded_instr); + } + } + pub fn run(&mut self) { while let Some(decoded_instr) = self.fetch_next_and_decode() { self.execute_instruction(decoded_instr);