
PM94P01C90
Reference
Table 36: GOSUB
GOSUB Go To subroutine Statement
Purpose
GOSUB transfers control to subroutine.
Syntax
GOSUB <subname>
<subname> a valid subroutine name
Remarks
After return from subroutine program resumes from next statement after GOSUB
See Also
GOTO, JUMP, RETURN
Example:
DO
GOSUB CALCMOVE ;Go to CALCMOVE Subroutine
MOVED V1 ;Move distance calculated in Subroutine
UNTIL INA1
END
SUB CALCMOVE:
V1=(V2+V3)/2 ;Subroutine statement, Calculates value for V1
RETURN ;Return to main program execution
Table 37: GOTO
GOTO Go To Statement
Purpose
Transfer program execution to label following the GOTO instruction.
Syntax
GOTO <label>
Remarks
See Also
GOSUB, JUMP
Example:
GOTO Label2
{Statements…}
Label2:
{Statements…}
Table 38: HALT
HALT Halt the program execution Statement
Purpose
Used to halt main program execution. Events are not halted by the HALT statement. Execution will be
resumed by the RESET statement or by executing a JUMP to code from the EVENT handler.
Syntax
HALT
Remarks
This statement is convenient when writing event driven programs.
See Also
RESET
Example:
{Statements…}
HALT ;halt main program execution and wait for event
Comentarios a estos manuales