The following contents of registers and memory should be use
The following contents of registers and memory should be used in the solution of homework problems. Specify addressing modes for each operand. the contents is the same prior to all instructions.
Assume the memory/register contents shown in the table above at the start of each instruction. In your answer provide modified memory location or register and its content.
1. mov W2, 0x1004
2. mov.b WREG, 0x1005
3. mov #0x1005, WREG
4. mov.b 0x1005,WREG
5. mov[W3],W3
6. add W0, [W0], W1
7. dec 0x1006, WREG
8. inc2 0x1002
9. sub [W0], W1, W0
10. Write a PIC24 instruction sequence that computes k=j+i-33 where i,j, and k are uint16 variables. Allocate these variables as follows: i is at memory location 0x1000, j is at memory location 0x1002 and k is at memory location 0x1004.
| Register | Value | Memory Location | Value |
| W0 | 0x1006 | 0x1002 | 0xBEEF |
| W1 | 0xABBA | 0x1000 | 0xFB80 |
| W2 | 0xACDC | 0x1004 | 0x8BAD |
| W3 | 0x1002 | 0x1006 | 0xE7C0 |
| W4 | 0x1003 | 0x1008 | 0x4F00 |
Solution
1. mov W2, 0x1004 : The value of W2 is transfered to memory location 0x1004 so value of 0x1004 becomes 0xACDC
2. mov.b WREG, 0x1005 : This command will copy LBS of W0 and will replace in memory location 0x1005 so value of 0x1004\'s row will be 0x06|0xAD
3. mov #0x1005, WREG : Data from 0x1005 will be transfed to W0 and value of W0 will become 0x1005
4. mov.b 0x1005,WREG : will copy 06 to W0
