Jul 19, 2011

ASCI to Binary

.MODEL SMALL
.STACK 100H
.DATA DB
M1 DB "Enter the Character::$"
M2 DB ODH,OAH,"The binary is::$"

MAIN PROC
MOV AX,@DATA
MOV DS,AX

MOV AH,1
INT 21H
MOV BL,AL
MOV CX,0
TOP:CMP CX,8
JE EXIT
SHL BL,1
JC PRINT1
MOV DL,'0'
MOV AH,2
INT 21H
PRINT 1:
MOV DC,1
MOV AH,2
INT 21H
INC CX
JMP TOP
INC CX
JMP TOP
MOV AH,4ch
INT 21H
MAIN ENDP
END MAIN
Exit:MOV AH,4CH
INT 21H
MAIN END

No comments: