mirror of
https://github.com/cc65/cc65.git
synced 2025-01-21 00:31:53 +00:00
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:
parent
2c4dd5decf
commit
381a32d9aa
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user