diff --git a/src/inst.rs b/src/inst.rs index e3a4eda15b75e9f2fc44a3f08ed6f3e50c11c9e2..152ecd848b3f033ccc8543b70d120fefd783c636 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);