chore(bus): add a select few read/write guards

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-06-09 20:48:31 -05:00
parent 50efe12aec
commit 2b7958f5f3
1 changed files with 15 additions and 26 deletions

View File

@ -158,14 +158,10 @@ impl BusIo for Bus {
}
0x8000..=0x9FFF => {
// 8KB Video RAM
// TODO: Fix Timing issues in PPU
// match self.ppu.stat.mode() {
// PpuMode::VBlank => 0xFF,
// _ => self.ppu.read_byte(addr),
// }
self.ppu.read_byte(addr)
match self.ppu.stat.mode() {
PpuMode::VBlank => 0xFF,
_ => self.ppu.read_byte(addr),
}
}
0xA000..=0xBFFF => match self.cartridge.as_ref() {
// 8KB External RAM
@ -195,16 +191,12 @@ impl BusIo for Bus {
}
0xFE00..=0xFE9F => {
// Sprite Attribute Table
use PpuMode::{HBlank, VBlank};
// TODO: Fix timing issues in the PPU
// use PpuMode::{HBlank, VBlank};
// match self.ppu.stat.mode() {
// HBlank | VBlank => self.ppu.oam.read_byte(addr),
// _ => 0xFF,
// }
self.ppu.oam.read_byte(addr)
match self.ppu.stat.mode() {
HBlank | VBlank => self.ppu.oam.read_byte(addr),
_ => 0xFF,
}
}
0xFEA0..=0xFEFF => {
// Prohibited Memory
@ -313,15 +305,12 @@ impl BusIo for Bus {
}
0xFE00..=0xFE9F => {
// Sprite Attribute Table
// use PpuMode::{HBlank, VBlank};
use PpuMode::{HBlank, VBlank};
// TODO: Fix Timing issues in the PPU
// match self.ppu.stat.mode() {
// HBlank | VBlank => self.ppu.oam.write_byte(addr, byte),
// _ => {}
// }
self.ppu.oam.write_byte(addr, byte)
match self.ppu.stat.mode() {
HBlank | VBlank => self.ppu.oam.write_byte(addr, byte),
_ => {}
}
}
0xFEA0..=0xFEFF => {} // TODO: As far as I know, writes to here do nothing.
0xFF00..=0xFF7F => {
@ -376,7 +365,7 @@ impl BusIo for Bus {
self.boot = None;
}
}
_ => unimplemented!("Unable to write to {:#06X} in I/O Registers", addr),
_ => {} // unimplemented!("Unable to write to {:#06X} in I/O Registers", addr),
};
}
0xFF80..=0xFFFE => {