Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please include what does the [ move.w 4(A7),D1 ] do with detailed explanation. 6

ID: 2292837 • Letter: P

Question

Please include what does the [ move.w 4(A7),D1 ] do with detailed explanation. 6. (20 pts) Determine the specific contents of registers DI, D2, D3, A7 and Memory when the 1 following program completes execution. (suggestion: use a pencil and erase old values, write in nevw values) ORG MOVEA.L #$FFA, A7 MOVE . W #18,-(A7 ) BSR MOVE.W (A7)+, D2 MOVE.W (A7), D3 BRA $1000 MEMORY 2 OFF2 OFF3 OFF4 OFF5 OFF6 OFF7FF OFF81) OFF9 12 MEGA DONE MEGA MOVE.W 4 (A7) ,D1 ASR MOVE. W RTS #1,D1 D1,6 (A7) DONE OFFB OFFC OFFD OFFE OFFF 1000 END $1000

Explanation / Answer

Answer :- ORG $1000 ;starts the program from memory address $1000 i.e. 0x1000, hexadecimal nummber.

Second line makes, A7 = $FFA.

Third line, at location ($FFA - $1) i.e. at memory address $FF9 value 18(decimal) is kept. So at($FF9) = $12. Also A7 = $FF9 now.

Fourth line i.e. BSR MEGA, jump the controller to label name MEGA. So now code will run from label name MEGA.

move.w 4(A7), D1 ; menas value at address (A7 + 4) is copied to register D1. So value at ($FF9 + $4) = $FFD will be copied to D1. Thus D1 = value present at address $FFD. Note here A7 value does not change, A7 = $FF9.

ASR #1, D1 ; will shift the value in D1 right by 1 bit and MSB of D1 will not change.

MOV.W D1, 6(A7) ;copy the value in D1 to the location ($FF9 + $6) = $FFF.

RTS ;return from subroutine, goto next instruction after "BSR MEGA" .

MOVE.W (A7)+, D2; copy the vaue from address $FF9 to D2, so D2 = $12. Then A7 = A7 + 1 = $FFA.

MOVE.W (A7), D3 ;so , value at $FFA is copied to register D3, D3 = value at $FFA.

BRA DONE ;goto label name DONE

END ;end of programme

NOTE :- Dear student, initial memory contents are missing in the question, you can fill the initial values in memory and follow the above steps to get the final memory and resgister values. If you find any problem or if you have any doubt, please feel free to ask in comment. Thank you.