aboutsummaryrefslogtreecommitdiff
path: root/lib/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 18:08:11 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 18:08:11 +0000
commit4be04d2518fc342300685fa11d514beb7e06022b (patch)
tree767526ce39fae75685d3388d506f8a1e3e26eb5c /lib/inst.h
parentc244e7c4a4d8a069d5ebae523880aa4356b0ff07 (diff)
downloadovm-4be04d2518fc342300685fa11d514beb7e06022b.tar.gz
ovm-4be04d2518fc342300685fa11d514beb7e06022b.tar.bz2
ovm-4be04d2518fc342300685fa11d514beb7e06022b.zip
Introduced a new mathematical operator MULT
Thankfully multiplication, like addition, is the same under 2s complement as it is for unsigned numbers. So I just need to implement those versions to be fine.
Diffstat (limited to 'lib/inst.h')
-rw-r--r--lib/inst.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/inst.h b/lib/inst.h
index ff1709e..e36d1c3 100644
--- a/lib/inst.h
+++ b/lib/inst.h
@@ -98,6 +98,10 @@ typedef enum
OP_PLUS_HWORD,
OP_PLUS_WORD,
+ OP_MULT_BYTE,
+ OP_MULT_HWORD,
+ OP_MULT_WORD,
+
// Simple I/O
OP_PRINT_BYTE,
OP_PRINT_CHAR,
@@ -176,6 +180,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_MULT(TYPE) ((inst_t){.opcode = OP_MULT_##TYPE})
#define INST_JUMP_ABS(OP) \
((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)})