EasyManua.ls Logo

Commodore VIC-20 - Page 267

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter
8:
Peripheral Devices 253
programming terms.
If
you want
to
input data from the keyboard, you
would use a BASIC statement such as
10
INPUT
A
This
li~e
stops program execution and waits for you to enter some data from
the keyboard and press
RETURN. The data are assigned to the variable
A.
Unless the VIC
is
told otherwise, all input statements such as the one above
look for data coming from the keyboard.
If
you want to output some
data
to the video screen, you might use the
following statement:
20
PRINT
A
The value
of
variable A will appear on the screen.
The
INPUT
statement tells the computer it
is
to receive some data, and
the
PRINT
statement instructs the computer to output some data. Although
data
are usually sent from the keyboard and received by the video screen,
these are not the only devices available.
To "talk"
or
"listen" to another device, you will first need to open a
logical channel to
that
device. This
is
accomplished using the
OPEN
state-
ment. With this statement, you designate what channel you are using and
what device number you are addressing. Every physical unit (peripheral
device) has a unique device number. The channel you
open
is
called the
file
and the number you assign to it
is
its file number. The format for
an
OPEN
statement
is
as follows:
10
OPEN/n,
dn,
sa,
filename
where:
/n The file number
is
the number you use to access the file. You may
choose any number between 0 and
255
dn The device number
is
the number
of
the peripheral device you are
addressing
sa
The secondary address sets up certain parameters for the device being
used
filename The file name
is
used to specify the file during a read operation.
If
you
specify a file name when you write the file and when you read it on the
Datassette, all files will be skipped until the one you specified
is
found.
Table
8-1
shows the device numbers and secondary addresses that
correspond to the VIC's logical devices.

Other manuals for Commodore VIC-20

Related product manuals