From a3c4a7689f692b51e509568c6c7e0060649b348e Mon Sep 17 00:00:00 2001 From: Sam M W Date: Tue, 18 Oct 2022 09:42:51 +0100 Subject: [PATCH] the program counter should wrap as well --- src/cpu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu.rs b/src/cpu.rs index bc54d94..08fa4ee 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -68,7 +68,7 @@ impl CPU { let am_out = am.process(self, slice); // Increment program counter - self.registers.program_counter = self.registers.program_counter + num_bytes; + self.registers.program_counter = self.registers.program_counter.wrapping_add(num_bytes); Some((instr, am_out)) }