Right Rotation

As the name suggests, the right rotation operation is the opposite of the left rotation operation. Every bit in the word is shifted one place to the right, and the leftmost bit becomes the old rightmost bit. For example:

        1111111001111111 becomes
        1111111100111111

        1010111000011011 becomes
        1101011100001101
    

Write a Hack assembly program that performs the right rotation operation on the word in RAM[0] a total of RAM[1] times, and stores the result in RAM[2]. You may assume RAM[1] is at most 15. You may want to use your answer for the left shift exercise as a base.

Hint: There’s a nice way to express right-rotation in terms of left-rotation — in fact, you can solve this problem with only a minor tweak to your left-rotation program.