The following four examples show where registers are placed in memory.
Memory address increases down the table.
STMxx sp!,{R1,R2,R3} results in:
xx= FD ED FA EA memory + 4N
xx= DB DA IB IA N
--------------------------------------
R1* * -3
R2 R1 -2
R3 R2 -1
------- R3 ----------- R1 0 <- Initial sp
R1 R2 1
R2 R3 2
R3* * 3
--------------------------------------
* shows where stack pointer (sp) points after operation.
Note that registers are stored in the same order whatever the STM suffix.
Complementary pairs:
(STMFD with LDMFD) also same as (STMDB with LDMIA)
(STMED with LDMED) also same as (STMDA with LDMIB)
(STMFA with LDMFA) also same as (STMIB with LDMDA)
(STMEA with LDMEA) also same as (STMIA with LDMDB)
|
|
|