I'm trying to create a factorial method using THUMB instructions, and I'm basically there.
I just have one question about the PUSH/POP opcodes: if I stored the value of r0 in the stack using push (so push {r0}), can I later use pop {r1} to pull it out or do I need to specify the same register as it was in to begin with? Thanks for your help.
Yes, you can since push/pop actually expand to store/load multiple, which are generic instructions operating on registers and memory, so
push {r0}
is equivalent to
stmdb sp!, {r0} @ or stmfd sp!, {r0} in alt notation
and
pop {r1}
is the same as
ldmia sp!, {r1} @ or ldmfd sp!, {r1}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With