Motorola SC140 user manual Following output should be displayed

Page 25

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

Image 25
Contents Motorola Typical development process is represented in Figure Compiler Hands On File I/O ExerciseGood To Know Interpretation of 16-bit Integer and Fractional Data Values Integer and Fractional Arithmetic ExerciseInteger Arithmetic Compiler Support on StarCoreFractional Arithmetic Good To Know Local Optimization Local Versus Global Optimization ExerciseCompiler Support on StarCore StarCore C Compiler Global Optimization Local OptimizationMemory Alignment Exercise AA BB CC DD First Code Section Second Code Section Split Summation Exercise Code Generated Assembly Code = ∑ a i x n For 0 ≤ n L Multi-Sample ExerciseIntermediate Version Compromise Between Memory and Speed Further Speed Optimization Control Code The True Bit Exercise Save Ex7.c as Ex71.c Calling an Assembly Routine From C Exercise Current Following output should be displayed Challenge Introduction to the SC140 Tools Solutions to ExercisesAligned ExerciseExpected Motorola INC Intermediate version Compromise between Memory and Speed Compiler Support on StarCore Further Optimizing the Speed Compiler Support on StarCore Compiler Support on StarCore Motorola INC Zoffset equ Moffset equ Exercise Compiler Support on StarCore Compiler Support on StarCore AN2009/D