diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-23 01:45:54 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-23 01:45:54 +0100 |
commit | 9496da9d93234ea0e48e54bd6760bf3118063826 (patch) | |
tree | 5d609b503bac938a35ef70d6416b2753be0d2d68 /src/inst.h | |
parent | b93a4af4952906e544f35805720c6b547f1f062e (diff) | |
download | ovm-9496da9d93234ea0e48e54bd6760bf3118063826.tar.gz ovm-9496da9d93234ea0e48e54bd6760bf3118063826.tar.bz2 ovm-9496da9d93234ea0e48e54bd6760bf3118063826.zip |
Added and implemented OP_JUMP_IF_*
Performs a jump when the (BYTE|HWORD|WORD) at the top of the stack is
non zero.
Diffstat (limited to 'src/inst.h')
-rw-r--r-- | src/inst.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |