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

feat: new instruction

parent 824655e7
No related branches found
No related tags found
No related merge requests found
...@@ -212,7 +212,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -212,7 +212,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(jp_u16, 16, "JP u16"), (jp_u16, 16, "JP u16"),
(call_nz_u16, 12, "CALL NZ, u16"), (call_nz_u16, 12, "CALL NZ, u16"),
(push_bc, 16, "PUSH BC"), (push_bc, 16, "PUSH BC"),
(noimpl, 4, "! UNIMP !"), (add_a_u8, 8, "ADD A, u8"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(ret, 16, "RET"), (ret, 16, "RET"),
...@@ -908,6 +908,11 @@ fn push_bc(cpu: &mut Cpu) { ...@@ -908,6 +908,11 @@ fn push_bc(cpu: &mut Cpu) {
cpu.push_word(cpu.bc()); 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) { fn ret(cpu: &mut Cpu) {
cpu.pc = cpu.pop_word(); cpu.pc = cpu.pop_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