From 0649b3f3804fa1b8924eed9214f33bce6a2c06e8 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Nov 2023 22:07:08 +0000 Subject: Added stack based versions of MSET and MGET Essentially they use the stack for their one and only operand. This allows user level control, in particular it allows for loops to work correctly while using these operands. --- lib/inst.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/inst.h') diff --git a/lib/inst.h b/lib/inst.h index 21fc6a1..5671b47 100644 --- a/lib/inst.h +++ b/lib/inst.h @@ -48,12 +48,23 @@ typedef enum OP_MALLOC_BYTE, OP_MALLOC_HWORD, OP_MALLOC_WORD, + OP_MSET_BYTE, OP_MSET_HWORD, OP_MSET_WORD, + + OP_MSET_STACK_BYTE, + OP_MSET_STACK_HWORD, + OP_MSET_STACK_WORD, + OP_MGET_BYTE, OP_MGET_HWORD, OP_MGET_WORD, + + OP_MGET_STACK_BYTE, + OP_MGET_STACK_HWORD, + OP_MGET_STACK_WORD, + OP_MDELETE, OP_MSIZE, @@ -187,10 +198,12 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); ((inst_t){.opcode = OP_MALLOC_##TYPE, .operand = DWORD(OP)}) #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}) #define INST_MGET(TYPE, OP) \ ((inst_t){.opcode = OP_MGET_##TYPE, .operand = DWORD(OP)}) -#define INST_MDELETE ((inst_t){.opcode = OP_MDELETE}) -#define INST_MSIZE ((inst_t){.opcode = OP_MSIZE}) +#define INST_MGET_STACK(TYPE) ((inst_t){.opcode = OP_MGET_STACK_##TYPE}) +#define INST_MDELETE ((inst_t){.opcode = OP_MDELETE}) +#define INST_MSIZE ((inst_t){.opcode = OP_MSIZE}) #define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE}) #define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE}) -- cgit v1.2.3-13-gbd6f