chore: remove panics when gameboy performs certain actions

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-04-08 19:22:55 -05:00
parent 41081e9cce
commit 23de87e482
2 changed files with 11 additions and 4 deletions

View File

@ -128,7 +128,11 @@ impl Bus {
// Sprite Attribute Table // Sprite Attribute Table
unimplemented!("Unable to read {:#06X} in the Sprite Attribute Table", addr); unimplemented!("Unable to read {:#06X} in the Sprite Attribute Table", addr);
} }
0xFEA0..=0xFEFF => unreachable!("{:#06X} is not allowed to be read from", addr), 0xFEA0..=0xFEFF => {
eprintln!("Read from {:#06X}, which is prohibited", addr);
// TODO: Properly Emulate what can happen here
0x00
}
0xFF00..=0xFF7F => { 0xFF00..=0xFF7F => {
// IO Registers // IO Registers
match addr { match addr {
@ -230,7 +234,10 @@ impl Bus {
// Sprite Attribute Table // Sprite Attribute Table
unimplemented!("Unable to write to {:#06X} in Sprite Attribute Table", addr); unimplemented!("Unable to write to {:#06X} in Sprite Attribute Table", addr);
} }
0xFEA0..=0xFEFF => unreachable!("{:#06X} is not allowed to be written to", addr), 0xFEA0..=0xFEFF => {
eprintln!("Wrote {:#04X} to {:#06X}, which is prohibited", byte, addr);
// TODO: Properly emulate what can happen here
}
0xFF00..=0xFF7F => { 0xFF00..=0xFF7F => {
// IO Registers // IO Registers
match addr { match addr {

View File

@ -221,8 +221,8 @@ impl MemoryBankController for NoMbc {
MbcResult::Address(addr) MbcResult::Address(addr)
} }
fn handle_write(&mut self, _addr: u16, _byte: u8) { fn handle_write(&mut self, _addr: u16, byte: u8) {
panic!("A MBC-less cartridge is read only") eprintln!("Tried to write {:#04X} to a read-only cartridge", byte);
} }
} }