At the beginning of the program, the ARM pseudo-instruction
ADR R14, cnt1 loads an address (
cnt1 - end of this part of the program) into a register (
R14). In practice,
ADR is replaced by an
SUB instruction involving the contents of the PC (
R15). The calculation is based on the offset between the PC and the address in question - taking into account that the PC displacement due to the operation of ARM pipeline. It's easier let the assembler calculate the addresses for you. If the code is changed, the addresses as well, but
ADR will take care of this when reassembled.
B sumi is just an unconditional jump to the address given by
sumi (start of the subroutine).
At the end of the loop, the
MOV PC,R14 instruction is executed, causing the PC to be loaded with the content (an address) of
R14 register - remember that the latter was previously modified by the
ADR instruction. So the program continues jumping to the address given by the label
When programming subroutines in Assembly, usually a combination of the
BL jump instructions is employed - the latter (branch and link) already stores the return address into
R14 (LR - link register).