summaryrefslogtreecommitdiff
path: root/test/fib-new.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/fib-new.s')
-rw-r--r--test/fib-new.s45
1 files changed, 22 insertions, 23 deletions
diff --git a/test/fib-new.s b/test/fib-new.s
index 5a8ae83..6b0b717 100644
--- a/test/fib-new.s
+++ b/test/fib-new.s
@@ -5,21 +5,21 @@
; by mr b0nk 500 <b0nk@b0nk.xyz>
; Variables for thread 0.
-.org $0
-x:
- .byte $0
-y:
- .byte $0
-z:
- .byte $0
+.org 0
+x1:
+ .res 1
+y1:
+ .res 1
+z1:
+ .res 1
; Variables for thread 1.
x2:
- .byte $0
+ .res 1
y2:
- .byte $0
+ .res 1
z2:
- .byte $0
+ .res 1
.org $1000
init:
@@ -27,21 +27,21 @@ init:
start:
lda #$0 ; Clear the accumulator.
ldy #$1 ; y=1.
- sty y ; Store y into memory.
+ sty y1 ; Store y into memory.
fib:
ldx #$0 ; x=0.
- ldx x ; Output the value of x.
- adc y ; Add x with y.
- sta z ; z=x+y
- ldy y
- sty x ; x=y.
- sta y ; y=z.
- lda x
+ ldx x1 ; Output the value of x.
+ adc y1 ; Add x with y.
+ sta z1 ; z=x+y
+ ldy y1
+ sty x1 ; x=y.
+ sta y1 ; y=z.
+ lda x1
bcs start ; Start all over again, if the carry flag was set.
- jmp fib ; Otherwise, keep looping.
+ bra fib ; Otherwise, keep looping.
+
-.org $2000
init2:
cps ; Clear the Processor Status register.
start2:
@@ -59,7 +59,7 @@ fib2:
sta y2 ; y2=z2.
lda x2
bcs start2 ; Start all over again, if the carry flag was set.
- jmp fib2 ; Otherwise, keep looping.
+ bra fib2 ; Otherwise, keep looping.
.org $FFC0
.qword init
@@ -68,5 +68,4 @@ fib2:
.qword init2
; Execute the program.
a
-done
-
+d