summaryrefslogtreecommitdiff
path: root/test/fib2.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-04-17 22:07:14 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-04-17 22:07:14 -0400
commit0a7a2a7a8f95730811117bd2aa904f1843f65071 (patch)
tree24d62bbdba0df124c7fe8af781312af993236ebb /test/fib2.s
parentc5150ee31f07208422f1435de9b35a0d0168cbb5 (diff)
Made both the assembly language monitor, and the
emulator smaller, and faster. I am also starting to make SuBEditor's source code more readable.
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