summaryrefslogtreecommitdiff
path: root/src/vm/core.js
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-05-23 14:53:53 -0500
committersanine-a <sanine.not@pm.me>2023-05-23 14:53:53 -0500
commit15323007750e0f0f7c36a6a6fa01ad1d303a4a16 (patch)
tree70835b4364299274dc0145af5cd41c5af05ae53b /src/vm/core.js
parent29ed5eacb80cdfe49bff0d9335241dc3e2188981 (diff)
implement basic vm runner
Diffstat (limited to 'src/vm/core.js')
-rw-r--r--src/vm/core.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/core.js b/src/vm/core.js
index a8fbce7..6363a60 100644
--- a/src/vm/core.js
+++ b/src/vm/core.js
@@ -133,6 +133,21 @@ class Core {
const index = this.getLocation(pc, address);
return this.data[index];
}
+
+
+ pretty(ins) {
+ const prettyMode = {
+ 'immediate': '#',
+ 'direct': ' ',
+ 'indirect': '@',
+ 'predecrement': '<',
+ };
+
+ return `\
+${ins.opcode} \
+${prettyMode[ins.a.mode]}${ins.a.value}, \
+${prettyMode[ins.b.mode]}${ins.b.value}`;
+ }
}