2000-05-28 13:40:48 +00:00
|
|
|
;
|
2013-08-28 06:58:41 +00:00
|
|
|
; 1998-06-02, Ullrich von Bassewitz
|
|
|
|
; 2013-08-28, Greg King
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
2013-08-28 06:58:41 +00:00
|
|
|
; char* __fastcall__ strupper (char* s);
|
|
|
|
; char* __fastcall__ strupr (char* s);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Non-ANSI
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _strupper, _strupr
|
|
|
|
.import popax
|
|
|
|
.import __ctype
|
|
|
|
.importzp ptr1, ptr2
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-02-10 22:11:56 +00:00
|
|
|
.include "ctype.inc"
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
_strupper:
|
|
|
|
_strupr:
|
2013-05-09 11:56:54 +00:00
|
|
|
sta ptr1 ; Save s (working copy)
|
|
|
|
stx ptr1+1
|
|
|
|
sta ptr2
|
2013-08-28 06:58:41 +00:00
|
|
|
stx ptr2+1 ; save function result
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
|
|
|
|
loop: lda (ptr1),y ; get character
|
|
|
|
beq L9 ; jump if done
|
|
|
|
tax
|
|
|
|
lda __ctype,x ; get character classification
|
|
|
|
and #CT_LOWER ; lower case char?
|
|
|
|
beq L1 ; jump if no
|
|
|
|
txa ; get character back into accu
|
|
|
|
clc
|
|
|
|
adc #<('A'-'a') ; make upper case char
|
|
|
|
sta (ptr1),y ; store back
|
|
|
|
L1: iny ; next char
|
|
|
|
bne loop
|
|
|
|
inc ptr1+1 ; handle offset overflow
|
|
|
|
bne loop ; branch always
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Done, return the argument string
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L9: lda ptr2
|
|
|
|
ldx ptr2+1
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|