From 59dc46ca8fe1eb6f98abb98fe8579aeaedd2ff15 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 2 Apr 2020 19:04:12 -0400 Subject: Made the emulator less bloated, and faster. --- test/subroutine.s | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'test/subroutine.s') diff --git a/test/subroutine.s b/test/subroutine.s index 03447fd..65e46ca 100644 --- a/test/subroutine.s +++ b/test/subroutine.s @@ -3,7 +3,9 @@ buf: .org $0 ptr: -.qword buf +.qword $0 +ptr2: +.qword $0 .org $8000 reset: @@ -13,32 +15,34 @@ reset: start: ldy #0 ldb #0 - inb - stb $C010 - deb + tyx + lda.w #buf + sta.q ptr + adc #8 + sta.q ptr2 + ;inb + ;stb $C010 + ;deb +bench: jsl clr_buf - jmp start + jmp bench clr_buf: - lda #0 - cpy.w #$1FFF - bcs clr_buf_end - sta.q (ptr), y - tya - adc #8 - tay - tba - sta.q (ptr), y - tya - adc #8 - tay - tba - jmp 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: - ldy.w #0 - rtl - + tay ; Set the index back to zero. + rtl ; End of clr_buf. +;.org $C010 +;.byte $1 .org $FFC0 .qword reset done -- cgit v1.2.3-13-gbd6f