]> git.sur5r.net Git - cc65/blob - libsrc/common/tolower.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / common / tolower.s
1 ;
2 ; Ullrich von Bassewitz, 02.06.1998
3 ;
4 ; int tolower (int c);
5 ;
6
7         .export         _tolower
8         .import         __ctype
9
10 _tolower:
11         cpx     #$00            ; Outside valid range?
12         bne     L9              ; If so, return the argument unchanged
13         tay                     ; Get C into Y
14         lda     __ctype,y       ; Get character classification
15         lsr     a
16         lsr     a               ; Get bit 1 (upper case char) into carry
17         tya                     ; Get char back into A
18         bcc     L9              ; Jump if no upper case char
19         sbc     #<('A'-'a')     ; Make lower case char (carry already set)
20 L9:     rts
21