aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.zc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.zc')
-rw-r--r--src/core/core.zc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/core.zc b/src/core/core.zc
new file mode 100644
index 0000000..61ecd1c
--- /dev/null
+++ b/src/core/core.zc
@@ -0,0 +1,19 @@
+namespace core;
+include rt;
+
+// calls the host gate with an operation and three machine-word arguments.
+// returns the host result; negative values indicate a failed operation.
+int syscall(int operation, word a, word b, word c) {
+ return rt.syscall(operation, a, b, c);
+}
+
+// the current operand-stack pointer, expressed as a word address.
+word dsp() { return rt.dsp(); }
+// converts a vm word address to its byte address.
+word addr_b(word address) { return rt.addr_b(address); }
+// loads one unsigned byte from a byte address.
+int ld8(word address) { return rt.ld8(address); }
+// stores the low byte of value at a byte address.
+int st8(word address, int value) { return rt.st8(address, value); }
+// stops execution of the current vm program.
+int halt() { return rt.halt(); }