
ARM Instruction Set - LDR, STR
ARM7TDMI Data Sheet
ARM DDI 0029E
4-35
O
Figure 4-17: Halfword and signed data transfer with immediate offset
4.10.1 Offsets and auto-indexing
The offset from the base may be either a 8-bit unsigned binary immediate value in the
instruction, or a second register. The 8-bit offset is formed by concatenating bits 11 to
8 and bits 3 to 0 of the instruction word, such that bit 11 becomes the MSB and bit 0
becomes the LSB. The offset may be added to (U=1) or subtracted from (U=0) the
base register Rn. The offset modification may be performed either before (pre-
indexed, P=1) or after (post-indexed, P=0) the base register is used as the transfer
address.
The W bit gives optional auto-increment and decrement addressing modes. The
modified base value may be written back into the base (W=1), or the old base may be
kept (W=0). In the case of post-indexed addressing, the write back bit is redundant and
is always set to zero, since the old base value can be retained if necessary by setting
the offset to zero. Therefore post-indexed data transfers always write back the
modified base.
The Write-back bit should not be set high (W=1) when post-indexed addressing is
selected.
Cond
0 0 0 P U 1 W L
Rn
Rd
Offset
0
3
4
7
8
11
12
15
16
19
20
21
22
27
28
31
Immediate Offset
(Low nibble)
Base register
Load/Store
S H
Source/Destination
register
00 = SWP instruction
01 = Unsigned halfwords
10 = Signed byte
11 = Signed halfwords
Immediate Offset
(High nibble)
0 = store to memory
1 = load from memory
Write-back
1 S H 1
0 = no write-back
1 = write address into base
0 = down: subtract offset from
base
1 = up: add offset to base
Up/Down
0 = post: add/subtract offset
after transfer
1 = pre: add/subtract offset
before transfer
Pre/Post indexing
Condition field
23
24
25
5
6
Offset