]> git.sur5r.net Git - cc65/blob - libsrc/common/toupper.s
43ff0812d5cb54bb7c01f8452052a9c1f067e7b9
[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, __cdiff
9
10 _toupper:
11         tay                     ; Get c into Y
12         lda     __ctype,y       ; Get character classification
13         and     #$01            ; Mask lower char bit
14         beq     L1              ; Jump if not lower char
15         tya                     ; Get C back into A
16         clc
17         adc     __cdiff         ; make upper case char
18         rts                     ; CC are set
19
20 L1:     tya                     ; Get C back
21         rts                     ; CC are set
22