From 268d41be59829f661f56ac4b9412b2d817ad490f Mon Sep 17 00:00:00 2001 From: John Date: Tue, 9 Jul 2024 01:09:27 -0500 Subject: [PATCH] Remove excess cycles from reads --- src/cpu.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cpu.rs b/src/cpu.rs index 965e967..a0e7869 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -915,10 +915,7 @@ impl CPU { /// Panic-free alternative to [Index] pub fn get_r8(&mut self, r8: R8, bus: &impl BusIO) -> u8 { match r8 { - R8::HLmem => { - self.m_cycles += 1; - self.read(self.hl.wide().0, bus).unwrap_or(0xff) - } + R8::HLmem => self.read(self.hl.wide().0, bus).unwrap_or(0xff), _ => self[r8].0, } } @@ -928,7 +925,6 @@ impl CPU { pub fn set_r8(&mut self, r8: R8, data: u8, bus: &mut impl BusIO) { match r8 { R8::HLmem => { - self.m_cycles += 1; let _ = self.write(self.hl.wide().0, data, bus); } _ => self[r8].0 = data,