EasyManua.ls Logo

Commodore 1570 - Page 81

Commodore 1570
132 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...
FREEING BLOCKS
The BLOCK-FREE command
is
the opposite
of
BLOCK-ALLOCATE. It frees a
block that you don't need any more, for re-use
by
the DOS. BLOCK-FREE updates the
BAM
to show a particular sector
is
not
in
use, rather than actually erasing any data.
FORMAT FOR BLOCK-FREE COMMAND:
PRINT#15,"BLOCK-FREE";drive #;track #;sector #
abbreviated
as:
PRINT#15,"B-F";drive #;track #;sector #
where "drive
#"
is the drive number, and "track
#"
and "sector
#"
are respectively
the track and sector numbers containing the desired block of data
to
be read into the
file
buffer.
ALTERNATE FORMAT:
PRINT#15,"B-F:";drive #;track #;sector #
EXAMPLE:
To free the sector in which we wrote our name
in
the BLOCK WRITE example, and
allocated in the first BLOCK-ALLOCATE example,
we
could use the following com-
mand:
PRINT#15,
"B-F";O;l;l
USING RANDOM FILES (ADVANCED USERS)
By
combining the commands
in
this chapter, it
is
possible
to
develop a file-handling
program that uses random files. What you need to know
now
is
how
to
keep track
of
which blocks on the disk such a
file
has used. (Even though you know a sector has not
been allocated
by
your random file, you must also be sure
it
wasn't allocated by another
unrelated
file
on
the diskette.)
The most common way
of
recording which sectors have been used by a random
file
is
in
a sequential file. The sequential
file
stores a list of record numbers, with the track,
sector, and byte location
of
each record. This means three channels are needed by a
random
file:
one for the command channel, one for the random data, and the last for the
sequential data.
73

Related product manuals