2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 02.06.1998
|
|
|
|
;
|
|
|
|
; int tolower (int c);
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _tolower
|
2002-11-22 00:53:46 +00:00
|
|
|
.import __ctype
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_tolower:
|
2002-11-11 11:58:20 +00:00
|
|
|
cpx #$00 ; Outside valid range?
|
|
|
|
bne L9 ; If so, return the argument unchanged
|
2000-05-28 13:40:48 +00:00
|
|
|
tay ; Get C into Y
|
|
|
|
lda __ctype,y ; Get character classification
|
2001-04-19 06:46:01 +00:00
|
|
|
lsr a
|
|
|
|
lsr a ; Get bit 1 (upper case char) into carry
|
2000-05-28 13:40:48 +00:00
|
|
|
tya ; Get char back into A
|
2001-04-19 06:46:01 +00:00
|
|
|
bcc L9 ; Jump if no upper case char
|
2002-11-22 00:53:46 +00:00
|
|
|
sbc #<('A'-'a') ; Make lower case char (carry already set)
|
2002-11-11 11:58:20 +00:00
|
|
|
L9: rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|