summaryrefslogtreecommitdiff
path: root/test/fib2.s
blob: 59830a246fc8474301920a677a6a49acb07f0de8 (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
27
28
29
30
31
32
33
; Variables for thread 0.
.org $1000
x:
	.qword 0
y:
	.qword 1
z:
	.qword 0
zero:
	.qword 0

.org 0
init:
	cps		; Clear the Processor Status register.
start:
	lsr #63		; Reset the accumulator.
	tab		;
	tax		;
	tay		;
	inb		;
	clc		;
fib:
	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