C64 soft80-conio cgetc: save 14 cycles in invertcursor
By 'inverting' the loop, we can save 16 cycles by removing the `cpy #8`, saving 16 cycles. But we need an extra `ldy #7` at the start of the loop, so the total cycles saved is 14. Code size doesn't increase due to the addition of the `ldy #7` negating the removal of the `cpy #xx`.
This commit is contained in:
@@ -46,17 +46,16 @@ invertcursor:
|
|||||||
lda #$34
|
lda #$34
|
||||||
sta $01
|
sta $01
|
||||||
|
|
||||||
ldy #$00
|
|
||||||
jsr setcolor
|
jsr setcolor
|
||||||
|
|
||||||
ldx soft80_internal_cursorxlsb
|
ldx soft80_internal_cursorxlsb
|
||||||
|
ldy #7
|
||||||
@lp1:
|
@lp1:
|
||||||
lda (SCREEN_PTR),y
|
lda (SCREEN_PTR),y
|
||||||
eor nibble,x
|
eor nibble,x
|
||||||
sta (SCREEN_PTR),y
|
sta (SCREEN_PTR),y
|
||||||
iny
|
dey
|
||||||
cpy #8
|
bpl @lp1
|
||||||
bne @lp1
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
sta $01 ; enable I/O
|
sta $01 ; enable I/O
|
||||||
@@ -67,7 +66,7 @@ invertcursor:
|
|||||||
; shown using the current textcolor without disturbing the "color voodoo"
|
; shown using the current textcolor without disturbing the "color voodoo"
|
||||||
; in soft80_cputc
|
; in soft80_cputc
|
||||||
setcolor:
|
setcolor:
|
||||||
;ldy #0 ; is 0
|
ldy #0
|
||||||
bcs @set
|
bcs @set
|
||||||
; restore old value
|
; restore old value
|
||||||
lda tmp1
|
lda tmp1
|
||||||
|
|||||||
Reference in New Issue
Block a user