3. Instructions
688
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Function
SBS(091) calls the subroutine with the
specified subroutine number. The
subroutine is the program section
between SBN(092) and RET(093). When
the subroutine is completed, program
execution continues with the next
instruction after SBS(091).
A subroutine can be called more than
once in a program.
Subroutines can be nested up to 16
levels. Nesting is when another
subroutine is called from within a
subroutine program, such as shown in the
following example, which is nested to 3
levels.
Subroutine
program
(SBN(092) to
RET(093))
Main program
Execution condition ON
Program end
SBN 10
to
to
to
to
to
SBN 11
RET
SBN 11
SBS 12
RET
RET
SBN 12
Execution condition ON
Main program
Execution condition ON
Subroutine
program n
Two-level
nesting
Subroutine
program m
Program end