The Load and Store Multiple addressing mode is divided into 4 submodes. Load instructions load subsets or even all the general purpose registers specified by reg from memory. Store instructions store subsets or even all the general purpose registers specified by reg to memory. Addresses produced by this addressing mode are sequential; hence registers specified by reg are loaded in ascending order from the lowest to the highest memory address. The general syntax of the addressing mode is provided in the following section.
LDM|STM [condition] addr_mode basereg[!], reg {,reg}
where:
|
condition |
One of 16 conditions. See Condition Code Status. |
|
basereg |
Base register used by addr_mode . |
|
! |
Sets the W bit (21). |
|
reg |
Valid register(s) to be loaded. |
addr_mode can be one of the following 4 submodes:
|
Submodes |
Description |
|---|---|
|
IA |
Increment after. |
|
IB |
Increment before. |
|
DA |
Decrement after. |
|
DB |
Decrement before. |
The following table illustrates the encoding for this addressing mode:
|
31 |
|
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
|
16 |
15 |
|
0 |
|
condition |
|
|
1 |
0 |
0 |
P |
U |
S |
W |
L |
basereg |
|
|
reglist |
|
|
where:
|
Bit[24] |
Is the P bit. See below. |
|
Bit[23] |
Is the U bit. |
|
Bit[22] |
Is the S bit. |
|
Bit[21] |
Is the W bit. |
|
Bit[20] |
Is the L bit. |
|
Bits[15:0] |
reglist has one bit dedicated to each register; bit[0] denotes R0 , bit[15] denotes R15 ( PC ). At least one bit must be set. |
The meaning of the P bit (bit[24]) depends on the setting of the U bit:
|
|
U==0 |
U==1 |
|
P==0 |
The address contained in basereg is one word beyond the top of the range. |
The address contained in basereg is one word below the bottom of the range. |
|
P==1 |
The address contained in basereg is accessed at the bottom of the range. |
The address contained in basereg is accessed at the top (U == 1) of the range. |
The IA, IB, DA and DB addressing modes are most useful for
block transfers, particularly when the Load and Store Multiple instructions
have used the addressing mode, as the data is loaded in the same way as
it was stored.
When Load and Store Multiple instructions are used to access the stack,
different addressing modes are required as pop and push operations adjust
the stack in opposite directions.
An alternative syntax is available for stack operations:
|
Stack |
Syntax |
Description |
|---|---|---|
|
Empty Ascending |
EA |
Stack pointer points to the first unused location and grows towards increasing memory locations. |
|
Full Ascending |
FA |
Stack pointer points to the last used location and grows towards increasing memory locations. |
|
Empty Descending |
ED |
Stack pointer points to the first unused location and grows towards decreasing memory locations. |
|
Full Descending |
FD |
Stack pointer points to the last used location and grows towards decreasing memory locations. |