aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/load.hdass17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/load.hdass b/examples/load.hdass
new file mode 100644
index 0000000..6e68ffc
--- /dev/null
+++ b/examples/load.hdass
@@ -0,0 +1,17 @@
+[entry: main]
+
+// Stores 7 into a stack cell, loads it back through a pointer, and exits with it.
+const SYS_EXIT = 60
+
+proc main
+{
+ stack cell[8]
+
+ rbx = 7
+ rsi = cell // address of the cell
+ ^rsi = rbx // store
+ rdi = ^rsi // load it back
+
+ rax = SYS_EXIT
+ syscall
+}