defer case check to be faster

This commit is contained in:
Peter Ferrie 2023-09-03 15:08:16 -07:00
parent c540527370
commit d4d3c59b8c

View File

@ -1002,19 +1002,15 @@ export asm streqi(a, b)#1
+ tax ; count up to (verified same) length of the strings + tax ; count up to (verified same) length of the strings
- iny - iny
lda (tmp),y lda (tmp),y
cmp #('z'&$7F)+1 ; convert to upper case eor (pTmp),y
bcs +
cmp #'a'&$7F
bcc ++
sbc #$20
!byte $C9 ; CMP imm - to skip next opcode
+ clc ; clear carry if not alpha
; CMP will set carry
++eor (pTmp),y
beq + ; matched beq + ; matched
bcc .noteqi ; abort on non-alpha inequality cmp #$20 ; check for case bit
eor #$20 ; check for case bit
bne .noteqi ; abort on alpha inequality bne .noteqi ; abort on alpha inequality
ora (tmp),y ; convert to lower case
cmp #('z'&$7F)+1
bcs .noteqi ; abort on inequality
cmp #'a'&$7F
bcc .noteqi ; abort on inequality
+ dex + dex
bne - bne -
lda #1 lda #1