!
127
SBS(91) may be used as many times as desired in the program (i.e., the
same subroutine may be called from different places in the program).
SBS(91) may also be placed into a subroutine to shift program execution
from one subroutine to another, i.e., subroutines may be nested. When the
second subroutine has been completed (i.e., RET(93) has been reached),
the first subroutine is returned to and completed before returning to the main
program. Nesting is possible to up to eight levels. A subroutine cannot call
itself, e.g., SBS(91) 00 cannot be programmed within the subroutine defined
with SBN(92).
The following diagram illustrates program execution flow for various execu-
tion conditions for two SBS(91). In actual execution, the PC actually executes
a sequential program, with the subroutines inserted in at the required loca-
tions.
SBS(91) 00
SBS(91) 01
SBN(92) 00
RET(93)
SBN(92) 01
RET
END(01)
Main
program
Subroutines
A
B
C
D
E
A
A
A
A
B
B
B
B
C
C
C
C
D
D
E
E
OFF execution conditions for 00 and 01
ON execution condition for 00
ON execution condition for 01
ON execution conditions for 00 and 01
ER: A subroutine does not exist for the specified subroutine number.
A subroutine has called itself.
Subroutines have been nested to more than eight levels.
Caution SBS(91) will not be executed and the subroutine will not be called when ER is
ON.
Flags
Subroutines Section 5-17