diff --git a/src/cpu.rs b/src/cpu.rs index 83dddb51ad9810e42bf7c28a888a6c65430f3b79..6afaf341ce4a223e0559ef20acf2f894098f813e 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -149,7 +149,7 @@ impl Cpu { let (instruction_fn, instruction_time, instruction_str) = instruction; - if *instruction_str == "! UNIMP !" { + if *instruction_str == "! UNIMP !" || *instruction_str == "HALT" { println!( "{}\t(0x{:02x})\t${:04x} {}", instruction_str, opcode, pc, is_prefix @@ -177,6 +177,11 @@ impl Cpu { self.mmu().ppu() } + #[inline(always)] + pub fn halted(&self) -> bool { + self.halted + } + #[inline(always)] pub fn ticks(&self) -> u32 { self.ticks diff --git a/src/ppu.rs b/src/ppu.rs index b2065dfb9e6158ede31e772c01e095d03082addb..cfa871f70d0a030386cfb93dddff8180c12e6257 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -453,6 +453,12 @@ impl Ppu { } } + /// Clears the current frame buffer, setting the background color + /// for all the pixels in the frame buffer. + pub fn clear_frame_buffer(&mut self) { + self.fill_frame_buffer([255, 255, 255]); + } + /// Prints the tile data information to the stdout, this is /// useful for debugging purposes. pub fn print_tile_stdout(&self, tile_index: usize) {