Website Summary Files Commits Branches @commit @diff @stats
path: root / examples
diff options
context:
space:
mode:
Commitfcb65b6f059a8ec3d1c485a2c8d0be841e4b99fa (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-02-15 00:27:25 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-02-15 00:27:25 +0200
Filesa899f073a43d2e91262bed0f79dbb029b137dfd9 /examples
tonkobali-fcb65b6f059a8ec3d1c485a2c8d0be841e4b99fa.tar
tonkobali-fcb65b6f059a8ec3d1c485a2c8d0be841e4b99fa.tar.gz
tonkobali-fcb65b6f059a8ec3d1c485a2c8d0be841e4b99fa.zip
Parent4b5ed8fb063f08ce399371e48c59665e59ceea47 (diff)
feat(examples): Add subroutines program
1 files changed, 21 insertions, 0 deletions
-rw-r--r--examples/subroutines.s21
diff --git a/examples/subroutines.s b/examples/subroutines.s
new file mode 100644
index 0000000..d1bd191
--- /dev/null
+++ b/examples/subroutines.s
@@ -0,0 +1,21 @@
+jmp main
+
+x = 0
+y = 0
+sum2:
+ add x, y
+ add y, y
+ rts
+
+a = 15
+b = 20
+main:
+ mov a, x
+ mov b, y
+ jsr sum2 ; sum2(a, b)
+
+ mov y, x
+ mov b, y
+ jsr sum2 ; sum2(sum2(a, b), b)
+
+ mov y, %1000