summaryrefslogtreecommitdiff
path: root/core/arch_inst.h
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-07-14 17:29:02 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-08-30 16:24:48 +0200
commit1961b4b237083f4cfac9ca6b249c1d6cb665d149 (patch)
treefd9fc8260360e2ac30be9747ca558bcfc824a4c4 /core/arch_inst.h
Initial (refactor)HEADmaster
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