From 784ff59108b887e246b0f33ff696dfd981659ab2 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 24 Sep 2020 08:21:08 -0400 Subject: - Fixed some more bugs with struct, and union handling. --- test/subroutine.s | 67 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 28 deletions(-) (limited to 'test') 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 -- cgit v1.2.3-13-gbd6f