MASM PROGRAM TO CONVERT THE CASE OF A CHARACTER
AIM : TO CONVERT THE CASE OF A CHARACTER
ALGORITHM :
STEP 1 : INPUT THE CHARACTER
STEP 2 : MOVE THE CHARACTER IN AL TO CL
STEP 3 : MOVE CL TO DL
STEP 4 : COMPARE DL WITH 01H
STEP 5 : JUMP IF CARRY TO 8
STEP 6 : SUBTRACT DL WITH 20H
STEP 7 : JUMP IF NO CARRY TO 9
STEP 8 : ADD DL WITH 20H
STEP 9 : PRINT THE CHARACTER
STEP 10 : TERMINATE THE PROGRAM
STEP 11 : STOP
PROGRAM :
CODE SEGMENT
ASSUME CS: CODE
START:
MOV AH,01H
INT 21H
MOV CL,AL
MOV DL,CL
CMP DL,61H
JC L1
SUB DL,20H
JNC L2
L1:
ADD DL,20H
L2:
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
OUTPUT :
aA
AIM : TO CONVERT THE CASE OF A CHARACTER
ALGORITHM :
STEP 1 : INPUT THE CHARACTER
STEP 2 : MOVE THE CHARACTER IN AL TO CL
STEP 3 : MOVE CL TO DL
STEP 4 : COMPARE DL WITH 01H
STEP 5 : JUMP IF CARRY TO 8
STEP 6 : SUBTRACT DL WITH 20H
STEP 7 : JUMP IF NO CARRY TO 9
STEP 8 : ADD DL WITH 20H
STEP 9 : PRINT THE CHARACTER
STEP 10 : TERMINATE THE PROGRAM
STEP 11 : STOP
PROGRAM :
CODE SEGMENT
ASSUME CS: CODE
START:
MOV AH,01H
INT 21H
MOV CL,AL
MOV DL,CL
CMP DL,61H
JC L1
SUB DL,20H
JNC L2
L1:
ADD DL,20H
L2:
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
OUTPUT :
aA
No comments:
Post a Comment