8086 ASSEMBLY LEVEL PROGRAM TO CONVERT HEXADECIMAL NUMBER TO BCD


DATA SEGMENT
HEX DB 0AFH
BCD DW 0
CNT DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV AL,HEX
CMP AL,00
JZ LAST

LOOP1:
MOV AH,00
MOV BL,0AH
DIV BL
MOV DH,00
MOV DL,AH
MOV BL,AL
MOV AL,04
MUL CNT
MOV CL,AL
ROL DX,CL
OR BCD,DX
MOV AL,BL
INC CNT
CMP AL,0
JNZ LOOP1
LAST:INT 3
CODE ENDS
END START
END


Comments