From 5b7dc2d65f62916b04906fb7682a44004367722c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Tue, 28 Jun 2022 20:56:20 +0100
Subject: [PATCH] feat: call prototype

---
 src/cpu.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/cpu.rs b/src/cpu.rs
index 439b3783..ab674168 100644
--- a/src/cpu.rs
+++ b/src/cpu.rs
@@ -221,7 +221,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
     (nop, 4, "NOP"),
     (nop, 4, "NOP"),
     (nop, 4, "NOP"),
-    (nop, 4, "NOP"),
+    (call_u16, 24, "CALL u16"),
     (nop, 4, "NOP"),
     (nop, 4, "NOP"),
     // 0xd opcodes
@@ -780,6 +780,12 @@ fn xor_a_a(cpu: &mut Cpu) {
     cpu.set_carry(false);
 }
 
+fn call_u16(cpu: &mut Cpu) {
+    // @todo push stack and set the current PC
+    // to be able to jump
+    cpu.sp += 1;
+}
+
 fn ld_mff00u8_a(cpu: &mut Cpu) {
     let byte = cpu.read_u8();
     cpu.mmu.write(0xff0c + byte as u16, cpu.a);
-- 
GitLab