examples/lib/upcase.xyw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
; Convert a string to uppercase
; s ->
.label upcase
; store index
POPxw
.label upcase.loop
LDBxw $00 EQU upcase.end JCNw
; check if a lowercase letter
LDBxw $60 GTH
LDBxw $7B LTH
AND upcase.change JCNw
; continue
INCxw upcase.loop JMPw
.label upcase.change
; convert to uppercase
LDBxw $20 SUB STBxw
; continue
INCxw upcase.loop JMPw
.label upcase.end
RTS
|