2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 02.06.1998
|
|
|
|
;
|
|
|
|
; int toupper (int c);
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _toupper
|
2002-11-22 00:53:46 +00:00
|
|
|
.import __ctype
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_toupper:
|
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 ; Get bit 0 (lower char) into carry
|
2000-05-28 13:40:48 +00:00
|
|
|
tya ; Get C back into A
|
2001-04-19 06:46:01 +00:00
|
|
|
bcc L9 ; Jump if not lower char
|
2000-05-28 13:40:48 +00:00
|
|
|
clc
|
2002-11-22 00:53:46 +00:00
|
|
|
adc #<('A'-'a') ; make upper case char
|
2001-04-19 06:46:01 +00:00
|
|
|
L9: rts ; CC are set
|
2000-05-28 13:40:48 +00:00
|
|
|
|