use crate::gb::ppu::Ppu;
pub trait GbBus {
fn read(&mut self, addr: u16) -> u8;
fn write(&mut self, addr: u16, val: u8);
fn tick(&mut self, _m_cycles: u8) {}
fn write_cpu_m_cycle(&mut self, addr: u16, val: u8) {
self.tick(1);
self.write(addr, val);
}
fn read_cpu_m_cycle(&mut self, addr: u16) -> u8 {
self.read(addr)
}
fn begin_instruction(&mut self) {}
fn notify_idu_glitch(&mut self, _addr: u16) {}
fn notify_idu_with_prior_read(&mut self, _addr: u16) {}
fn notify_oam_read(&mut self, _addr: u16) {}
fn notify_oam_write(&mut self, _addr: u16) {}
fn try_speed_switch(&mut self) -> bool {
false
}
fn enter_stop_mode(&mut self) {}
fn exit_stop_mode(&mut self) {}
fn consume_hdma_halt_cycle(&mut self) -> bool {
false
}
fn ppu(&self) -> &Ppu {
panic!("ppu() not available on this bus implementation")
}
fn ppu_mut(&mut self) -> &mut Ppu {
panic!("ppu_mut() not available on this bus implementation")
}
fn read_for_debugger(&self, _addr: u16) -> u8 {
panic!("read_for_debugger() not available on this bus implementation")
}
}
pub struct StubBus;
impl GbBus for StubBus {
fn read(&mut self, _addr: u16) -> u8 {
0xFF
}
fn write(&mut self, _addr: u16, _val: u8) {}
}