dec_raw -> dec_flags

This commit is contained in:
Alex Janka 2023-03-03 12:08:39 +11:00
parent 06031ad649
commit f9915c6ebf
3 changed files with 3 additions and 3 deletions

View file

@ -61,7 +61,7 @@ impl Cpu {
pub(crate) fn dec(&mut self, reg: Reg8) { pub(crate) fn dec(&mut self, reg: Reg8) {
let result = self.reg.get_8(reg); 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); self.reg.set_8(reg, val);
} }

View file

@ -151,7 +151,7 @@ impl Cpu {
result 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); let result = val.wrapping_sub(0x1);
self.set_flag(Flags::NSubtract); self.set_flag(Flags::NSubtract);
self.set_or_clear_flag(Flags::Zero, result == 0x0); self.set_or_clear_flag(Flags::Zero, result == 0x0);

View file

@ -285,7 +285,7 @@ impl Cpu {
3 3
} }
0x35 => { 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); self.memory.set(self.reg.hl, val);
3 3
} }