Why is STMFD equivalent to STMDB?

Hi,

I read the following ARM code on line. I do not understand why it said that : STMFD is equivalent to STMDB.

Could you explain it to me?

Thanks,

Function entry: STMFD sp!, {r4-r6,lr} ? ?Store Multiple Full-Descending? ? Equivalent to STMDB (decrement before) ? sp: store to stack ? !: update stack pointer ? {r4-r6,lr}: Stores r4, r5, r6, r14 (lr)

Reply to
Robert Willy
Loading thread data ...

They're just equivalent ways of writing the same thing. If you have a stack which extends downwards as it grows, and the stack pointer points to the last valid element (a 'Full Descending' stack) rather than the next (Empty) gap, to store something you have to first decrement the stack pointer to get the next location to store at - you Decrement Before.

If you're using stacks it's easier to pair up the instructions using stack notation:

STMFD = STMDB (decrement before) = push LDMFD = LDMIA (increment after) = pop

While if you're copying data you probably want to stick to LDMIA/STMIA or some similar pair.

Theo

Reply to
Theo Markettos

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.