16-bit signed index
CPU Register Rn
16-bit signed add
0
Memory address
FFFFF
00000
Lower 64KB
0FFFF
10000
Rn.19:0
Lower 64KB
Rn.19:16 = 0
16-bit byte index
0
19 16 15
0
S
Addressing Modes
124
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
CPUX
4.4.2 Indexed Mode
The indexed mode calculates the address of the operand by adding the signed index to a CPU register.
The Indexed mode has 4 addressing possibilities:
•
MSP430 instruction with indexed mode in lower 64KB memory (see
•
MSP430 instruction with indexed mode addressing memory above the lower 64KB memory (see
•
MSP430X instruction with indexed mode (see
•
MSP430X address instructions with indexed mode (see
4.4.2.1
MSP430 Instruction With Indexed Mode in Lower 64KB Memory
If the CPU register Rn points to an address in the lower 64KB of the memory range, the calculated
memory address bits 19:16 are cleared after the addition of the CPU register Rn and the signed 16-bit
index. This means the calculated memory address is always located in the lower 64KB and does not
overflow or underflow out of the lower 64KB memory space. The RAM and the peripheral registers can be
accessed this way and existing MSP430 software is usable without modifications as shown in
.
Figure 4-15. Indexed Mode in Lower 64KB
Length:
2 or 3 words
Operation:
The signed 16-bit index is located in the next word after the instruction and is added to
the CPU register Rn. The resulting bits 19:16 are cleared giving a truncated 16-bit
memory address, which points to an operand address in the range 00000h to 0FFFFh.
The operand is the content of the addressed memory location.
Comment:
Valid for source and destination. The assembler calculates the register index and inserts
it.
Example:
ADD.B 1000h(R5),0F000h(R6);
This instruction adds the 8-bit data contained in source byte 1000h(R5) and the
destination byte 0F000h(R6) and places the result into the destination byte. Source and
destination bytes are both located in the lower 64KB due to the cleared bits 19:16 of
registers R5 and R6.
Source:
The byte pointed to by R5 + 1000h results in address 1000h = 0579Ch after
truncation to a 16-bit address.
Destination:
The byte pointed to by R6 + F000h results in address F000h = 00778h after
truncation to a 16-bit address.