Google

Dec 5, 2008

program to convert ASCII to packed BCD numbers

Following program is for conversion of ASCII to packed BCD numbers

For execution of this program, we load the 1st ASCII digit into BL and the second ASCII number into the second AL. Then we mask the upper 4 bits of 1st digit and load CL for 4 rotate required. ROtate BL 4 bit position and combine nibbles, result in AL and finally we HALT the program.

CODE:

MOV BL,35H
MOV AL,39H
AND BL,0F
AND AL,0F
MOV CL,04
ROL BL,CL
OR AL,BL
INT A5

OUTPUT: 59 Packed BCD Number

No comments: