From 96839ea91cc0b4b37ed9bfe323d3042074cb4c34 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 23:32:56 +0100 Subject: [PATCH] feat: new instruction --- src/inst.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/inst.rs b/src/inst.rs index 0aba58f9..9d9353e6 100644 --- a/src/inst.rs +++ b/src/inst.rs @@ -212,7 +212,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ (jp_u16, 16, "JP u16"), (call_nz_u16, 12, "CALL NZ, u16"), (push_bc, 16, "PUSH BC"), - (noimpl, 4, "! UNIMP !"), + (add_a_u8, 8, "ADD A, u8"), (noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"), (ret, 16, "RET"), @@ -908,6 +908,11 @@ fn push_bc(cpu: &mut Cpu) { cpu.push_word(cpu.bc()); } +fn add_a_u8(cpu: &mut Cpu) { + let byte = cpu.read_u8(); + cpu.a = add_set_flags(cpu, cpu.a, byte); +} + fn ret(cpu: &mut Cpu) { cpu.pc = cpu.pop_word(); } -- GitLab