diff --git a/src/processor/instructions/instructions.rs b/src/processor/instructions/instructions.rs index b39e8bc..ed0c0b9 100644 --- a/src/processor/instructions/instructions.rs +++ b/src/processor/instructions/instructions.rs @@ -61,7 +61,7 @@ impl Cpu { pub(crate) fn dec(&mut self, reg: Reg8) { let result = self.reg.get_8(reg); - let val = self.dec_raw(result); + let val = self.dec_flags(result); self.reg.set_8(reg, val); } diff --git a/src/processor/instructions/primitives.rs b/src/processor/instructions/primitives.rs index 70925d4..968a12b 100644 --- a/src/processor/instructions/primitives.rs +++ b/src/processor/instructions/primitives.rs @@ -151,7 +151,7 @@ impl Cpu { result } - pub(crate) fn dec_raw(&mut self, val: u8) -> u8 { + pub(crate) fn dec_flags(&mut self, val: u8) -> u8 { let result = val.wrapping_sub(0x1); self.set_flag(Flags::NSubtract); self.set_or_clear_flag(Flags::Zero, result == 0x0); diff --git a/src/processor/opcodes.rs b/src/processor/opcodes.rs index 92bf565..c452714 100644 --- a/src/processor/opcodes.rs +++ b/src/processor/opcodes.rs @@ -285,7 +285,7 @@ impl Cpu { 3 } 0x35 => { - let val = self.dec_raw(self.memory.get(self.reg.hl)); + let val = self.dec_flags(self.memory.get(self.reg.hl)); self.memory.set(self.reg.hl, val); 3 }