From 2813b762dd5b1853b235ee801fabe9685728614d Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 22 Mar 2021 21:52:28 -0500 Subject: [PATCH] chore: replace select unreachable! macros with todo! and unreachable! --- src/bus.rs | 9 +++------ src/cartridge.rs | 4 ++-- src/instruction.rs | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/bus.rs b/src/bus.rs index 51d8a63..bca6f36 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -120,7 +120,7 @@ impl Bus { // Sprite Attribute Table unimplemented!("Unable to read {:#06X} in the Sprite Attribute Table", addr); } - 0xFEA0..=0xFEFF => unimplemented!("{:#06X} is not allowed to be used", addr), + 0xFEA0..=0xFEFF => unreachable!("{:#06X} is not allowed to be used", addr), 0xFF00..=0xFF7F => { // IO Registers match addr { @@ -204,12 +204,9 @@ impl Bus { } 0xFE00..=0xFE9F => { // Sprite Attribute Table - unimplemented!( - "Unable to write to {:#06X} in the Sprite Attribute Table", - addr - ); + unimplemented!("Unable to write to {:#06X} in Sprite Attribute Table", addr); } - 0xFEA0..=0xFEFF => unimplemented!("{:#06X} is not allowed to be used", addr), + 0xFEA0..=0xFEFF => unreachable!("{:#06X} is not allowed to be used", addr), 0xFF00..=0xFF7F => { // IO Registers match addr { diff --git a/src/cartridge.rs b/src/cartridge.rs index d70185f..d5d08d0 100644 --- a/src/cartridge.rs +++ b/src/cartridge.rs @@ -187,7 +187,7 @@ impl MemoryBankController for MBC1 { Value(0xFF) } } - _ => unimplemented!(), + _ => unreachable!("A read from {:#06X} should not be handled by MBC1", addr), } } @@ -209,7 +209,7 @@ impl MemoryBankController for MBC1 { self.ram[ram_addr as usize] = byte; } } - _ => unreachable!("{:#06X} should not be handled by MBC1", addr), + _ => unreachable!("A write to {:#06X} should not be handled by MBC1", addr), } } } diff --git a/src/instruction.rs b/src/instruction.rs index aeeb9e1..61155f7 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -541,7 +541,7 @@ impl Instruction { cpu.set_register(Register::A, rot_a); Cycles::new(4) } - Instruction::DAA => unimplemented!(), + Instruction::DAA => todo!("Implement DAA Instruction"), Instruction::CPL => { // Compliment A register (inverse) let mut flags: Flags = *cpu.flags(); @@ -576,7 +576,7 @@ impl Instruction { cpu.set_flags(flags); Cycles::new(4) } - Instruction::HALT => unimplemented!(), + Instruction::HALT => todo!("Implement HALT instruction"), Instruction::ADC(target) => match target { MATHTarget::Register(reg) => { // ADC A, r[z] | Add register r[z] plus the Carry flag to A