aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 20:40:42 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 20:54:04 +0100
commitfffad9aea3594c7de6ba918058c1e033c725a274 (patch)
treee52f626d31fde264cb578af854c84cf697d36f1c /src/inst.h
parentbc0e0fce252630110d6b0d18e55aac129b3d6d35 (diff)
downloadovm-fffad9aea3594c7de6ba918058c1e033c725a274.tar.gz
ovm-fffad9aea3594c7de6ba918058c1e033c725a274.tar.bz2
ovm-fffad9aea3594c7de6ba918058c1e033c725a274.zip
Added and implemented OP_JUMP_ABS
Jumps to the operand given, interpreted as a word, an absolute address.
Diffstat (limited to 'src/inst.h')
-rw-r--r--src/inst.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/inst.h b/src/inst.h
index 61d7ede..a9709fd 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -65,6 +65,10 @@ typedef enum
OP_EQ_HWORD,
OP_EQ_WORD,
+ // Mathematical operations
+ // Program control flow
+ OP_JUMP_ABS,
+
// Should not be an opcode
NUMBER_OF_OPCODES,
OP_HALT = 0b11111111, // top of the byte is a HALT
@@ -123,4 +127,7 @@ 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_JUMP_ABS(OP) \
+ ((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)})
+
#endif