aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
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 e5c6146..2748c7f 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -13,6 +13,7 @@
#ifndef INST_H
#define INST_H
+#include <stdio.h>
#include <stdlib.h>
#include "./base.h"
@@ -42,6 +43,8 @@ typedef enum
OP_HALT = 0b10000000, // top of the byte is a HALT
} opcode_t;
+const char *opcode_as_cstr(opcode_t);
+
// Masks and values to check if an opcode is of a type
typedef enum
{
@@ -52,6 +55,8 @@ typedef enum
OP_TYPE_HALT = 0b10000000,
} opcode_type_t;
+const char *opcode_type_as_cstr(opcode_type_t);
+
#define OPCODE_IS_TYPE(OPCODE, OP_TYPE) (((OPCODE) & (OP_TYPE)) == (OP_TYPE))
typedef struct
@@ -60,6 +65,8 @@ typedef struct
data_t operand;
} inst_t;
+void inst_print(inst_t, FILE *);
+
size_t inst_bytecode_size(inst_t);
void inst_write_bytecode(inst_t, darr_t *);
// Here the dynamic array is a preloaded buffer of bytes, where