opcode: JMP
This commit is contained in:
parent
4ee0822e58
commit
159ab62ebf
@ -85,7 +85,7 @@ pub fn execute_instruction(vm: &mut VM, instr: u16) {
|
||||
OpCode::NOT => op_not(vm, instr),
|
||||
OpCode::LDI => op_ldi(vm, instr),
|
||||
OpCode::STI => op_sti(vm, instr),
|
||||
OpCode::JMP => todo!("JMP"),
|
||||
OpCode::JMP => op_jmp(vm, instr),
|
||||
OpCode::RES => todo!("RES"),
|
||||
OpCode::LEA => op_lea(vm, instr),
|
||||
OpCode::TRAP => op_trap(vm, instr),
|
||||
@ -169,6 +169,13 @@ fn op_br(vm: &mut VM, instr: u16) {
|
||||
}
|
||||
}
|
||||
|
||||
fn op_jmp(vm: &mut VM, instr: u16) {
|
||||
// RET is a special case of this where BaseR is R7
|
||||
let base_r = (instr >> 6) & 0b111;
|
||||
|
||||
vm.registers.pc = vm.registers.get_reg(base_r);
|
||||
}
|
||||
|
||||
////////////////
|
||||
// Store ops
|
||||
////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user