summaryrefslogtreecommitdiff
path: root/arch/null/arch_inst.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/null/arch_inst.c')
-rw-r--r--arch/null/arch_inst.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/null/arch_inst.c b/arch/null/arch_inst.c
new file mode 100644
index 0000000..4744382
--- /dev/null
+++ b/arch/null/arch_inst.c
@@ -0,0 +1,48 @@
+// file : arch/null/arch_inst.c
+// project : Salis-VM
+// author : Paul Oliver <contact@pauloliver.dev>
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <wchar.h>
+
+#define ARCH_EXPORT_INST_COUNT
+#include "arch_spec.h"
+#include "arch_inst.h"
+
+wchar_t arch_inst_symbol(uint8_t inst) {
+ assert(inst < ARCH_INST_COUNT);
+
+ switch (inst) {
+ case 0:
+ return L'⢀';
+ case 1:
+ return L'⢁';
+ case 2:
+ return L'⢂';
+ case 3:
+ return L'⢃';
+ }
+
+ assert(false);
+ return L'\0';
+}
+
+const char *arch_inst_mnemonic(uint8_t inst) {
+ assert(inst < ARCH_INST_COUNT);
+
+ switch (inst) {
+ case 0:
+ return "null 0";
+ case 1:
+ return "null 1";
+ case 2:
+ return "null 2";
+ case 3:
+ return "null 3";
+ }
+
+ assert(false);
+ return NULL;
+}