From 46e5abbac9d8e4d9257e59cd0f8b73f509e4a512 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Nov 2023 22:55:41 +0000 Subject: Added instructions for MALLOC_STACK and SUB MALLOC_STACK is a stack based version of MALLOC, SUB does subtraction. --- lib/inst.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/inst.h') diff --git a/lib/inst.h b/lib/inst.h index 5671b47..10f8dc7 100644 --- a/lib/inst.h +++ b/lib/inst.h @@ -49,6 +49,10 @@ typedef enum OP_MALLOC_HWORD, OP_MALLOC_WORD, + OP_MALLOC_STACK_BYTE, + OP_MALLOC_STACK_HWORD, + OP_MALLOC_STACK_WORD, + OP_MSET_BYTE, OP_MSET_HWORD, OP_MSET_WORD, @@ -122,6 +126,10 @@ typedef enum OP_PLUS_HWORD, OP_PLUS_WORD, + OP_SUB_BYTE, + OP_SUB_HWORD, + OP_SUB_WORD, + OP_MULT_BYTE, OP_MULT_HWORD, OP_MULT_WORD, @@ -196,6 +204,7 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_MALLOC(TYPE, OP) \ ((inst_t){.opcode = OP_MALLOC_##TYPE, .operand = DWORD(OP)}) +#define INST_MALLOC_STACK(TYPE) ((inst_t){.opcode = OP_MALLOC_STACK_##TYPE}) #define INST_MSET(TYPE, OP) \ ((inst_t){.opcode = OP_MSET_##TYPE, .operand = DWORD(OP)}) #define INST_MSET_STACK(TYPE) ((inst_t){.opcode = OP_MSET_STACK_##TYPE}) @@ -215,6 +224,7 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_GT(TYPE) ((inst_t){.opcode = OP_GT_##TYPE}) #define INST_GTE(TYPE) ((inst_t){.opcode = OP_GTE_##TYPE}) #define INST_PLUS(TYPE) ((inst_t){.opcode = OP_PLUS_##TYPE}) +#define INST_SUB(TYPE) ((inst_t){.opcode = OP_SUB_##TYPE}) #define INST_MULT(TYPE) ((inst_t){.opcode = OP_MULT_##TYPE}) #define INST_JUMP_ABS(OP) \ -- cgit v1.2.3-13-gbd6f