From d9a13a1f51dc4019dd0ce8ef88067aaf0bb83b68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 10 Jul 2022 16:42:36 +0100
Subject: [PATCH] feat: better warnings

---
 src/timer.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/timer.rs b/src/timer.rs
index c2f5883a..403805c2 100644
--- a/src/timer.rs
+++ b/src/timer.rs
@@ -1,3 +1,5 @@
+use crate::warnln;
+
 pub struct Timer {
     div: u8,
     tima: u8,
@@ -52,7 +54,10 @@ impl Timer {
             0x05 => self.tima,
             0x06 => self.tma,
             0x07 => self.tac,
-            addr => panic!("Reding from unknown Timer location 0x{:04x}", addr),
+            _ => {
+                warnln!("Reding from unknown Timer location 0x{:04x}", addr);
+                0xff
+            }
         }
     }
 
@@ -72,7 +77,7 @@ impl Timer {
                 }
                 self.tima_enabled = value & 0x04 == 0x04;
             }
-            addr => panic!("Writing to unknown Timer location 0x{:04x}", addr),
+            _ => panic!("Writing to unknown Timer location 0x{:04x}", addr),
         }
     }
 
-- 
GitLab