The following contents of registers and memory should be used in the solution of
ID: 3786760 • Letter: T
Question
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 0x4F00Explanation / Answer
1.) mov W2, 0x1004
first operand is register while second is memory address so Direct Memory addressing mode.
2.) mov.b WREG, 0x1005
here the operation os done bit wise. WREG is for current register and next is also memory address so again Direct Memory addressing mode.
3.) mov #0x1005, WREG
moves the value 0x1005 into current register. Since one is immediate value , it is Immediate Addressing Mode.
4.) mov.b 0x1005,WREG
Bit wise move of data of memory location into current register.
It is again Immediate Addressing Mode.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.