From 294b5d1cf1e79ed2b4a21000e37d4e423214cfa1 Mon Sep 17 00:00:00 2001 From: compyx Date: Wed, 15 Jul 2020 21:39:29 +0200 Subject: [PATCH] C64 soft80 conio: shave off a few bytes and cycles --- libsrc/c64/soft80_cgetc.s | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/libsrc/c64/soft80_cgetc.s b/libsrc/c64/soft80_cgetc.s index aa12cd8ca..1bca57bec 100644 --- a/libsrc/c64/soft80_cgetc.s +++ b/libsrc/c64/soft80_cgetc.s @@ -46,8 +46,18 @@ invertcursor: lda #$34 sta $01 - jsr setcolor - + ldy #0 + bcs @set + ; restore old value + lda tmp1 + bcc @lp0 +@set: + ; save old value + lda (CRAM_PTR),y ; vram + sta tmp1 + lda soft80_internal_cellcolor +@lp0: + sta (CRAM_PTR),y ; vram ldx soft80_internal_cursorxlsb ldy #7 @lp1: @@ -65,20 +75,7 @@ invertcursor: ; do not use soft80_putcolor here to make sure the cursor is always ; shown using the current textcolor without disturbing the "color voodoo" ; in soft80_cputc -setcolor: - ldy #0 - bcs @set - ; restore old value - lda tmp1 - sta (CRAM_PTR),y ; vram - rts -@set: - ; save old value - lda (CRAM_PTR),y ; vram - sta tmp1 - lda soft80_internal_cellcolor - sta (CRAM_PTR),y ; vram - rts + .rodata nibble: .byte $f0, $0f