1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-13 12:30:40 +00:00

check for space bottom up, which is faster for the average case

This commit is contained in:
mrdudz 2015-10-12 16:15:40 +02:00
parent a2b514a7cf
commit bc85d90468

View File

@ -482,9 +482,13 @@ soft80_putcolor:
sta (CRAM_PTR),y ; vram sta (CRAM_PTR),y ; vram
rts rts
;
; test if there is a space or a character at current position ; test if there is a space or a character at current position
; in: y must be $00 ;
; in: x = $34
; y must be $00
; out: CLC: space SEC: character ; out: CLC: space SEC: character
; x = $34
; y = $00 ; y = $00
soft80_checkchar: soft80_checkchar:
@ -493,19 +497,24 @@ soft80_checkchar:
;lda CURS_X ;lda CURS_X
;and #$01 ;and #$01
lda soft80_internal_cursorxlsb lda soft80_internal_cursorxlsb
jne @l1a bne @l1a
; check charset data from bottom up, since a lot of eg lowercase chars
; have no data in the top rows, but all of the DO have data in the
; second to bottom row, this will likely be faster in average.
ldy #7
.repeat 8,line .repeat 8,line
lda (SCREEN_PTR),y lda (SCREEN_PTR),y
and #$f0 and #$f0
cmp #$f0 cmp #$f0
bne @l2b bne @l2b
.if (line < 7) .if (line < 7)
iny dey
.endif .endif
.endrepeat .endrepeat
ldy #$00 ;ldy #$00 ; is 0
clc clc
rts rts
@l2b: @l2b:
@ -513,16 +522,17 @@ soft80_checkchar:
sec sec
rts rts
@l1a: @l1a:
ldy #$07
.repeat 8,line .repeat 8,line
lda (SCREEN_PTR),y lda (SCREEN_PTR),y
and #$0f and #$0f
cmp #$0f cmp #$0f
bne @l2bb bne @l2bb
.if line < 7 .if line < 7
iny dey
.endif .endif
.endrepeat .endrepeat
ldy #$00 ;ldy #$00 ; is 0
clc clc
rts rts
@l2bb: @l2bb: