274 The VIC 20
User
Guide
79
A=T
89
B=S
Note:
If
there are no more available sectors on the diskette, the error
channel will return track 0
and
sector
O.
These do not designate a real sector
and will cause
an
error if you try to write
to
that
location.
To
make sure you
don't have this problem, recheck the error channel.
If
there are zeros in
variables T and S, then you need to check for sectors with lower numbers.
99
IF
A=9
AND
B=0
THEN
PRINT
"DISK
FULL":GOTO
160
If
you don't get this error, continue with your BLOCK-WRITE.
199
PRHn
"TRACK";
A;"
";
"SECTOR";
B
195
OPEN
2,8,4,"#"
119
INPUT
A$
If
you input an X, the program will terminate data input.
129
IF
AS
•
"X"
THEN
150
If
not, then put the
data
into your file
130
PRINT4t2,
AS
and go back for more.
149
GOTO
119
Use
the following statement to put the
data
into your selected sector:
159
PRINT*15,
"B-W:
"4;
9;
A;
B
Note: The format
of
the BLOCK-WRITE instruction
is
the same as
that
of
the BLOCK-READ instruction.
Once more, you must close your files and end the program.
169
CLOSE
2:
CLOSE
15
BUFFER·POINTER
As
you have seen, the
data
buffer stores information that
is
read in
from the diskette. The
buffer pointer keeps track
of
which byte
is
being read
and advances
by
one each time a byte
is
read.