From 1d44d53aae5b62f414c8dc930673157be78760f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sat, 2 Jul 2022 16:30:02 +0100
Subject: [PATCH] feat: more instructions

---
 src/inst.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/inst.rs b/src/inst.rs
index 4567f108..db94b51c 100644
--- a/src/inst.rs
+++ b/src/inst.rs
@@ -221,7 +221,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
     (noimpl, 4, "! UNIMP !"),
     (call_u16, 24, "CALL u16"),
     (noimpl, 4, "! UNIMP !"),
-    (noimpl, 4, "! UNIMP !"),
+    (rst_08h, 16, "RST 08h"),
     // 0xd opcodes
     (noimpl, 4, "! UNIMP !"),
     (noimpl, 4, "! UNIMP !"),
@@ -262,7 +262,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
     (noimpl, 4, "! UNIMP !"),
     (di, 4, "DI"),
     (noimpl, 4, "! UNIMP !"),
-    (noimpl, 4, "! UNIMP !"),
+    (push_af, 16, "PUSH AF"),
     (noimpl, 4, "! UNIMP !"),
     (noimpl, 4, "! UNIMP !"),
     (noimpl, 4, "! UNIMP !"),
@@ -884,6 +884,10 @@ fn call_u16(cpu: &mut Cpu) {
     cpu.pc = word;
 }
 
+fn rst_08h(cpu: &mut Cpu) {
+    rst(cpu, 0x0008);
+}
+
 fn ld_mff00u8_a(cpu: &mut Cpu) {
     let byte = cpu.read_u8();
     cpu.mmu.write(0xff00 + byte as u16, cpu.a);
@@ -922,6 +926,10 @@ fn di(cpu: &mut Cpu) {
     cpu.disable_int();
 }
 
+fn push_af(cpu: &mut Cpu) {
+    cpu.push_word(cpu.af());
+}
+
 fn ei(cpu: &mut Cpu) {
     cpu.enable_int();
 }
-- 
GitLab