lab17: part 4

This commit is contained in:
2026-04-23 00:31:22 -07:00
parent b7285c39d6
commit c11daa808f
2 changed files with 20 additions and 6 deletions

View File

@@ -18,6 +18,15 @@ let opcodes = {
let v2 = vm.stack.pop();
vm.stack.push(v1-v2);
}},
0x52: { mnemonic: 'MLOAD', evaluate: (vm) => {
let offset = vm.stack.pop();
vm.stack.push(vm.memory[offset]);
}},
0x53: { mnemonic: 'MSTORE', evaluate: (vm) => {
let offset = vm.stack.pop();
let value = vm.stack.pop();
vm.memory[offset] = value;
}},
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