From 227e1e779b53e5a78693412ce9e2a3dc5eb4aff7 Mon Sep 17 00:00:00 2001 From: pjht Date: Thu, 10 Oct 2024 11:21:23 -0500 Subject: [PATCH] Fix INX and DCX not being wrapping --- src/cpu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpu.rs b/src/cpu.rs index fda80df..96287d9 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -401,8 +401,8 @@ impl I8080 { self.update_arith_flags(ac, self.carry, res); self.regs[src] = res; } - Opcode::Inx(dst) => self.set_pair(dst, self.get_pair(dst) + 1), - Opcode::Dcx(dst) => self.set_pair(dst, self.get_pair(dst) + 2), + Opcode::Inx(dst) => self.set_pair(dst, self.get_pair(dst).wrapping_add(1)), + Opcode::Dcx(dst) => self.set_pair(dst, self.get_pair(dst).wrapping_sub(1)), Opcode::Dad(src) => { let a = u32::from(self.get_pair(RegisterPair::HL)); let b = u32::from(self.get_pair(src));