summaryrefslogtreecommitdiff
path: root/test/fib2.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-01-10 16:35:34 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-01-10 16:35:34 -0500
commit861d56e556b597115ad01b4b4cc0e5b932545ce9 (patch)
treed24d9718da054658a833b932595819c030065d1a /test/fib2.s
parent1dfc78b8bf5b708cb1118a9d6646397772a1b894 (diff)
Added GPLv2.
We're now Free Software!!!
Diffstat (limited to 'test/fib2.s')
-rw-r--r--test/fib2.s26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/fib2.s b/test/fib2.s
new file mode 100644
index 0000000..d8c0d42
--- /dev/null
+++ b/test/fib2.s
@@ -0,0 +1,26 @@
+; Variables for thread 0.
+.org $1000
+x:
+ .qword $0
+y:
+ .qword $1
+z:
+ .qword $0
+
+.org $0
+init:
+ cps ; Clear the Processor Status register.
+
+start:
+ lda #0 ; Clear the accumulator.
+ ldb.q y ; b=1.
+fib:
+ aab ; Add x with y.
+ ldb.q y
+ stb.q x ; x=y.
+ sta.q y ; y=z.
+ tab
+ lda.q x
+ bcs start ; Start all over again, if the carry flag was set.
+ jmp fib ; Otherwise, keep looping.
+done