From 1962aabdf5d5aa69e52afdeead360ccb4c0c9a49 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 22 Oct 2023 22:00:44 +0100 Subject: Added OP_PLUS_* Takes two operands from the stack then pushes their sum. --- src/inst.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/inst.h') diff --git a/src/inst.h b/src/inst.h index 487a41b..e10d744 100644 --- a/src/inst.h +++ b/src/inst.h @@ -28,14 +28,14 @@ typedef enum OP_PUSH_HWORD, OP_PUSH_WORD, - OP_PUSH_REGISTER_BYTE, - OP_PUSH_REGISTER_HWORD, - OP_PUSH_REGISTER_WORD, - OP_POP_BYTE, OP_POP_HWORD, OP_POP_WORD, + OP_PUSH_REGISTER_BYTE, + OP_PUSH_REGISTER_HWORD, + OP_PUSH_REGISTER_WORD, + OP_MOV_BYTE, OP_MOV_HWORD, OP_MOV_WORD, @@ -66,6 +66,10 @@ typedef enum OP_EQ_WORD, // Mathematical operations + OP_PLUS_BYTE, + OP_PLUS_HWORD, + OP_PLUS_WORD, + // Program control flow OP_JUMP_ABS, OP_JUMP_STACK, @@ -129,6 +133,8 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_XOR(TYPE) ((inst_t){.opcode = OP_XOR_##TYPE}) #define INST_EQ(TYPE) ((inst_t){.opcode = OP_EQ_##TYPE}) +#define INST_PLUS(TYPE) ((inst_t){.opcode = OP_PLUS_##TYPE}) + #define INST_JUMP_ABS(OP) \ ((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)}) #define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK}) -- cgit v1.2.3-13-gbd6f