Question: Help with explanations plz example 4.35 8 2) Modify program 4.35 on page 176 of the text to input a single one-digit integer and output

Help with explanations plz

Help with explanations plz example 4.35 8 2) Modify program 4.35 on

example 4.35

page 176 of the text to input a single one-digit integer and

8

2) Modify program 4.35 on page 176 of the text to input a single one-digit integer and output twice that value. The input will be one ASCll character representing a one-digit unsigned integer in base-8. Your program should output the result as two ASCII characters representing a two-digit integer, also in base-8. For example: If the input was 6', the output would be "I 4". If the input was "the output would be "06" (always print the 8's digit, even if it is zero) First, you must input a 1-digit number as an ASCII character and convert it into the internal representation of the appropriate integer value. Look at the way a "mask" is used to convert an integer into a character for the output in Program 4.35. Apply a similar technique for the input. Second, the number must be doubled: Use addition or shift the bits left. Finally, the result of your calculation must be output as two ASCII characters representing digits. Remember that three bits of base-2 are equal to 1 digit of base-8. Therefore, you need to isolate the rightmost three bits of the result (again, use a mask) and output that value as an ASClII digit, then isolate the next three bits of the sum and do the same thing. You will need to use an arithmetic shift instruction to get which represent the high-order digit into the right three positions of a word in order to output digit. the bits I strongly recommend that you use the Pep/8 simulator to test your solution. 2) Modify program 4.35 on page 176 of the text to input a single one-digit integer and output twice that value. The input will be one ASCll character representing a one-digit unsigned integer in base-8. Your program should output the result as two ASCII characters representing a two-digit integer, also in base-8. For example: If the input was 6', the output would be "I 4". If the input was "the output would be "06" (always print the 8's digit, even if it is zero) First, you must input a 1-digit number as an ASCII character and convert it into the internal representation of the appropriate integer value. Look at the way a "mask" is used to convert an integer into a character for the output in Program 4.35. Apply a similar technique for the input. Second, the number must be doubled: Use addition or shift the bits left. Finally, the result of your calculation must be output as two ASCII characters representing digits. Remember that three bits of base-2 are equal to 1 digit of base-8. Therefore, you need to isolate the rightmost three bits of the result (again, use a mask) and output that value as an ASClII digit, then isolate the next three bits of the sum and do the same thing. You will need to use an arithmetic shift instruction to get which represent the high-order digit into the right three positions of a word in order to output digit. the bits I strongly recommend that you use the Pep/8 simulator to test your solution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!