From 9496da9d93234ea0e48e54bd6760bf3118063826 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 23 Oct 2023 01:45:54 +0100 Subject: Added and implemented OP_JUMP_IF_* Performs a jump when the (BYTE|HWORD|WORD) at the top of the stack is non zero. --- src/inst.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/inst.h') diff --git a/src/inst.h b/src/inst.h index b9e0e9b..8902757 100644 --- a/src/inst.h +++ b/src/inst.h @@ -82,6 +82,9 @@ typedef enum OP_JUMP_ABS, OP_JUMP_STACK, OP_JUMP_REGISTER, + OP_JUMP_IF_BYTE, + OP_JUMP_IF_HWORD, + OP_JUMP_IF_WORD, // Should not be an opcode NUMBER_OF_OPCODES, @@ -146,6 +149,8 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); ((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)}) #define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK}) #define INST_JUMP_REGISTER ((inst_t){.opcode = OP_JUMP_REGISTER}) +#define INST_JUMP_IF(TYPE, OP) \ + ((inst_t){.opcode = OP_JUMP_IF_##TYPE, .operand = DWORD(OP)}) #define INST_PRINT(TYPE) ((inst_t){.opcode = OP_PRINT_##TYPE}) #endif -- cgit v1.2.3-13-gbd6f