LIS R1, #01 ; R1 = 1
LIS R2, #02 ; R2 = 2
LIL R3, #000003 ; (LIL is 2 halfwords)
; R3 = 3
MOVE R4, R1 ; R4 = R1 (R4 = 1)
ADDSI R4, #03 ; R4 = R4 + 3 (R4 = 1 + 3 = 4)
ADDI R5, R2, #0003 ; R5 = R2 + 3 (R5 = 2 + 3 = 5)
| R1 | 1 |
| R2 | 2 |
| R3 | 3 |
| R4 | 4 |
| R5 | 5 |
CONFUSE macro are:
| 0x0100 | 2 |
| 0x0104 | 1 |
| 0x0108 | 4 |
| 0x0112 | 3 |
CONFUSE saves the PC (initial memory location)
in the variable confuse. The the PC is incremented
(skips forward) by 1 word. A is stored in this memory
location. The PC then goes back to the initial memory location
that was saved in confuse. B is stored in
this memory location. (The PC is incremented by 1 word automatically
in the store as part of the fetch-execute cycle, so is at the location
where A was stored.) The PC is incremented by 1 word
so that it ends up at the memory location after A.