summaryrefslogtreecommitdiff
path: root/core/arch_inst.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/arch_inst.h')
-rw-r--r--core/arch_inst.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/arch_inst.h b/core/arch_inst.h
new file mode 100644
index 0000000..2f7c7af
--- /dev/null
+++ b/core/arch_inst.h
@@ -0,0 +1,24 @@
+// file : core/arch_inst.h
+// project : Salis-VM
+// author : Paul Oliver <contact@pauloliver.dev>
+
+#pragma once
+
+#define ARCH_INST_COUNT (1 << ARCH_SPEC_INST_BITS)
+#define ARCH_INST_IPCM_FLAG 0x80
+#define ARCH_INST_MALL_FLAG 0x80
+#define ARCH_INST_MASK (ARCH_INST_COUNT - 1)
+#define ARCH_INST_UNUSED_BITS (~(ARCH_INST_MALL_FLAG | ARCH_INST_MASK))
+
+int arch_inst_count(void);
+wchar_t arch_inst_symbol(uint8_t inst);
+const char *arch_inst_mnemonic(uint8_t inst);
+
+// ARCH_EXPORT_INST_COUNT must be defined in arch_inst.c source files.
+// This allows Python to read back the number of instructions for the selected
+// VM architecture.
+#if defined(ARCH_EXPORT_INST_COUNT)
+int arch_inst_count(void) {
+ return ARCH_INST_COUNT;
+}
+#endif