summaryrefslogtreecommitdiff
path: root/test/subroutine.s
blob: 65e46ca6be59837c7b430881201f9e27b4a3bd1a (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.org $2000
buf:

.org $0
ptr:
.qword $0
ptr2:
.qword $0

.org $8000
reset:
	cps
	ldx.w #$FFFF
	txs
start:
	ldy #0
	ldb #0
	tyx
	lda.w #buf
	sta.q ptr
	adc #8
	sta.q ptr2
	;inb
	;stb $C010
	;deb
bench:
	jsl clr_buf
	jmp bench

clr_buf:
	tba		; Reset the Accumulator.
	cpy.w #$1FFF	; Did we clear all of the screen buffer?
	bcs clr_buf_end	; Yes, so we're done.
	sta.q (ptr), y	; No, so clear eight bytes.
	sta.q (ptr2), y	; Clear eight more bytes.
	tya		; Copy the buffer index.
	adc #$10	; Increment the index by 16.
	tay		; Update the index.
	jmp clr_buf	; Keep looping.
clr_buf_end:
	tay		; Set the index back to zero.
	rtl		; End of clr_buf.

;.org $C010
;.byte $1
.org $FFC0
.qword reset
done