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