IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
77
3.2.7
Program Control Instructions
A program control instruction alters the flow of the program by
changing the contents of the program counter. Included in this
category are the jump, call, return-from-subroutine, and interrupt
instructions.
The jmp instruction has a single operand that specifies the entry
point at which to continue execution. The entry point is typically
specified in assembly language with a label, as in the following
code example.
If the carry bit is set to 1, the jmp instruction is executed and
program execution continues where the do_carry label
appears in the program.
The call instruction works in a similar manner, except that it
saves the contents of the program counter before jumping to the
new address. It calls a subroutine that is terminated by a ret
instruction, as shown in the following code example.
snb
status,0
;test the carry bit
jmp
do_carry
;jump to do_carry routine if C = 1
...
do_carry:
;jump destination label
...
;execution continues here