Remove excess cycles from reads
This commit is contained in:
parent
a7703ab842
commit
268d41be59
@ -915,10 +915,7 @@ impl CPU {
|
|||||||
/// Panic-free alternative to [Index]
|
/// Panic-free alternative to [Index]
|
||||||
pub fn get_r8(&mut self, r8: R8, bus: &impl BusIO) -> u8 {
|
pub fn get_r8(&mut self, r8: R8, bus: &impl BusIO) -> u8 {
|
||||||
match r8 {
|
match r8 {
|
||||||
R8::HLmem => {
|
R8::HLmem => self.read(self.hl.wide().0, bus).unwrap_or(0xff),
|
||||||
self.m_cycles += 1;
|
|
||||||
self.read(self.hl.wide().0, bus).unwrap_or(0xff)
|
|
||||||
}
|
|
||||||
_ => self[r8].0,
|
_ => self[r8].0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -928,7 +925,6 @@ impl CPU {
|
|||||||
pub fn set_r8(&mut self, r8: R8, data: u8, bus: &mut impl BusIO) {
|
pub fn set_r8(&mut self, r8: R8, data: u8, bus: &mut impl BusIO) {
|
||||||
match r8 {
|
match r8 {
|
||||||
R8::HLmem => {
|
R8::HLmem => {
|
||||||
self.m_cycles += 1;
|
|
||||||
let _ = self.write(self.hl.wide().0, data, bus);
|
let _ = self.write(self.hl.wide().0, data, bus);
|
||||||
}
|
}
|
||||||
_ => self[r8].0 = data,
|
_ => self[r8].0 = data,
|
||||||
|
Loading…
Reference in New Issue
Block a user