IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
121
Example:
page 0x600 ;set page bits
call addxy ;call subroutine addxy
nop ;addxy results
;available here
...
addxy: ;subroutine address label
mov w,#0F ;subroutine begins
add w,0x099
...
ret ;return from subroutine
The call instruction in this example calls a
subroutine called addxy. When the call
instruction is executed, the address of the
following instruction (the nop instruction) is
pushed onto the stack and the program jumps to
the addxy routine. When the ret instruction is
executed, the 16-bit program address saved on
the stack is popped and restored to the program
counter, which causes the program to continue
with the instruction immediately following the
call instruction.