;=================================== ; Complete the two exercises below. ;=================================== area reverseBytes, code, readonly entry ; Example. ; This first part will move byte 1 to byte 3 within the register, ; clearing bytes 0 to 2. Remember: ; ; ------------------------------------- ; | byte 0 | byte 1 | byte 2 | byte 3 | ; ------------------------------------- ldr r0, =0x01234567 mov r0, r0, lsr #16 and r0, r0, #0xff ; ============ ; Exercise 1: ; ============ ; Add assembly following this ldr to move byte 0 to byte 3 within ; the register, clearing bytes 0 to 2. ldr r0, =0x01234567 ; ============ ; Exercise 2: ; ============ ; The following code should reverse the bytes within the register. ; The code below swaps bytes 0 and 3. Add code to complete the ; reversal by swapping bytes 1 and 2. Your code should leave bytes ; 0 and 3 as is, and should work regardless of the initial value placed ; in r0. ldr r0, =0x89abcdef mov r1, r0, lsr #24 mov r2, r0, lsl #24 ldr r3, =0x00ffff00 and r0, r0, r3 orr r0, r0, r1 orr r0, r0, r2 s b s end