views:

102

answers:

2

dose anyone have clue how to work on this :::::

Given the the following piece of a code, write the corresponding bit storage (in hex) at the memory location starting at $8000

Source line

School    MOVEM.L    D6/A3-A6,-(SP)
          ADD.W   D2,D
          BVS  School
+3  A: 

First, what are the initial values in the registers? Write them down on a piece of paper.

D0 = 
D1 = 
...
D7 = 
A0 = 
A1 = 
...
A7 (SP) =

Second, what is the initial values in memory? Write that down in the piece of paper.

Now, on the piece of paper, write down the state change that happens for each statement. What register gets updated? What happens in memory?

S.Lott
I think the question is asking the student to hand-assemble the code, not hand-execute it. I'm also assuming there's a typo, and the add instruction is supposed to be ADD.W D2, D6, so the loop will copy stuff onto the stack until D6 crosses a 64K boundary.
TMN
Only if the memory location starting at $8000 is the target location for the instruction labeled `school`. It seems more like this is a hand-execution issue, since $8000 is more likely the initial content of A6.
S.Lott
+1  A: 

ADD.W D2, D is not a valid instruction.

It looks like the code will loop if the ADD.W instruction causes an overflow. This happens when the value in the destination register (D) reaches the limit of its capacity and changes from positive to negative or vice-versa (for instance from 32767 to -32768 due to adding 1). The contents of the memory will depend on the contents of the registers on entry to the routine.

Russ Hayward