7).Convert an ASCII coded decimal number into its binary equivalent.
.MODEL SMALL
.DATA
MESG DB 10,13, 'ENTER NO: $'
RESULT DB 10,13, 'RESULT IS: $'
.CODE
.STARTUP
MOV DX,OFFSET MESG
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV BL,AL
MOV DX,OFFSET RESULT
MOV AH,09H
0INT 21H
MOV CL,08H
MOV AH,00H
MOV AL,BL
L1: SHL AL, 01H
MOV BL,AL
MOV AL,00H
ADC AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
MOV AL,BL
LOOP L1
.EXIT
END
.MODEL SMALL
.DATA
MESG DB 10,13, 'ENTER NO: $'
RESULT DB 10,13, 'RESULT IS: $'
.CODE
.STARTUP
MOV DX,OFFSET MESG
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV BL,AL
MOV DX,OFFSET RESULT
MOV AH,09H
0INT 21H
MOV CL,08H
MOV AH,00H
MOV AL,BL
L1: SHL AL, 01H
MOV BL,AL
MOV AL,00H
ADC AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
MOV AL,BL
LOOP L1
.EXIT
END
No comments:
Post a Comment