Question: This 68000 program creates the following output from a compiler. The panel describes some of the instructions that are not obvious. *1 void adder (int
This 68000 program creates the following output from a compiler. The panel describes some of the instructions that are not obvious.
*1 void adder (int a, int *b)
Parameter a is at 8 (FP)
Parameter b is at 10 (FP)
adder
LINK FP, #0
*2 {
*3 *b = a + *b;
NOVEA.L 10 (FP) , A4
MOVE (A4) , D1
ADD 8 (FP) , D1
MOVE D1 , (A4)
*4 }
*5
*6 void main (void)
Variable x is at -2 (FP)
Variable y is at -4 (FP)
main
LINK FP , #-4
*7 {
*8 int x = 3, y = 4;
MOVE #3, -2 (FP)
MOVE #4, -4 (FP)
*9 adder (x, &y);
PEA -4 (FP)
MOVE #3, - (A7)
JSR adder
*10
*11 }
UNLK FP
RTS
Draw a sequence of memory maps showing what happens to the stack as function adder is executed. Explain the action of each instruction that modifies the state of the stack. Show how parameters are passed to and from the function and how stack-based values are accessed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
