]> git.sur5r.net Git - cc65/blob - libsrc/common/toupper.s
Updated to use cbm_kernal.inc. Whitespace cleanups
[cc65] / libsrc / common / toupper.s
1 ;
2 ; Ullrich von Bassewitz, 02.06.1998
3 ;
4 ; int toupper (int c);
5 ;
6
7         .export         _toupper
8         .import         __ctype
9
10 _toupper:
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               ; Get bit 0 (lower char) into carry
16         tya                     ; Get C back into A
17         bcc     L9              ; Jump if not lower char
18         clc
19         adc     #<('A'-'a')     ; make upper case char
20 L9:     rts                     ; CC are set
21