Total beginner here. I'm trying to keep a running total of R5 but it keeps resetting back to the original value I had it set to. R3 is keeping up but R5 won't
This is the part of the problem I am working on.
lessThan
CMP R3, R4
ADD R5, R3, R3
RSB R5, R5, #60
ADDLE R3, R3, #1
ADD R5, R5, #6
ADD R5, R5, R4
BLE lessThan
I am ending up with my R5 being (in decimal) 48 when it's actually supposed to be 780.
ADD R5, R3, R3
sets r5 = r3*2
, throwing away the old value of R5 inside every loop iteration.
Did you mean add r5, r5, r3
to do r5 += r3
? Or did you need a scratch register?
IDK what you want your code to do, or why, but the my first paragraph is the answer to why R5
isn't accumulating a separate total.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.