1. The 32-bit word at data address PACK contains an 8-digit packed BCD (Binary-Coded Decimal) number....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Find -notation in terms of n for the number of times the statement x = x+1 is executed in the pseudocode below. Provide a short answer. x-0 y-e k-n while k 1 y-y+1 for 1 1 to n x x+1 k - k/2 for 11...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Find the direction cosines and angles of, and demonstrate that the sum of the squares of the direction cosines is 1. u = 5i + 3j - k
-
An earthquake P wave traveling at 8.0 km/s strikes a boundary within the Earth between two kinds of material. If it approaches the boundary at an incident angle of 47o and the angle of refraction is...
-
Using a theoretical lens, explain how the data relate to the problem you selected ( substance abuse and alcohol). Identify important gaps in existing information. Organize and reorganize information...
-
The probability that a turbine will have a defective coil is 0.10, the probability that it will have defective blades is 0.15, and the probability that it will have both defects is 0.04. (a) What is...
-
Comparison of borrow/buy with operating and capital leases. Carom Sports Collectibles Shop plans to acquire, as of January 1, 2008, a computerized cash register system that costs $100,000 and has a...
-
Required information Problem 1-35A (Static) Recording events in a horizontal statements model LO 1-3, 1-4, 1-5, 1-6, 1-7, 1-8, 1-9, 1-10 [The following information applies to the questions displayed...
-
The graph above represents various flows that can occur through a sewage treatment plant with the numbers on the arcs representing the maximum flow (in tons of sewage per hour) that can be...
-
Piercing Services Tribal Ways performs all exotic body piercings. We use "hospital grade" jewelry (316LVM Surgical Stainless Steel or Titanium) for initial piercings and all piercings are performed...
-
This section consists of some true/false questions regarding concepts of statistical inference. Indicate if a statement is true or false and, if false, indicate what is required to make the statement...
-
A \(35-\mathrm{kg}\) child stands on the edge of a playground merrygo-round that has a radius of \(2.0 \mathrm{~m}\) and a rotational inertia of \(500 \mathrm{~kg} \cdot \mathrm{m}^{2}\). The...
-
If the cyclist reaches his \(15 \mathrm{~km} / \mathrm{h}\) cruising speed by rolling down a hill, what is the approximate height of the hill? A. \(22 \mathrm{~m}\) B. \(11 \mathrm{~m}\) C. \(2...
-
Jennifer is given a pregnancy test. What does it mean when she is told that the result is positive?
-
A \(51-\mathrm{kg}\) box is suspended from the right end of a horizontal rod that has very small inertia. The left end of the rod is affixed to a wall by a pin. A wire connects the right end of the...
-
At an undisclosed location outside Saskatoon, a pumped well has been removing water from an aquifer for the last several months. The aquifer is 71 m thick and the well reaches to its bottom. The pump...
-
A glass manufacturer produces hand mirrors. Each mirror is supposed to meet company standards for such things as glass thickness, ability to reflect, size of handle, quality of glass, color of...
-
A router is used to cut locating notches on a printed circuit board. The vibration level at the surface of the board as it is cut is considered to be a major source of dimensional variation in the...
-
Consider the 2 4 factorial experiment in Example 6-2. Suppose that the last two observations are missing. Reanalyze the data and draw conclusions. How do these conclusions compare with those from the...
-
Consider the data from the first replicate of Problem 6-7. Construct a design with two blocks of eight observations each with ABCD confounded. Analyze the data. Problem 6-7. An experiment was...
-
Explain the building blocks of accounting: ethics, principles, and assumptions.
-
On May 1, 2025, Park Flying School Ltd., a company that provides flying lessons, was started with an investment of 45,000 cash in the business. Following are the assets and liabilities of the company...
-
The historical cost basis results in: a. initially recording assets at cost and adjusting when the current value changes. b. keeping activities of an entity separate and distinct from its owner. c....
Study smarter with the SolutionInn App