b LABEL
|
in cause the CPU to "branch" to the program instruction stored at the label LABEL
|
This will happen when we update the Program Counter in the CPU with the address value of LABEL !!!
|
Because the Program Counter is set equal to the address LABEL, the next instruction execution cycle (see: click here) will fetch the next instruction at the memory address LABEL !!!
Here is a program that shows that you cab branch with a mov instruction:
main:
movw r0, #:lower16:there
movt r0, #:upper16:there // r0 = addr(there)
mov pc, r0 // pc = addr(there)
// The CPU will branch to "there" !!!
mov r1, #4444 // These instructions are SKIPPED over !
mov r2, #4444
mov r3, #4444
there:
mov r4, #4444
mov r5, #4444
mov r6, #4444
|
How to run the program:
|