Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The 32-bit word at data address PACK contains an 8-digit packed BCD (Binary-Coded Decimal) number. As described in Lecture 5 of Module 1,

1. The 32-bit word at data address PACK contains an 8-digit packed BCD (Binary-Coded Decimal) number. As

1. The 32-bit word at data address PACK contains an 8-digit packed BCD (Binary-Coded Decimal) number. As described in Lecture 5 of Module 1, "Packed BCD" format uses four bits to represent each decimal digit, with two BCD digits packed into each byte (less-significant digit in the low half of the byte). Write a program to convert the packed BCD number stored in PACK to a string of eight ASCII character codes, representing the eight decimal digits of that number. (This string could be sent to a printer to print the number.) These ASCIl codes are to be stored in an array of eight bytes of memory beginning at address STRG in RAM. For example, if the packed BCD number is 0x13587609, the eight characters should be stored in memory as follows: (10,000,000's) (1,000,000's) Most significant digit Next most significant digit Next most significant digit Next most significant digit (100,000's) (10,000's) STRG => '1' (0x31)- STRG+1 => '3' (0x33)- STRG+2 => '5' (0x35)- STRG+3 => '8 (0x38)- STRG+4 => '7' (0x37)- STRG+5 => '6' (0x36)- STRG+6=> '0' (0x30)- STRG+7=> '9 (0x39)- Next most significant digit (1,000's) Next most significant digit (100's) Next most significant digit (10's) Least significant digit (1's) Your program is to convert this 32-bit packed BCD number to the corresponding ASCII character string. Note that this 32-bit BCD number corresponds to the size of a register. You will likely need shift and logical operations in this program. 2. Demonstrate your program in the debugger by initializing each byte of array STRG to Ox00 and the 32-bit value of PACK to Ox13587609. 3. Submit: The source program The debugger Memory view after executing the program, circling the bytes of STRG (use rendering format ASCII). Also show the BCD number in the Expressions view.

Step by Step Solution

3.38 Rating (148 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Design And Analysis Of Experiments

Authors: Douglas C., Montgomery

5th Edition

978-0471316497, 0471316490

More Books

Students also viewed these Programming questions