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

feat: new ret instruction

parent ce49dbd2
No related branches found
No related tags found
No related merge requests found
Pipeline #863 passed
...@@ -231,7 +231,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -231,7 +231,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(push_de, 16, "PUSH DE"), (push_de, 16, "PUSH DE"),
(sub_a_u8, 8, "SUB A, u8"), (sub_a_u8, 8, "SUB A, u8"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"), (ret_c, 8, "RET C"),
(reti, 16, "RETI"), (reti, 16, "RETI"),
(jp_c_u16, 12, "JP C, u16"), (jp_c_u16, 12, "JP C, u16"),
(illegal, 4, "ILLEGAL"), (illegal, 4, "ILLEGAL"),
...@@ -1450,6 +1450,15 @@ fn sub_a_u8(cpu: &mut Cpu) { ...@@ -1450,6 +1450,15 @@ fn sub_a_u8(cpu: &mut Cpu) {
cpu.a = sub_set_flags(cpu, cpu.a, byte); cpu.a = sub_set_flags(cpu, cpu.a, byte);
} }
fn ret_c(cpu: &mut Cpu) {
if !cpu.get_carry() {
return;
}
cpu.pc = cpu.pop_word();
cpu.ticks = cpu.ticks.wrapping_add(12);
}
fn reti(cpu: &mut Cpu) { fn reti(cpu: &mut Cpu) {
cpu.pc = cpu.pop_word(); cpu.pc = cpu.pop_word();
cpu.enable_int(); cpu.enable_int();
......
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