ARM Instruction Set - LDM, STM
ARM7TDMI Data Sheet
ARM DDI 0029E
4-40
O
4.11 Block Data Transfer (LDM, STM)
The instruction is only executed if the condition is true. The various conditions are
defined in
·
Table 4-2: Condition code summary
on page 4-5. The instruction encoding
is shown in
·
Figure 4-18: Block data transfer instructions
.
Block data transfer instructions are used to load (LDM) or store (STM) any subset of
the currently visible registers. They support all possible stacking modes, maintaining
full or empty stacks which can grow up or down memory, and are very efficient
instructions for saving or restoring context, or for moving large blocks of data around
main memory.
4.11.1 The register list
The instruction can cause the transfer of any registers in the current bank (and
non-user mode programs can also transfer to and from the user bank, see below). The
register list is a 16 bit field in the instruction, with each bit corresponding to a register.
A 1 in bit 0 of the register field will cause R0 to be transferred, a 0 will cause it not to
be transferred; similarly bit 1 controls the transfer of R1, and so on.
Any subset of the registers, or all the registers, may be specified. The only restriction
is that the register list should not be empty.
Whenever R15 is stored to memory the stored value is the address of the STM
instruction plus 12.
Figure 4-18: Block data transfer instructions
Cond
Rn
0
15
16
19
20
21
24
25
27
28
31
P U
W L
22
23
100
S
Register list
Base register
Load/Store bit
1 = Load from memory
Write-back bit
1 = write address into base
PSR & force user bit
1 = load PSR or force user mode
Up/Down bit
1 = up; add offset to base
Pre/Post indexing bit
1 = pre; add offset before transfer
Condition field