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

feat: new jump instruction

parent e6b9eb04
No related branches found
No related tags found
No related merge requests found
...@@ -209,7 +209,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -209,7 +209,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(ret_nz, 8, "RET NZ"), (ret_nz, 8, "RET NZ"),
(pop_bc, 12, "POP BC"), (pop_bc, 12, "POP BC"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"), (jp_u16, 16, "JP u16"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
(push_bc, 16, "PUSH BC"), (push_bc, 16, "PUSH BC"),
(noimpl, 4, "! UNIMP !"), (noimpl, 4, "! UNIMP !"),
...@@ -770,6 +770,11 @@ fn pop_bc(cpu: &mut Cpu) { ...@@ -770,6 +770,11 @@ fn pop_bc(cpu: &mut Cpu) {
cpu.set_bc(word); cpu.set_bc(word);
} }
fn jp_u16(cpu: &mut Cpu) {
let word = cpu.read_u16();
cpu.pc = word;
}
fn push_bc(cpu: &mut Cpu) { fn push_bc(cpu: &mut Cpu) {
cpu.push_word(cpu.bc()); cpu.push_word(cpu.bc());
} }
......
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