; Convert intext to upper case JMP start intext: DB "In Text !@#" ; Variable DB 0xFF ; String terminator ucA: DB 'A' ; upper case A value ucZ: DB 'Z' ; upper case Z value lca: DB 'a' ; lower case a value lcz: DB 'z' ; lower case z value lcuc: DB 0d ; Will hold lc to uc difference outbuf: DB 0xE8 ; output buffer start memloc start: ; Calculate the difference between lca and ucA values ; Store result in lcuc MOV A, [ucA] MOV B, [lca] SUB B, A MOV [lcuc], B ; For remainder ; reg C has the memloc of the current intext char ; reg B has the memloc of the current output location ; reg A has the current intext char ASCII value MOV C, intext ; Get 1st char of intext memloc MOV B, [outbuf] ; Get output buffer memloc loopch: MOV A, [C] ; Get next intext char value CMP A, 0xFF ; Check if string terminator JNE convch ; If not convert the character HLT ; halt otherwise (i.e., string terminator) convch: CMP A, [lca] ; Is char >= lc a? JB showch ; If not show the char CMP A, [lcz] ; Is char <= lc z? JA showch ; If not show the char SUB A, [lcuc] ; Subtract to convert to upper case showch: MOV [B], A ; put the char in output buffer INC B ; increment output buffer memloc INC C ; increment intext memloc JMP loopch ; process next character