Implement strcasestr as part of strstr

This commit is contained in:
Colin Leroy-Mira
2024-03-18 19:52:04 +01:00
parent 82165c1a77
commit b5d259bafb
3 changed files with 38 additions and 57 deletions

View File

@@ -17,12 +17,12 @@
_tolower:
cpx #$00 ; out of range?
bne @L2 ; if so, return the argument unchanged
tay ; save char
pha ; save char
jsr ctypemaskdirect ; get character classification
and #CT_UPPER ; upper case char?
beq @L1 ; jump if no
tya ; restore char
pla ; restore char
adc #<('a'-'A') ; make lower case char (ctypemaskdirect ensures carry clear)
rts
@L1: tya ; restore char
@L1: pla ; restore char
@L2: rts