summaryrefslogtreecommitdiff
path: root/test/subroutine.s
blob: 122c34c390ad922d6a0ad923eb6689018c0006cd (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:
	jsr clr_buf
	bra @bench

clr_buf:
	tba		; Reset the Accumulator.
	cpy.w #$1FFF	; Did we clear all of the screen buffer?
	bcs @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.
	bra clr_buf	; Keep looping.
@end:
	tay		; Set the index back to zero.
	rts		; End of clr_buf.

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