## GOSUB

PURPOSE:
To transfer program execution to a subroutine while saving the memory address of the statement following the GOSUB on the run time stack.

    STATEMENT SYNTAX:
    stno GOSUB stno

    EXAMPLE:
    100 GOSUB 8000
    200 GOSUB MYSUB

NOTES:
A subroutine is a series of SM-32 program statements which may be called by a GOSUB command from any point in the program. The subroutine itself may contain any valid SM-32 command and may contain any number of statements. The subroutine has access to all the same variables as the caller. If local variables as required use the CALL by line# command.
When the GOSUB command is executed, the memory address of the next statement is saved on the run time stack. When subroutine processing is completed (via the RETURN command), the run time stack is accessed to obtain and remove this statement address from the run time stack.
See the EXITTO command for abnormal exit from a subroutine.