summaryrefslogtreecommitdiff
path: root/test/fib2.s
blob: d8c0d42016c88b61a828105bcc5f0a2ab650e572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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