summaryrefslogtreecommitdiff
path: root/test/fib2.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/fib2.s')
-rw-r--r--test/fib2.s37
1 files changed, 22 insertions, 15 deletions
diff --git a/test/fib2.s b/test/fib2.s
index d8c0d42..59830a2 100644
--- a/test/fib2.s
+++ b/test/fib2.s
@@ -1,26 +1,33 @@
; Variables for thread 0.
.org $1000
x:
- .qword $0
+ .qword 0
y:
- .qword $1
+ .qword 1
z:
- .qword $0
+ .qword 0
+zero:
+ .qword 0
-.org $0
+.org 0
init:
cps ; Clear the Processor Status register.
-
start:
- lda #0 ; Clear the accumulator.
- ldb.q y ; b=1.
+ lsr #63 ; Reset the accumulator.
+ tab ;
+ tax ;
+ tay ;
+ inb ;
+ clc ;
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.
+ tya ;
+ aab ; Add x with y. But did we also carry over?
+ bcs start ; Yes, so restart.
+ tax ;
+ tya ;
+ tab ;
+ txa ;
+ tay ;
+ jmp fib ; No, so keep looping.
+a
done