diff --git a/src/cpu.rs b/src/cpu.rs index 045016fcbdc493d6d3ea0ef173115a9100b978b5..de5346c72e043712916b71c757dcd121af03f254 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -96,12 +96,12 @@ impl Cpu { let (instruction_fn, instruction_time, instruction_str) = instruction; - //if *instruction_str == "! UNIMP !" { + if !self.mmu.boot_active() || *instruction_str == "! UNIMP !" { println!( "{}\t(0x{:02x})\t${:04x} {}", instruction_str, opcode, pc, is_prefix ); - //} + } // calls the current instruction and increments the number of // cycles executed by the instruction time of the instruction diff --git a/src/mmu.rs b/src/mmu.rs index 2e1e4f67c720acb2666fb9253fb1a4b6ebf3980b..07b12d51cc2374b818cc55a53ee14faf8d1fb906 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -30,6 +30,10 @@ impl Mmu { &mut self.ppu } + pub fn boot_active(&self) -> bool { + self.boot_active + } + pub fn read(&mut self, addr: u16) -> u8 { match addr & 0xf000 { // BOOT (256 B) + ROM0 (4 KB/16 KB) @@ -74,9 +78,9 @@ impl Mmu { match addr & 0x00f0 { 0x40 | 0x50 | 0x60 | 0x70 => self.ppu.read(addr), 0x00 => { - //@todo implement the gamepad as a controller + println!("Reading from Game Pad control 0x{:04x}", addr); 0x00 - } + }, _ => { println!("Reading from unknown IO control 0x{:04x}", addr); 0x00 @@ -141,6 +145,9 @@ impl Mmu { 0x40 | 0x60 | 0x70 => { self.ppu.write(addr, value); } + 0x00 => { + println!("Writing to Game Pad, timer, etc. control 0x{:04x} := 0x{:02x}", addr, value); + }, 0x50 => match addr & 0x00ff { 0x50 => self.boot_active = false, _ => {