chore(bus): add a select few read/write guards
This commit is contained in:
parent
50efe12aec
commit
2b7958f5f3
41
src/bus.rs
41
src/bus.rs
|
@ -158,14 +158,10 @@ impl BusIo for Bus {
|
||||||
}
|
}
|
||||||
0x8000..=0x9FFF => {
|
0x8000..=0x9FFF => {
|
||||||
// 8KB Video RAM
|
// 8KB Video RAM
|
||||||
|
match self.ppu.stat.mode() {
|
||||||
// TODO: Fix Timing issues in PPU
|
PpuMode::VBlank => 0xFF,
|
||||||
// match self.ppu.stat.mode() {
|
_ => self.ppu.read_byte(addr),
|
||||||
// PpuMode::VBlank => 0xFF,
|
}
|
||||||
// _ => self.ppu.read_byte(addr),
|
|
||||||
// }
|
|
||||||
|
|
||||||
self.ppu.read_byte(addr)
|
|
||||||
}
|
}
|
||||||
0xA000..=0xBFFF => match self.cartridge.as_ref() {
|
0xA000..=0xBFFF => match self.cartridge.as_ref() {
|
||||||
// 8KB External RAM
|
// 8KB External RAM
|
||||||
|
@ -195,16 +191,12 @@ impl BusIo for Bus {
|
||||||
}
|
}
|
||||||
0xFE00..=0xFE9F => {
|
0xFE00..=0xFE9F => {
|
||||||
// Sprite Attribute Table
|
// Sprite Attribute Table
|
||||||
|
use PpuMode::{HBlank, VBlank};
|
||||||
|
|
||||||
// TODO: Fix timing issues in the PPU
|
match self.ppu.stat.mode() {
|
||||||
// use PpuMode::{HBlank, VBlank};
|
HBlank | VBlank => self.ppu.oam.read_byte(addr),
|
||||||
|
_ => 0xFF,
|
||||||
// match self.ppu.stat.mode() {
|
}
|
||||||
// HBlank | VBlank => self.ppu.oam.read_byte(addr),
|
|
||||||
// _ => 0xFF,
|
|
||||||
// }
|
|
||||||
|
|
||||||
self.ppu.oam.read_byte(addr)
|
|
||||||
}
|
}
|
||||||
0xFEA0..=0xFEFF => {
|
0xFEA0..=0xFEFF => {
|
||||||
// Prohibited Memory
|
// Prohibited Memory
|
||||||
|
@ -313,15 +305,12 @@ impl BusIo for Bus {
|
||||||
}
|
}
|
||||||
0xFE00..=0xFE9F => {
|
0xFE00..=0xFE9F => {
|
||||||
// Sprite Attribute Table
|
// Sprite Attribute Table
|
||||||
// use PpuMode::{HBlank, VBlank};
|
use PpuMode::{HBlank, VBlank};
|
||||||
|
|
||||||
// TODO: Fix Timing issues in the PPU
|
match self.ppu.stat.mode() {
|
||||||
// match self.ppu.stat.mode() {
|
HBlank | VBlank => self.ppu.oam.write_byte(addr, byte),
|
||||||
// HBlank | VBlank => self.ppu.oam.write_byte(addr, byte),
|
_ => {}
|
||||||
// _ => {}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
self.ppu.oam.write_byte(addr, byte)
|
|
||||||
}
|
}
|
||||||
0xFEA0..=0xFEFF => {} // TODO: As far as I know, writes to here do nothing.
|
0xFEA0..=0xFEFF => {} // TODO: As far as I know, writes to here do nothing.
|
||||||
0xFF00..=0xFF7F => {
|
0xFF00..=0xFF7F => {
|
||||||
|
@ -376,7 +365,7 @@ impl BusIo for Bus {
|
||||||
self.boot = None;
|
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 => {
|
0xFF80..=0xFFFE => {
|
||||||
|
|
Loading…
Reference in New Issue