Question

Write a program in 8086 assembly language, which converts a packed four-digit packed BCD number to equivalent four ASCII digits; for example, a packed BCD number “4367” stored in a word is converted to ASCII “4”, “3”, “6”, “7”. Explain the algorithm of the program.

13 Sep 2024
Answer :
Word Count : 1082

To convert a packed BCD (Binary-Coded Decimal) number to its ASCII equivalent in 8086 assembly language, we must first understand the structure of the packed BCD number and the corresponding ASCII codes for decimal digits.

In a packed BCD format, two decimal digits are stored in a single byte. Each digit takes 4 bits: the high nibble stores the first digit (0-9), and the low nibble stores the second digit (0-9). For instance, the packed BCD number 4367, represented as 0x43 and 0x67 in hexadecimal, would be stored in two bytes: 0x43 for the digits "4" and "3" and 0x67 for the digits "6" and "7".

To convert this packed BCD number into ASCII characters, each digit in the packed BCD must be extracted and then converted into its corresponding ASCII value. The ASCII values for the digits 0-9 range from 0x30 to 0x39. Thus, to convert the BCD digits to ASCII, we need to add 0x30 to the value of each BCD digit.

### Algorithm

1. Input the packed BCD number: This will be a 16-bit number where each byte holds two packed decimal digits.
2. Extract the first byte and separate the high and low nibbles: The high nibble represents the first BCD digit, and the low nibble represents the second BCD digit.
3. Convert each nibble into its ASCII equivalent: Add 0x30 to the value of the nibble to get the ASCII code.
4. Repeat the process for the second byte: Extract the high and low nibbles of the second byte and convert each to its ASCII equivalent.
5. Store the resulting ASCII _______ ________ ___ ______ _______.
___ ___ ________ _________ __________ _________ _________ ____ __________ __________ _____ _______.
_________ __________ ____ _______ ______.
________ _________ ________ ____ ___ ________ ________ ______.
_________ ___ _____ _____ ______ ______ ________ ________ ______ __________ _____ ______.
_______ ________ ______ ______ __________ ___ _____ ________ _________ _______ ____.
________ ___ ___ _____ ______ __________ _____ ___ _______.
_______ ___ _____ ___ ____ ______ ___.
_____ _____ ____ ______ ________ ________ _________ _____.
__________ _______ ________ _____ ______ ________ ___ ____.
______ ________ __________ ___ ___ ____ _______ __________ __________ ___ __________.
________ ____ ____ __________ ______ __________.
_____ _______ ______ ___ __________ ______ ____ _________ ____.
___ ______ ________ ____ ______ ______.
__________ _________ _______ ___ _____ ____ _______ ____ _____ _____ __________.
__________ _______ ________ ______ _______ _____.
____ ________ ______ ______ ____ _________.
______ ____ ______ ____ ______ __________ ___ _____ ____ ____ ____.
______ _______ ________ __________ ______ _________.
_______ ____ _______ _____ __________ _____ _______.
_______ _________ _____ __________ ______ __________ _________.
____ ________ __________ ______ _________.
_________ _____ ___ ________ ________ ___ _____ __________ _____ ___.
_________ ______ ____ _________ _______ ______ _____ ___ _______ _____.
_______ ________ ____ _____ _____.
________ ___ ______ ______ ________ ________ __________ _______ _________ ____.
______ _________ _____ _______ ___ ___.
____ ____ ________ __________ _______ _____.
_______ ______ ____ ________ _________ __________ ________ _____ _____ _____ _______.
_______ _________ _________ ___ ________ ________.
__________ _____ ____ _________ ____ ________ ____.
________ ________ ______ __________ ___ ________ ___ _________ ___ __________ _________ ____.
_____ ___ _________ _______ _________ ____.
_________ ___ _______ ____ __________ __________.
______ ____ __________ ______ _____ _____ ________ _________ ___.
______ _____ _____ __________ _________ _____ ______ _______ ________.
______ _________ _______ ___ ___ ____ ___ _______ _______ _____ ________.
________ _____ _____ __________ _________ _________ _______ _____ ___ __________ _________.
______ _________ _________ ______ ________ ______ _____ _______.
______ _________ ____ __________ ____ _____ ___ ____.
_________ _________ _____ __________ ____.
___ _________ ______ ________ ___ ____ ______ __________ _____.
________ _____ _______ _________ ________ ________ __________ ____ ___ _____ ___.
_____ ________ _______ __________ _______ ______ _______ ____.
__________ ________ _________ _________ _______ ___ _____ _____ __________.
_____ ___ _____ ____ ________ __________ _________ ____ __________ _____.
___ _____ _______ __________ _______ ____ _________ _________.
__________ _____ _____ _________ _______ ___ _______ ________.
_______ ____ ___ ________ _______ ________ _______ ________.
______ ______ ________ __________ _________ ________.
_____ ___ __________ _______ _______ _________ _______.
_______ ________ ___ _________ __________ ________ ________ ____.
__________ _________ ___ ___ _____ ________ _________ ______ ______ _______.
__________ ___ _____ ________ ________ ___ ______ _________ ____ ______ ______.
________ ________ _________ ______ ___ ______ ______.
_________ _________ _____ __________ ___ _____ ____ ________ ______ ____.
____ ________ _________ ____ ________ ____ ____ ________.
___ __________ ______ ___ _________ __________ _____.
____ ____ _______ _______ ___ __________ __________ ____ _____.
______ ________ __________ __________ ___ _____ ____.
_________ ________ _________ ______ ________ _____ _________ ______ _____.
_____ ______ __________ ___ ________.
________ ____ __________ _________ __________ ________.
___ ____ ______ _________ ____ ________ _______ ____.
_________ _____ ________ ________ ________ ____ _________ ____ _______ ___.
___ ________ ____ _____ ____ ______ ___ _______ ___.
____ ____ _____ ___ ______ _____ _____.
________ _________ _____ ___ _________ ______ ______.
__________ _____ ___ __________ _________ _____ ________ ____ ________ ________.
___ ________ ___ _____ ____ _________ _____ ___ _________ ________ ________.
_____ _________ ____ _________ ____.
_____ _____ _____ _______ ______.
__________ ________ _____ __________ ________.
___ _______ ____ _________ _________.
__________ _________ _____ ___ ______ ____ _________ __________ ___ _________.
___ _______ ________ ______ _____ _______ _____ ______.
___ ______ __________ _________ _____ ________ _________ ________ __________ ______ __________.
______ _______ ____ ___ __________.
__________ _________ ________ __________ _______ __________.
____ ___ ___ _____ _____ ______ _____ ______.
________ ________ ______ ____ ___.
_________ _____ __________ ___ ________ __________ _____ ________ ______ ________ ___ __________.
____ ____ ___ _________ ______ _________ ______ ____ ________ _______.
______ _____ ____ ___ __________ _______ _______ ___ ________ ______ _________.
________ ___ ___ ______ ______ _____.
_________ _____ ____ _______ _____ _________ ______ _______ ______ ________ ____.
_________ ____ _______ ____ _____ ______ ___.
___ ____ ___ _____ _____ _____ _______ _____.
_________ ______ ________ ____ _________ ____.
______ ___ ____ _________ ______ ________ _______ _____ _______.
__________ ________ __________ ___ _________ _________ ________.
____ _________ ________ _____ _____.
______ _________ ________ ______ ____ ____ ____ ______ _________.
___ __________ ____ _________ ________ ____ ________ ___ _______.
_______ _______ _________ _______ ________.
_____ _____ ______ ________ __________ _____ ___ ______ ______ _______ __________.
__________ _____ __________ ________ ______ ___ __________ ___.
______ ___ ___ _________ _____ __________ _________.
_______ ______ ____ ___ ______ _________ __________ ______ _______ _____ ___ _________.
______ __________ ________ _________ _______ ___ ___ _____ __________ _________.
________.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write a program in 8086 assembly language, which converts a packed fou
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support