Website Summary Files Commits Branches @commit @diff @stats
path: root / examples / example2.s
diff options
context:
space:
mode:
Commitc1c2a973906812ff31faf534c4bc384e895cadfe (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-03-20 17:08:15 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-03-20 17:08:15 +0200
Files54671148b989324071465ba2f3b4f1645fe294e0 /examples/example2.s
tonkobali-main.tar
tonkobali-main.tar.gz
tonkobali-main.zip
Parentbb8c3f02d7c3c318e67575167886de1da123b95a (diff)
feat: Demo video and accompanying example assembly HEAD main
1 files changed, 13 insertions, 0 deletions
-rw-r--r--examples/example2.s13
diff --git a/examples/example2.s b/examples/example2.s
new file mode 100644
index 0000000..b0213b5
--- /dev/null
+++ b/examples/example2.s
@@ -0,0 +1,13 @@
+; Variables allow "aliases" for arguments
+
+first = %1
+subleq first, %2, last
+last = %3
+
+; Higher-order instructions can also take in numeric constants
+; Constants are automatically stored at the start of memory,
+; and all references are replaced with that address
+
+num = 50
+add 60, num ; num += 60
+add num, 70 ; address_of(70) += num