diff options
| author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-09-24 08:21:08 -0400 | 
|---|---|---|
| committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-09-24 08:21:08 -0400 | 
| commit | 784ff59108b887e246b0f33ff696dfd981659ab2 (patch) | |
| tree | 02d00ff774bd35a31f04afb62a7f187ca0a097f9 /test | |
| parent | 9932fac52c0cac2e9e0e11c84dfdf99e0a87ebfb (diff) | |
- Fixed some more bugs with struct, and union handling.
Diffstat (limited to 'test')
| -rw-r--r-- | test/subroutine.s | 67 | 
1 files changed, 39 insertions, 28 deletions
| diff --git a/test/subroutine.s b/test/subroutine.s index 122c34c..b7d8d17 100644 --- a/test/subroutine.s +++ b/test/subroutine.s @@ -1,45 +1,56 @@ -.org $2000 -buf: - -.org $0 +.org 0 +scr_ptr: +	.res 2  ptr: -.qword $0 +	.res 8  ptr2: -.qword $0 +	.res 8 + +.org $2000 +buf: +	.res $2000  .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 +	cps		; Reset the processor status register. +	ldx.w #$FFFF	; Reset the stack pointer. +	txs		;  @bench: -	jsr clr_buf +	tay		; Reset Y. +	lda.w #$1FFF	; Set the clear count to $1FFF. +	sta.w scr_ptr	; +	lda.d #buf	; Set the array to be cleared to the screen buffer. +	jsr clr_arr	; Clear the screen buffer.  	bra @bench -clr_buf: -	tba		; Reset the Accumulator. -	cpy.w #$1FFF	; Did we clear all of the screen buffer? +clr_arr: +	phb 		; Preserve whatever was in B. +	ldb #0		; Clear B. +	sta.q ptr	; +	adc #8		; Set the second pointer to the parameter, plus eight. +	sta.q ptr2	; +	tba		; +@loop: +	cpy.w scr_ptr	; Did we clear all of the array?  	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. +	tya		; Copy the array index.  	adc #$10	; Increment the index by 16.  	tay		; Update the index. -	bra clr_buf	; Keep looping. +	tba		; Reset the Accumulator. +	sta.q (ptr), y	; Do this one more time, to clear 32 bytes. +	sta.q (ptr2), y	; +	tya		; +	adc #$10	; +	tay		; +	tba		; +	bra @loop	; Keep looping.  @end: -	tay		; Set the index back to zero. -	rts		; End of clr_buf. +	tay		; Reset A. +	plb 		; Get whatever was in the B register, back. +	rts		; End of clr_arr. +  ;.org $C010  ;.byte $1 | 
