aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-23 00:09:12 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-23 00:09:12 +0100
commitae9bc91713f86cfc16e801ca33654a47082ddb2b (patch)
tree99b3ff0d9e729feeb42689ca181a294199dc69af /src/inst.h
parent45ad8f7296722cc3cec0a6974f9d2519c9f36d4b (diff)
downloadovm-ae9bc91713f86cfc16e801ca33654a47082ddb2b.tar.gz
ovm-ae9bc91713f86cfc16e801ca33654a47082ddb2b.tar.bz2
ovm-ae9bc91713f86cfc16e801ca33654a47082ddb2b.zip
Added and implemented OP_PRINT*
Here is where we may have differing interpretations of what the bits in the data pile may actually mean. This in particular refers to printing the signed or unsigned versions of the bits given. Also, interpreting some byte as a character or just a raw number.
Diffstat (limited to 'src/inst.h')
-rw-r--r--src/inst.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/inst.h b/src/inst.h
index e10d744..b9e0e9b 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -70,6 +70,14 @@ typedef enum
OP_PLUS_HWORD,
OP_PLUS_WORD,
+ // Simple I/O
+ OP_PRINT_CHAR,
+ OP_PRINT_BYTE,
+ OP_PRINT_INT,
+ OP_PRINT_HWORD,
+ OP_PRINT_LONG,
+ OP_PRINT_WORD,
+
// Program control flow
OP_JUMP_ABS,
OP_JUMP_STACK,
@@ -127,12 +135,11 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
#define INST_DUP(TYPE, OP) \
((inst_t){.opcode = OP_DUP_##TYPE, .operand = DWORD(OP)})
-#define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE})
-#define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE})
-#define INST_AND(TYPE) ((inst_t){.opcode = OP_AND_##TYPE})
-#define INST_XOR(TYPE) ((inst_t){.opcode = OP_XOR_##TYPE})
-#define INST_EQ(TYPE) ((inst_t){.opcode = OP_EQ_##TYPE})
-
+#define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE})
+#define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE})
+#define INST_AND(TYPE) ((inst_t){.opcode = OP_AND_##TYPE})
+#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) \
@@ -140,4 +147,5 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
#define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK})
#define INST_JUMP_REGISTER ((inst_t){.opcode = OP_JUMP_REGISTER})
+#define INST_PRINT(TYPE) ((inst_t){.opcode = OP_PRINT_##TYPE})
#endif