EasyManua.ls Logo

Commodore 1581 - Freeing Blocks

Commodore 1581
138 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...
120
PRINT#5,"I
THINK
THEREFORE
I
AM"
Write
a
message
to
buffer.
130
T
=
1
:S
=
1
Start
at
first
track
&
sector.
140
PRINT#15,"B-A";0;T;S
Try
allocating
it.
150
INPUT#15,EN,EM$,ET,ES
See
if
it
worked.
160
IF
EN=0
THEN
210
If
so,
we're
almost
done.
170
IF
ENO65
THEN
PRINT
"NO
BLOCK"
EN,EM$,ET,ES:STOP
means
already
allocated.
180
IF
ET=0
THEN
PRINT
"DISK
FULL":STOP
If
next
track
is
0,
we're
out
of
room.
190
IF
ET=40
THEN
ET=4l:ES
=
0 Don't
allocate
the
directory.
200
T=ET:S
=
ES:GOTO
140 Try
suggested
track
&
sector
next.
210
PRINT#15,"U2";5;0;T;S
Write
buffer
to
allocated
sector.
220
PRINT
"STORED
AT:",T,S
Say
where
message
went
230
CLOSE
5:CLOSE
15
and
tidy
up.
240
END
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,uBLOCK-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
command:
PRINT#15/'B-F";0;l;l
76

Table of Contents

Other manuals for Commodore 1581

Related product manuals