I haven’t studied assemblers in seriousness so I’m not up on all the mark-ups and complications. Maybe there is something that will solve this problem, I don’t know:
Why is that when I write a function in ARM assembler in my Makecode extension, it will not allow me to have multiple return points from a subroutine? Below is a reduced version of something I’ve got.
Why do I have to jump to the exit point using the b. return
rather than just doing a pop {r4, pc}
wherever I want? Why should it matter if there multiple exit points from a subroutine?
myRoutine:
push {r4, lr}
bl someOtherSubroutine
adds r4, r4, r0
beq .zero
.true:
ldrb r3, [r4, r1]
orrs r3, r2
strb r3, [r4, r1]
subs r1, #1
bpl .true
b .return ; <<<<< this is an exit point, so why can't I pop {r4, pc} here?
.zero:
ldrb r3, [r4, r1]
bics r3, r2
strb r3, [r4, r1]
subs r1, #1
bpl .zero
.return:
pop {r4,pc} ;<<<< the pop command exits the subroutine