Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a simple assembly language program that rotates a bitpatern to the left by

ID: 3609222 • Letter: W

Question

Write a simple assembly language program that rotates a bitpatern to the left by a certain amount (a number between 0 and 16,including 0 and 16). The bit pattern is found in location x3100with the rotate amount in memory location x3101. The result is tobe placed in location x 3102. The program starts at location x3000.The difference between a rotate and a shift is that the bits thatwould have been lost in the shift are "wrapped" around and movedinto the right side of the pattern. For example, if the originalpattern is 1101 0001 0000 1011 and the rotate amount is 0000 00000000 1100 (decimal 12), the result in x3102 should be, 1011 11010001 0000. This is a lifesaver question. Thank you. Write a simple assembly language program that rotates a bitpatern to the left by a certain amount (a number between 0 and 16,including 0 and 16). The bit pattern is found in location x3100with the rotate amount in memory location x3101. The result is tobe placed in location x 3102. The program starts at location x3000.The difference between a rotate and a shift is that the bits thatwould have been lost in the shift are "wrapped" around and movedinto the right side of the pattern. For example, if the originalpattern is 1101 0001 0000 1011 and the rotate amount is 0000 00000000 1100 (decimal 12), the result in x3102 should be, 1011 11010001 0000. This is a lifesaver question. Thank you.

Explanation / Answer

I hope it will help you. // Reverse the 32-bits in EAX, leaving the result in EBX: mov( 32, cl ); RvsLoop: shr( 1, eax ); // Move current bit in EAX to the carry flag. rcl( 1, ebx ); // Shift the bit back into EBX, backwards. dec( cl ); jnz RvsLoop ************** Complete help can be found on this link http://webster.cs.ucr.edu/AoA/Windows/HTML/BitManipulationa2.html

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote