Skip to content
Snippets Groups Projects
Verified Commit b8cb5301 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new instruction

parent d434b2d8
No related branches found
No related tags found
No related merge requests found
Pipeline #848 passed
...@@ -223,7 +223,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -223,7 +223,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(rst_08h, 16, "RST 08h"), (rst_08h, 16, "RST 08h"),
// 0xd opcodes // 0xd opcodes
(noimpl, 4, "! UNIMP !"), (ret_nc, 8, "RET NC"),
(pop_de, 12, "POP DE"), (pop_de, 12, "POP DE"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
...@@ -1180,6 +1180,15 @@ fn rst_08h(cpu: &mut Cpu) { ...@@ -1180,6 +1180,15 @@ fn rst_08h(cpu: &mut Cpu) {
rst(cpu, 0x0008); 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) { fn pop_de(cpu: &mut Cpu) {
let word = cpu.pop_word(); let word = cpu.pop_word();
cpu.set_de(word); cpu.set_de(word);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment