EasyManuals Logo

Texas Instruments C28 Series Student Guide

Texas Instruments C28 Series
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #340 background imageLoading...
Page #340 background image
OPTIONAL Lab D2: C Callable Assembly
Verify C Sum of Products Routine
6. Debug using both source and assembly (by right clicking on the window and select
Mixed Mode or using View Mixed Source/ASM).
7. Open a memory window to view result and data.
8. Single-step through the C code to verify that the C sum-of-products routine produces the
results as your assembly version.
Viewing Interlisted Files and Creating Assembly File
9. Using File Open view the LabD2.asm and sop-c.asm generated files. The
compiler adds many items to the generated assembly file, most are not needed in the C-
callable assembly file. Some of the unneeded items are .func / .endfunc. .sym, and .line.
10. Look for the _sop function that is generated by the compiler. This code is the basis for
the C-callable assembly routine that is developed in this lab. Notice the comments
generated by the compiler on which registers are used for passing parameters. Also,
notice the C code is kept as comments in the interlisted file.
11. Create a new file (File New, or clicking on the left most button on the horizontal
toolbar “New”) and save it as an assembly source file with the name sop-asm.asm.
Next copy ONLY the sum of products function from LabC.asm into this file. Add a
_sop label to the function and make it visible to the linker (.def). Also, be sure to add a
.sect directive to place this code in the “code” section. Finally, add the following
instruction to the end:
LRETR ; return statement
12. Next, we need to add code to initialize the sum-of-products parameters properly, based
on the passed parameters. Add the following code to the first few lines after entering the
_sop routine: (Note that the two pointers are passed in AR4 and AR5, but one needs to
be placed in AR7. The loop counter is the third argument, and it is passed in the
accumulator.)
MOVL XAR7,XAR5 ;XAR7 points to coeff [0]
MOV AR5,AL ;move n from ACC to AR5 (loop counter)
SUBB XAR5,#1 ;subtract 1 to make loop counter = n-1
Before beginning the MAC loop, add statements to set the sign extension mode, set the
SPM to zero, and a ZAPA instruction. Use the same MAC statement as in Lab 4, but use
XAR4 in place of XAR2. Make the repeat statement use the passed value of n-1 (i.e.
AR5).
RPT AR5 ;repeat next instruction AR5 times
D- 18 C28x – C Programming

Table of Contents

Other manuals for Texas Instruments C28 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments C28 Series and is the answer not in the manual?

Texas Instruments C28 Series Specifications

General IconGeneral
BrandTexas Instruments
ModelC28 Series
CategoryComputer Hardware
LanguageEnglish

Related product manuals