From d434b2d89a8bea8287097aedc9b7b02265043762 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 3 Jul 2022 06:12:13 +0100
Subject: [PATCH] fix: jump issue

---
 src/cpu.rs  | 3 ++-
 src/inst.rs | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/cpu.rs b/src/cpu.rs
index de5346c7..9d75c9ae 100644
--- a/src/cpu.rs
+++ b/src/cpu.rs
@@ -96,7 +96,8 @@ impl Cpu {
 
         let (instruction_fn, instruction_time, instruction_str) = instruction;
 
-        if !self.mmu.boot_active() || *instruction_str == "! UNIMP !" {
+        // if !self.mmu.boot_active() {
+        if *instruction_str == "! UNIMP !" {
             println!(
                 "{}\t(0x{:02x})\t${:04x} {}",
                 instruction_str, opcode, pc, is_prefix
diff --git a/src/inst.rs b/src/inst.rs
index f068575e..e3a4eda1 100644
--- a/src/inst.rs
+++ b/src/inst.rs
@@ -852,7 +852,7 @@ fn ld_sp_u16(cpu: &mut Cpu) {
 }
 
 fn jr_nc_i8(cpu: &mut Cpu) {
-    let byte = cpu.read_u8();
+    let byte = cpu.read_u8() as i8;
 
     if cpu.get_carry() {
         return;
@@ -879,7 +879,7 @@ fn scf(cpu: &mut Cpu) {
 }
 
 fn jr_c_i8(cpu: &mut Cpu) {
-    let byte = cpu.read_u8();
+    let byte = cpu.read_u8() as i8;
 
     if !cpu.get_carry() {
         return;
-- 
GitLab