diff --git a/libsrc/common/tolower.s b/libsrc/common/tolower.s index fa03146b0..0c67199a3 100644 --- a/libsrc/common/tolower.s +++ b/libsrc/common/tolower.s @@ -8,12 +8,14 @@ .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 diff --git a/libsrc/common/toupper.s b/libsrc/common/toupper.s index ab7711cb2..5561eb7d4 100644 --- a/libsrc/common/toupper.s +++ b/libsrc/common/toupper.s @@ -8,6 +8,8 @@ .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