Commodore 64 User Manual page 132

Hide thumbs Also See for 64:
Table of Contents

Advertisement

NEXT may be followed by a variable name, or list of variable names,
separated by commas. If there are no names listed, the last loop started
is the one being completed. If variables are given, they are completed
in order from left to right.
10 FOR X = I TO 100: NEXT
ON
This command turns the GOTO and GOSUB commands into special
versions of the IF statement . ON is followed by a formula , which is
evaluated . If the result of the calculation is one, the first line on the list is
executed ; if the result is 2, the second line is executed , and so on. If the
result is 0, negative , or larger than the list of numbers, the next line
executed will be the statement following the ON statement.
10 INPUT X
20 ON X GOTO 10,20,30,40,50
OPEN
The OPEN statement allows the Commodore 64 to access devices such
as the cassette recorder and disk for data, a printer, or even the screen.
OPEN is followed by a number (0-255), to which all following statements
will refer. There is usually a second number after the first, which is the
device number.
The device numbers are:
0 Screen
1 Cassette
4 Printer
8 Disk
Following the device number may be a third number, separated
again by a comma, which is the secondary address. In the case of the
cassette, this is 0 for read, 1 for write, and 2 for write with end-of-tape
marker.
In the case of the disk, the number refers to the buffer, or channel,
number. In the printer, the secondary address controls features like ex-
panded printing. See the Commodore 64 Programmer's Reference Man-
ual for more details.
122

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Commodore 64

Table of Contents