Compiler Support on StarCore

SP

On function entry

4

4

4

2

SP 2

Prior to function call

Status Register

Return Address

&z[0]

M

}

}

Pushed on stack by jsr/bsr instruction

Parameters pushed onto stack prior to jsr/b

Figure 12. Stack Contents on Entry to advecs()

4. In the box provided here, write what you think the offsets should be:

Z_OFFSET

M_OFFSET

5.Modify the addvecs.asm file to incorporate your offset values.

6.Build the code.

7.Run the code: runsc100 Ex8.eld.

8.The following output should be displayed:

z = [3, 5, 7, 9, 11, 13, 15, 17] sum = 80

9.If the above output is displayed, your offset values are correct.

10.Rebuild the code, this time with the -Soption.

11.Open the generated assembly file Ex8.sl, and find the call to addvecs().

12.Find the instructions that put z[] and M onto the stack just prior to the function call. Write the offsets in the box provided here:

Z_OFFSET

M_OFFSET

Introduction to the SC140 Tools

25

Page 25
Image 25
Motorola SC140 user manual Following output should be displayed