lab17: part 5
This commit is contained in:
@@ -27,6 +27,17 @@ let opcodes = {
|
||||
let value = vm.stack.pop();
|
||||
vm.memory[offset] = value;
|
||||
}},
|
||||
0x56: { mnemonic: 'JUMP', evaluate: (vm) => {
|
||||
let offset = vm.stack.pop();
|
||||
vm.pc = offset;
|
||||
}},
|
||||
0x57: { mnemonic: 'JUMPI', evaluate: (vm) => {
|
||||
let offset = vm.stack.pop();
|
||||
let condition = vm.stack.pop();
|
||||
if (condition) {
|
||||
vm.pc = offset;
|
||||
}
|
||||
}},
|
||||
0x5B: { mnemonic: 'JUMPDEST', evaluate: (vm) => {
|
||||
// Does nothing. We could check to make sure that jumps
|
||||
// always land at JUMPDEST opcodes, but it is not totally
|
||||
|
||||
Reference in New Issue
Block a user