From b8cb5301fd61b2c9d7fc717377a2b4b9c835a876 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:14:50 +0100 Subject: [PATCH] feat: new instruction --- src/inst.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/inst.rs b/src/inst.rs index e3a4eda1..152ecd84 100644 --- a/src/inst.rs +++ b/src/inst.rs @@ -223,7 +223,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ (noimpl, 4, "! UNIMP !"), (rst_08h, 16, "RST 08h"), // 0xd opcodes - (noimpl, 4, "! UNIMP !"), + (ret_nc, 8, "RET NC"), (pop_de, 12, "POP DE"), (noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"), @@ -1180,6 +1180,15 @@ fn rst_08h(cpu: &mut Cpu) { rst(cpu, 0x0008); } +fn ret_nc(cpu: &mut Cpu) { + if cpu.get_carry() { + return; + } + + cpu.pc = cpu.pop_word(); + cpu.ticks = cpu.ticks.wrapping_add(12); +} + fn pop_de(cpu: &mut Cpu) { let word = cpu.pop_word(); cpu.set_de(word); -- GitLab