Question: Exercise 1: A word consists of the bytes b4, b3, b2, b1. Write a function to re-order (transpose) these bytes in the order b1, b3,

 Exercise 1: A word consists of the bytes b4, b3, b2,

Exercise 1: A word consists of the bytes b4, b3, b2, b1. Write a function to re-order (transpose) these bytes in the order b1, b3, b2, b4 As you can see, the outer bytes have been transposed and the inner two bytes are unchanged We could shift the word 24 bits right to get 0,0,01,b We could shit the original word 24 bits left to get b1,0,0,0 We could mask the original word to 0,b3,b2,0 Finally, by ORing these three values, we get b1,b3,b2,b4 We can do masking with BIC (bits set in the second operand clear corresponding source bits). The following demonstrates the simulator output File Edit View Project Flash Debug Peripherals Tools SVCS Window Help Registers Ch3Q13 transpose.asm" area test, CODE, readwrite LDR r0 , =0x12345678 MOV r1, r0, LSL #24 MOV r2, r0, LSR #24 BIC ro, ro, #0xFF BIC ro, ro, #0xFF000000 ;get 0,b3,b2 , 0 ORR r0,ro,r ORR r0, r0,r2 Register Value ,b4,b3,b2,b1 = 12345678 :get bl,0,0,0 :get 0,0,0,b4 :get b4,b3,b2,0 Current 02 03 04 05 06 07 08 09 10 RO R1 R2 R3 R4 0x78345612 0x78000000 0x00000012 :get bl,b3,b2,0 :get bl,b3,b2,b4 R6 R7 R8 R9 R10 R11 R12 R13 (SP) 0x00000000 R14 (LR)0x00000000 12 13 end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!