summaryrefslogtreecommitdiff
path: root/test/subroutine.s
blob: d39fc151ffe44d9b85a72ff3b8713c4f57d38335 (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
50
.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:
	jsr 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.
	rts		; End of clr_buf.

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