Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3-9 Fast shifting. Because it is so fast, the multiply instruction can be used as a swifter shifter, throwing away bits at one end of
3-9 Fast shifting. Because it is so fast, the multiply instruction can be used as a swifter shifter, throwing away bits at one end of the number and filling in zeros at the other end. The operand is moved to WREG and multiplied by a power of 2 corresponding to the desired number of shifts. For example, if the number B'11000101' is multiplied by 8, then PRODH will equal B'00000110' and PRODL will equal B'00101000'. Note that PRODH contains the original number shifted right five places. PRODL contains the original number shifted left three places. The selected byte can finally be written back to the original operand. (a) What is the general rule for shifting a number left n places (where 2 sn= 7)? (b) What is the general rule for shifting a number right n places (where 2 sn= 7)? (c) Write the code to shift the 1-byte variable TEMP left three places, using "rotate left" in- structions and then clearing the three least-significant bits. 3-9 Fast shifting. Because it is so fast, the multiply instruction can be used as a swifter shifter, throwing away bits at one end of the number and filling in zeros at the other end. The operand is moved to WREG and multiplied by a power of 2 corresponding to the desired number of shifts. For example, if the number B'11000101' is multiplied by 8, then PRODH will equal B'00000110' and PRODL will equal B'00101000'. Note that PRODH contains the original number shifted right five places. PRODL contains the original number shifted left three places. The selected byte can finally be written back to the original operand. (a) What is the general rule for shifting a number left n places (where 2 sn= 7)? (b) What is the general rule for shifting a number right n places (where 2 sn= 7)? (c) Write the code to shift the 1-byte variable TEMP left three places, using "rotate left" in- structions and then clearing the three least-significant bits
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started