Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions