OPTIONAL Lab D2: C Callable Assembly
Now we need to return the result. To return a value to the calling routine you will need to
place your 32-bit value in the ACC. What register is the result currently in? Adjust your
code, if necessary.
13. Save the assembly file as sop-asm.asm. (Do not name it LabD2.asm because the
compiler has already created with that name from the original LabD2.c code).
Defining the Function Prototype as External
14. Note in LabD2.c an “extern” modifier is placed in front of the sum-of-products function
prototype:
extern int sop(int*,int*,int); //sop function prototype
Verify Assembly Sum of Products Routine
15. Remove the sop-c.c file from the project and add the new sop-asm.asm assembly
file to the project.
16. Rebuild and verify that the new assembly sum-of-products routine produces the same
results as the C function.
End of Exercise
C28x – C Programming D - 19