Direct Addressing Modes (DP)
5-8
5.4 Direct Addressing Modes (DP)
AMODE ”loc16/loc32” Syntax Description
0 @6bit 32bitDataAddr(31:22) = 0
32bitDataAddr(21:6) = DP(15:0)
32bitDataAddr(5:0) = 6bit
Note: The 6-bit offset value is concatenated with the 16-bit DP register. The
offset value enables 0 to 63 words to be addressed relative to the cur-
rent DP register value.
Example(s):
MOVW DP,#VarA ; Load DP pointer with page value containing VarA
ADD AL,@VarA ; Add memory location VarA to register AL
MOV @VarB,AL ; Store AL into memory location VarB
; VarB is located in the same 64−word page as VarA
MOVW DP,#VarC ; Load DP pointer with page value containing VarC
SUB AL,@VarC ; Subtract memory location VarC from register AL
MOV @VarD,AL ; Store AL into memory location VarD
; VarC is located in the same 64−word page as VarD
; VarC & D are in different pages than VarA & B
AMODE ”loc16/loc32” Syntax Description
1 @@7bit 32bitDataAddr(31:22) = 0
32bitDataAddr(21:7) = DP(15:1)
32bitDataAddr(6:0) = 7bit
Note: The 7-bit offset value is concatenated with the upper 15-bits of the DP
register. Bit 0 of DP register is ignored and is not affected by the op-
eration. The offset value enables 0 to 127 words to be addressed rela-
tive to the current DP register value.
Example(s):
SETC AMODE ; Make sure AMODE = 1
.lp_amode ; Tell assembler that AMODE = 1
MOVW DP,#VarA ; Load DP pointer with page value containing VarA
ADD AL,@@VarA ; Add memory location VarA to register AL
MOV @@VarB,AL ; Store AL into memory location VarB
; VarB is located in the same 128−word page as VarA
MOVW DP,#VarC ; Load DP pointer with page value containing VarC
SUB AL,@@VarC ; Subtract memory location VarC from register AL
MOV @@VarD,AL ; Store AL into memory location VarD
; VarC is located in the same 128−word page as VarD
; VarC & D are in different pages than VarA & B
Note: The direct addressing mode can access only the lower 4M of data address space on the C28x device.