.MODEL SMALL
.STACK 100H
.DATA
MSG_1 DB 'Enter a lower case letter: $'
MSG_2 DB 0DH,0AH,'In uppercase it is: $'
CHAR DB ?
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
MOV AH, 9
LEA DX, MSG_1 ; load and display MSG_1
INT 21H
MOV AH, 1 ; read the lowercase letter
INT 21H
MOV CHAR, AL ; save the lowercase letter into AL
SUB CHAR, 20H ;convert the character into uppercase letter by subtracting 20H
MOV AH, 9
LEA DX, MSG_2 ; load and display MSG_2
INT 21H
MOV AH, 2
MOV DL, CHAR ; display the output
INT 21H
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
.STACK 100H
.DATA
MSG_1 DB 'Enter a lower case letter: $'
MSG_2 DB 0DH,0AH,'In uppercase it is: $'
CHAR DB ?
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
MOV AH, 9
LEA DX, MSG_1 ; load and display MSG_1
INT 21H
MOV AH, 1 ; read the lowercase letter
INT 21H
MOV CHAR, AL ; save the lowercase letter into AL
SUB CHAR, 20H ;convert the character into uppercase letter by subtracting 20H
MOV AH, 9
LEA DX, MSG_2 ; load and display MSG_2
INT 21H
MOV AH, 2
MOV DL, CHAR ; display the output
INT 21H
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
No comments:
Post a Comment