In this program we will see how to find the equivalent BCD number from an ASCII value.
Write 8086 Assembly language program to find the equivalent BCD number from an ASCII value. The number is stored at memory location 2050 and store the result at memory location 3050.
This program can change ASCII value of a number to its BCD (Decimal) form. The ASCII values of the numbers are like below:
|ASCII (in Hex)||30||31||32||33||34||35||36||37||38||39|
From this table we can easily find that the last nibble of the ASCII value is actually the BCD equivalent. So to take the last nibble we have masked the upper nibble, and take the lower nibble as result.