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
→