Block-Write - Commodore 1541 User Manual

Hide thumbs Also See for 1541:
Table of Contents

Advertisement

BLOCK-WRITE
The BLOCK-WRITE command is the exact opposite of the BLOCK-READ com
mand. First you must fill up a data buffer with your information, then you write that
buffer to the correct location on the disk.
FORMAT FOR BLOCK-WRITE COMMAND:
PRlNTfffUe*. "BLOCK-WRITE:" channel; drive; track; block
or abbreviated as
PRINTtffile, "B-W:*r channel; drive; track; block
When the data is being put into the buffer, 0 pointer in the DOS keeps track of
how many characters there are. When you perform the BLOCK-WRITE operation,
that pointer is recorded on the disk. That is the reason for the ST check in line 70 of the
program above: the ST will become non-zero when you try to read past the end-of-file
marker within the record,
SAMPLE PROGRAM TO WRITE DATA ON TRACK 1. SECTOR 1:
10
20
30
40
50
60
70
OPEN15,
OPEN5.8
FORL-
PRINTS
NEXT
8.15
1TO50
."TEST"
PRINTtfl5,"B-W;"5;O;l;l
CLOSES;
CLOSE15
[
OPEN A
> ACCESS
V^A
A.
RANDOM
CHANNEL
BLOCK ALLOCATE
In order to safely use random files along with regular files, your programs must
check the BAM to find available blocks, and change the BAM to reflect that you've
used them. Once you update the BAM, your random files will be safe — at least unless
you perform the VALIDATE command (see chapter 3).
FORMAT FOR THE BLOCK-ALLOCATE COMMAND:
PRINTtffileS, "BLOCK-ALLOCATE:" drive; track; block

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents