If r0 initially contains 1 what will it contain after the th
Solution
//In the following all the contents of registers are specified in there decimal equivalent means base 10.
4.1) answer :
Initially r0=1
1. add r0,r0,#1 -> After this instruction r0=2
2. mov r1,r0 -> After this instruction r1=r0
3. add r0,r1,r0 lsl #1 ->This instruction first logically shift the content of r0 to left and add this value with content of r1 and store result to r0
Finally r0=6 and r1=2
4.2) answer :
1. mov r0,#1 -> After this instruction r0=1
2. mov r1,#0x20 ->After this instruction r1=32
3. orr r1,r1,r0 -> This instruction performs logical or .After this instruction r1=33
4. lsl r1,#0x2 -> This instruction logically shift the content of r1 by 2 ,r1=132
5. orr r1,r1,r0 -> After this r1=133
6. eor r0,r0,r1 ->This instruction is logical exclusive or.After this r0=132
7. lsr r1,r0,#3 ->This instruction perform logical right shift on content of r0 by 3 and store result in r1. After this r1=16
Finally the content of r0=132 and r1=16.
