Blah
Free supporter
- 1,924
- Posts
- 12
- Years
- Unknown Island
- Seen Feb 19, 2025
Thank you very much! :)
I'd just need some clarifications: everytime I call a function, I have to load it into rX register, then use "bl *label*" and put "bx rX" in that label? The function is executed after that last line, correct? And does it automatically put the value stored in LR into PC at the end of the function?
About flags, they all can be accessed by 0xXXX then?
Sorry for bothering.
EDIT
I found these lines in a code
In this case, after executing the function it all ends because I haven't stored PC (or LR?) with bl?
ugh, I hate that way of doing it. You have the bx command taking up 2 bytes every time you needed to jump if you do the way which you've quoted. It's not anymore efficient, and not any more readable either, it just wastes space. Only hipsters use it.
Did you read my explanation for how the bl and bx work together to create the longer jump range while allowing the return? The answer to your question was there in that explanation. Anyways,
Yeah that's the best way when you can't just use a bl.everytime I call a function, I have to load it into rX register, then use "bl *label*" and put "bx rX" in that label?
I don't understand the question, but basically LR = PC when bl is used. So actually when the called function returns via pop pc or bx lr or something, then you go to the line after that "bl".The function is executed after that last line, correct? And does it automatically put the value stored in LR into PC at the end of the function?