From 597a45aa73d4d66fce4dd9135087e0e82f46899c Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 29 Oct 2023 16:58:18 +0000 Subject: Fixed bug where JUMP_REGISTER couldn't be in bytecode read --- vm/inst.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'vm/inst.c') diff --git a/vm/inst.c b/vm/inst.c index d553d57..1c245fa 100644 --- a/vm/inst.c +++ b/vm/inst.c @@ -323,14 +323,13 @@ inst_t inst_read_bytecode(darr_t *darr) inst_t inst = {0}; opcode_t opcode = darr->data[darr->used++]; if (opcode > OP_HALT || opcode == NUMBER_OF_OPCODES || opcode < OP_NOOP) - // Translate to NOOP - return inst; + return INST_NOOP; // Read operands if (OPCODE_IS_TYPE(opcode, OP_PUSH)) inst.operand = read_type_from_darr(darr, (data_type_t)opcode); // Read register (as a byte) else if (OPCODE_IS_TYPE(opcode, OP_PUSH_REGISTER) || - OPCODE_IS_TYPE(opcode, OP_MOV) || inst.opcode == OP_JUMP_STACK) + OPCODE_IS_TYPE(opcode, OP_MOV) || opcode == OP_JUMP_REGISTER) inst.operand = read_type_from_darr(darr, DATA_TYPE_BYTE); else if (OPCODE_IS_TYPE(opcode, OP_DUP) || opcode == OP_JUMP_ABS || OPCODE_IS_TYPE(opcode, OP_JUMP_IF)) -- cgit v1.2.3-13-gbd6f