aboutsummaryrefslogtreecommitdiff
path: root/examples/greet.hdass
diff options
context:
space:
mode:
Diffstat (limited to 'examples/greet.hdass')
-rw-r--r--examples/greet.hdass20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/greet.hdass b/examples/greet.hdass
new file mode 100644
index 0000000..a253b5e
--- /dev/null
+++ b/examples/greet.hdass
@@ -0,0 +1,20 @@
+// Writes a fixed string to stdout, then exits cleanly.
+const SYS_WRITE = 1
+const SYS_EXIT = 60
+
+const STDOUT = 1
+
+data greeting = "hdass works!\n"
+
+proc main
+{
+ rax = SYS_WRITE
+ rdi = STDOUT
+ rsi = greeting
+ rdx = greeting.len
+ syscall
+
+ rax = SYS_EXIT
+ rdi = 0
+ syscall
+}