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/asr.s | 8 ++++---- test/subroutine.s | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'test') diff --git a/test/asr.s b/test/asr.s index 4bc388f..c01269e 100644 --- a/test/asr.s +++ b/test/asr.s @@ -6,9 +6,10 @@ reset: cps start: - lda.q #$-FFFF - ldb.q #-1 - + lda #0 + sbc #$FFFF + ldb #0 + deb signshft: asr #1 cab @@ -18,6 +19,5 @@ signshft: .org $FFC0 .qword reset .org $0 -v done 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