Commodore VIC-20 User Manual page 371

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

Appendix G: BASIC Statements
357
Availability Map (BAM) are initialized. The diskette is assigned the name
disk name and the number vv.
The diskette name and number are displayed in the reverse field at the
top of a directory display.
Example:
OPEN 1,9,15
Open the diskette command channel
ON·GOSUB
A diskette has beenpreparedjor use in
drive
O.
The diskette is given the
name NEWDATA and the number 02
The ON-GOSUB statement provides conditional subroutine calls to
one of several subroutines in a program, depending on the current value of a
variable.
Format:
ON byte GOSUB line,[,line
2 , ...
,line
n ]
ON-GOSUB has the same format as ON-GOTO. Refer to the ON-
GOTO statement description for branching rules. byte is evaluated and
truncated to an integer number, if necessary.
For byte=l, the subroutine beginning at line, is called. That subroutine
completes execution with a RETURN statement that causes program exe-
cution to continue at the statement immediately following ON-GOSUB.
If
byte=2, the subroutine beginning with line
2
is called, and so on.
ON-GOSUB is normally executed in program mode.
It
may be exe-
cuted in immediate mode as long as there are corresponding line numbers to
branch to in the current stored program.
Example:
10 ON A GOSUB 100,200,300
ON·GOTO
The ON -GOTO statement causes a conditional branch to one of several
points in a program, depending on the current value of a variable.
Format:
ON byte GOTO line,[,line
2 , ...
,line
n ]

Advertisement

Table of Contents
loading

Table of Contents