Removed instruction OP_JUMP_REGISTER

Not necessary when you can just push the relevant word onto the stack
then just do OP_JUMP_STACK.
This commit is contained in:
2023-11-02 20:41:36 +00:00
parent 99b0ebdfa6
commit 114fb82990
5 changed files with 9 additions and 35 deletions

View File

@@ -60,7 +60,7 @@ const char *err_as_cstr(err_t err)
err_t vm_execute(vm_t *vm)
{
static_assert(NUMBER_OF_OPCODES == 96, "vm_execute: Out of date");
static_assert(NUMBER_OF_OPCODES == 95, "vm_execute: Out of date");
struct Program *prog = &vm->program;
if (prog->ptr >= prog->max)
return ERR_END_OF_PROGRAM;
@@ -133,13 +133,6 @@ err_t vm_execute(vm_t *vm)
return err;
return vm_jump(vm, ret.as_word);
}
else if (instruction.opcode == OP_JUMP_REGISTER)
{
if (instruction.operand.as_word >= vm->registers.available)
return ERR_INVALID_REGISTER_WORD;
word addr = vm->registers.data[instruction.operand.as_word];
return vm_jump(vm, addr);
}
else if (OPCODE_IS_TYPE(instruction.opcode, OP_JUMP_IF))
{
data_t datum = {0};