aboutsummaryrefslogtreecommitdiff
path: root/examples/constants.hdass
diff options
context:
space:
mode:
Diffstat (limited to 'examples/constants.hdass')
-rw-r--r--examples/constants.hdass15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/constants.hdass b/examples/constants.hdass
new file mode 100644
index 0000000..1bb85eb
--- /dev/null
+++ b/examples/constants.hdass
@@ -0,0 +1,15 @@
+[entry: main]
+
+// The exit status is folded from constant arithmetic, and SYS_EXIT is a hex
+// literal. STATUS = 6 * 7 = 42.
+const A = 6
+const B = 7
+const STATUS = A * B
+const SYS_EXIT = 0x3C
+
+proc main
+{
+ rdi = STATUS
+ rax = SYS_EXIT
+ syscall
+}