Website Summary Files Commits Branches @commit @diff @stats
path: root / examples
diff options
context:
space:
mode:
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