258
The
VIC
20
User
Guide
N
ow
you can begin reading data from the Datassette.
140
INPUTI1J
A.
This inputs the first record you entered and assigns it to the string variable
A$.
The statement
150
PRINT
A.
takes the data that you just put into
A$
and displays them on the screen.
Status
Register
There
is
a special variable name (similar to
TI
and TI$) that indicates
the status
of
the external devices connected
to
the VIC. This
is
the variable
ST. Table 8-2 interprets the values of ST.
To determine whether you have reached the end of a file, you can check
the value
of
ST from inside your program.
If
the value of ST
is
64
you have
run out
of
data. Add the following line:
160
IF
ST
<>
64
THEN
150
Your program will branch back to read another record from the file.
If
ST equals 64, all the data have been read and displayed. Close the file.
170
CLOSE
1
Then follow the instructions on the screen. The computer will display all
of
the items you entered in
,the
previous section.
Using
GET#
to Read
Flies
It
is
also possible
to
use the GET command, just as you would from
the keyboard. The GET# instruction reads one byte
at
a time from the
Datassette. Change line
140
to
140
GETllJ
AS
and, in immediate mode, type
GOTO
70
This time all the data are printed in a vertical column. Why?
Look
at
line
140.
The GET# function inputs only one character
at
a
time. That character
is
then assigned to variable
A$
and printed. The