So I am currently learning ARM assembly (and absolutely LOVE IT!) doing a school assignment where we use subroutines to calculate a particular value. I know school questions are frowned upon, but I have tried everything in my (very limited) ARM toolbox to get this program to work.
The one issue I am having is that my program kept going back too far from coming back from a branch statement and overwriting a value in a register that I was about to use. However, the weird thing is it keeps going back to the same MOV
statement, no matter what I do. I can put a few dummy MOV
statements after that MOV
and before the entry for the branch and it will go right back up to that top MOV
statement, and process everything below it.
Desperately, I used the command "MOV lr, pc
" to "force" the link register to update right after that mysterious MOV
statement before the branch, and lo-and-behold, it worked! However, this feels hack-y, as it is very static, similar to hard coding an array size or something like that.
But I am not really sure how else to fix it, if this isn't accepted in industry or I cannot argue it as valid for ARM7 (big endian), then I will probably post my code looking for help. So, is this normal or should I look elsewhere? I would like to avoid that if possible however, the assignment isn't due until later this week.
Thanks in advance!