From 10c0fa0cab6de27577b5331da9dcb15fef340c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Wed, 6 Jul 2022 17:23:48 +0100 Subject: [PATCH] feat: small tune and added method --- src/cpu.rs | 7 ++++++- src/ppu.rs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cpu.rs b/src/cpu.rs index 83dddb51..6afaf341 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 b2065dfb..cfa871f7 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) { -- GitLab