.import __ctype, __cdiff
_tolower:
+ cpx #$00 ; Outside valid range?
+ bne L9 ; If so, return the argument unchanged
tay ; Get C into Y
lda __ctype,y ; Get character classification
lsr a
lsr a ; Get bit 1 (upper case char) into carry
tya ; Get char back into A
bcc L9 ; Jump if no upper case char
- sbc __cdiff ; make lower case char (carry already set)
-L9: rts ; CC are set
+ sbc __cdiff ; Make lower case char (carry already set)
+L9: rts
.import __ctype, __cdiff
_toupper:
+ cpx #$00 ; Outside valid range?
+ bne L9 ; If so, return the argument unchanged
tay ; Get c into Y
lda __ctype,y ; Get character classification
lsr a ; Get bit 0 (lower char) into carry