42
If zero is specified as the branch line number, it is assumed that the COM OFF
statement has been executed.
If the port number is omitted, port 1 is selected.
The ON COM GOTO statement is enabled with the COM ON statement and dis-
abled with the COM OFF statement.
Program Example:
10
OPEN #1, “COMU:(40)”
20
ON COM GOSUB 100
30
COM ON
40
PC READ “2I4”;A,B
50
PRINT A, B
60
GOTO 30
100
IF LOC (1)=0 THEN 120
110
PRINT INPUT$ (LOC(1),#1)
120
RETURN
Program Remarks:
If an interrupt from port 1 is detected, the buffer contents are displayed.
ON ERROR Statement
Purpose:
To enable error processing and to specify the first line number of
the error handling routine
Format:
ON ERROR GOTO <line>
<line> is any valid line number.
Remarks:
When an error occurs, this statement directs execution to the proper error handl-
ing routine. When an error is detected, the error number is assigned to the vari-
able ERR and the line number where the error occurred is assigned to ERL.
To disable error processing, execute ON ERROR GOTO 0. Subsequent errors
will cause an error message to be printed and execution to be halted.
If an error occurs during execution of an error handling subroutine, a BASIC er-
ror message will be printed and execution terminated.
Refer to the discussion of the RESUME Command, and the ERR and ERL func-
tions.
ON GOSUB and ON GOTO Statements
Purpose:
To branch to one of several specified line numbers, depending
on the resultant evaluation of a numeric or logical expression
Format:
ON <expression> GOTO <list>
ON <expression> GOSUB <list>
<expression> is any valid expression.
<list> is a list of valid line numbers separated by comas.
Example:
ON X–2 GOSUB 50,100,150
Remarks:
The value of <expression> determines which line number in the list will be used
for branching. For example, if the result is 2, then the second line number in the
list will be chosen for branching. If the resultant value is not an integer, the frac-
tional part is rounded off.
In the ON...GOSUB statement, each line number in the list must be the first line
number of a subroutine.
Commands, Statements, and Functions
Содержание C500-ASC04
Страница 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Страница 5: ...iv ...
Страница 7: ...vi ...