AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
As the ARM stores or loads registers, it modifies the address being used. This ensures that the next register processed is stored or loaded in a consecutive word of memory, so that one word is not used twice. If we specify that we want write back, then the final address, obtained after storing or loading all the registers in the list, will be written back into the base register.

Write back is selected, as with STR and LDR, by including a '!' character. Thus, the following instructions all have write back selected:
STMIA     R0!,{R1,R2}
STMDA     basereg!,{R4,R5-R9}
LDMIB     R6!,{R12,R11,R10}
NB: Note, in BASIC you would have to use brackets around the basereg if this were a variable used to refer a register. This prevents the assembler interpreting the '!' as an indirection operator and causing an error.

After each instruction, the ARM performs one of the following depending on the direction of storage used:
base = base + 4*n     (increment)
base = base - 4*n     (decrement)
Where 'n' is the number of registers stored by the instruction. Write back is provided so as to provide support the creation of stacks using the LDM / STM instructions.

[sh-index] Back to list of manuals