From 9c90b69c20832fa38aa01b6e7a471e8666afe46d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sat, 9 Jul 2022 14:24:13 +0100
Subject: [PATCH] feat: more debug info

---
 src/ppu.rs |  6 ++++--
 src/rom.rs | 10 ++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/ppu.rs b/src/ppu.rs
index 0aca8d03..1ef9ec0e 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -4,6 +4,8 @@ use std::{
     fmt::{Display, Formatter},
 };
 
+use crate::debugln;
+
 #[cfg(feature = "wasm")]
 use wasm_bindgen::prelude::*;
 
@@ -473,10 +475,10 @@ impl Ppu {
                 }
             }
             0x004a => {
-                println!("Writing to $FF4A - WY (Window Y Position) (R/W)")
+                debugln!("Writing to $FF4A - WY (Window Y Position) (R/W)")
             }
             0x004b => {
-                println!("Writing to $FF4B - WX (Window X Position + 7) (R/W)")
+                debugln!("Writing to $FF4B - WX (Window X Position + 7) (R/W)")
             }
             0x007f => (),
             addr => panic!("Writing in unknown PPU location 0x{:04x}", addr),
diff --git a/src/rom.rs b/src/rom.rs
index 11c2d452..a44dccd9 100644
--- a/src/rom.rs
+++ b/src/rom.rs
@@ -298,7 +298,8 @@ pub static MBC1: Mbc = Mbc {
     write_rom: |rom: &mut Cartridge, addr: u16, value: u8| {
         match addr & 0xf000 {
             0x0000 | 0x1000 => {
-                // @todo RAM enable
+                println!("RAM ENABLE {}", value);
+                //@todo RAM ENABLE
             }
             0x2000 | 0x3000 => {
                 // @todo this is slow and must be pre-computed in cartridge
@@ -308,7 +309,12 @@ pub static MBC1: Mbc = Mbc {
                 }
                 rom.set_rom_bank(rom_bank);
             }
-            0x6000 | 0x7000 => {}
+            0x4000 | 0x5000 => {
+                println!("SETTING UPPER BITS {}", value);
+            }
+            0x6000 | 0x7000 => {
+                println!("SETTING MODE {}", value);
+            }
             _ => panic!("Writing to unknown Cartridge ROM location 0x{:04x}", addr),
         }
     },
-- 
GitLab