![background image](http://html1.mh-extra.com/html/texas-instruments/tms320c28x/tms320c28x_reference-manual_1097071622.webp)
Mixing C2xLP and C28x Assembly
D.3 Mixing C2xLP and C28x Assembly
At this point your original C2xLP code will be running on the C28x device. To facilitate further migra-
tion to C28x code, there are special assembler directives that will facilitate mixing of C2xLP code
and C28x code segments.
The .c28_amode and .lp_amode directives tell the assembler to override the
assembler mode.
.c28_amode
The .c28_amode directive tells the assembler to operate in the C28x object
mode (
−
v28).
.lp_amode
The .lp_amode directive tells the assembler to operate in C28x object
−
ac-
cept C2xLP syntax mode (
−
m20).
These directives can be repeated throughout a source file.
For example, if a file is assembled with the
−
m20 option, the assembler begins
the assembly in the C28x object
−
accept C2xLP syntax mode. When it en-
counters the .c28_amode directive, it changes the mode to C28x object mode
and remains in that mode until it encounters an .lp_amode directive or the end
of file.
Example
In this example, C28x code is inserted in the existing C2xLP code.
; C2xLP source code
.lp_amode
LDP
#VarA
LACL VarA
LAR AR0 *+, AR2
SACL *+
.
.
CALL FuncA
.
.
; The C2xLP code in function FuncA is replaced with C28x Code
; using C28x addressing (AMODE = 0)
.c28_amode ; Override the assembler mode to C28x syntax
FuncA:
C28ADDR
; Set AMODE to 0 C28x addressing
MOV
DP, #VarB
MOV
AL, @VarB
MOVL
XAR0, *XAR0++
MOV
*XAR2++, AL
.lp_amode
; Change back the assembler mode to C2xLP.
LPADDR
; Set AMODE to 1 to resume C2xLP addressing.
LRET
Summary of Contents for TMS320C28x
Page 30: ...1 12...
Page 80: ...This page intentionally left blank 2 50 This page intentionally left blank...
Page 269: ...IN loc16 PA 6 112 MOV AL 0 AL 0 UOUT IORegC AL IOspace IORegC AL 10...
Page 308: ...MAXCUL P loc32 6 151 Saturate MOVL Var64 2 ACC Store result into Var64 MOVL Var64 P...
Page 509: ...SUBL ACC P PM 6 352 SUBL ACC P PM ACC S B 11 M X 4 MOVH Y ACC 5 Store Q15 result into Y...
Page 585: ...This page intentionally left blank 7 32 This page intentionally left blank...