Commodore VIC-20 User Manual page 136

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

Advertisement

OPEN
^
The OPEN statement allows the VIC to access devices such as the
(
cassette recorder and disk for data, a printer, or even the screen of
the VIC. The word OPEN is followed by a number, which is the
number to which all other BASIC statements will refer. This number is
from t to 255. There is usually a second number after the first,
separated by a comma. This is the device number, 0 for the VJC
screen, 1 for the cassette recorder, 4 for the printer, 8 for the disk. It is
a good idea to use 1he same reference number as the device number,
which makes it easy to remember which is which. Following the
second number may be a third number, separated again by a comma,
(
which is the secondary address. In the case of the cassette, this may
be 0 for read, 1 for write, and 2 for write with end-af-tape marker at the
(
end. In the case of the disk, the number refers to the buffer, or chan
nel, number. In the printer, the secondary addresses become different
(
types of commands. See the VIC Programmers' Reference Manual for
more on these. There may also be a string following the third number,
which would be a command to the disk drive or the name of the file
on tape.
EXAMPLE:
c
10 OPEN 1,0
OPENS the SCREEN as a device.
20 OPEN 2,1,0T"D"
OPENs the cassette for reading, file to be
searched for is named D.
30 OPEN 3,4
To use the printer.
40 OPEN 4,8,15
OPENs the data channel on the disk.
(
See also: CLOSE, CMD, GET#, INPUT*, and PRINT* statements,
system variable ST, and Appendix E.
c
POKE
,
The POKE command is always followed by two numbers, or formulas.
^
The first number is a location inside 1he VIC's memory. There could
be locations numbered trom 0 to over 65000. Some of these, like the
(
ones described in the chapters on sound and colors, can be used
easily in your programs. Some, however, are used by the VIC itself,
to keep track of your programs and so on. Experimenting with the
POKE statement will probably result in some interesting effects. If
something happens and you can't stop itT just turn the VIC off and on
{
again, or hold down 1he RUN/STOP key and hit RESTORE.
c
c
c
c
126

Advertisement

Table of Contents
loading

Table of Contents