EasyManua.ls Logo

Commodore 1541-II - Allocating Blocks

Commodore 1541-II
104 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...
pointer
to
the
first file
type
byte
(see
Appendix
C
for
details
of
directory
organization),
locking
it
by
setting
bit
6
and
rewriting
it.
110
OPEN
15,8,15
Open
command
channel
120
OPEN
5,8,5,"#"
Open
direct
access
channel
130
PRINT#15,"Ul";5;0;18;l
Read
Track
18,
Sector
1
140
PRINT#15,"B-P";5;2
Point
to
Byte
2 of
the
buffer
150
GET#5,A$:IF
A$="
"
THEN
A$
=
CHR$(0)
Read
it
into
memory
160
A
=
ASC(A$)
OR
64
Turn
on
bit
6
to
lock
170
PRINT#15,"B-P";5;2
Point
to
Byte
2
again
180
PRINT#5,CHR$(A);
Overwrite
it
in
buffer
190
PRINT#15,"U2";5;0;18;l
Rewrite
buffer
to diskette
200
CLOSE
5
Tidy
up
after
210
CLOSE
15
220
END
After
the
above
program
is
run,
the
first
file
on
that
diskette
can
no
longer
be
erased.
If
you
later
need
to
erase
that
file,
re-run
the
same
program,
but
substitute
the
revised
line
160
below
to
unlock
the
file
again:
160
A
=
ASC(A$)
AND
191
Turn
off
bit
6
to
unlock
ALLOCATING
BLOCKS
Once
you
have
written
something
in
a
particular
sector
on
a
diskette
with
the
help
of
direct
access
commands,
you
may
wish
to
mark
that
sector
as
"already
used,"
to
keep
other
files
from
being
written
there.
Blocks
thus
"allocated"
will
be
safe
until
the
diskette
is
validated.
FORMAT
FOR
BLOCK-ALLOCATE
COMMAND:
PRINT#15,<tBLOCK-ALLOCATE";drive
#;
track
#;sector
#
usually
abbreviated
as:
PRINT#15,"B-A";drive
#;
track
#;sector
#
where
"drive
#"
is
the
drive
number,
always
0
on
the
1541,
and
"track
#"
and
"sector
#"
are the
track
and
sector
containing
the
block
of
data
to
be
read
into
the
file
buffer.
ALTERNATE
FORMAT:
PRINT#15,"B-A:";drive
#;
track
#;sector
#
EXAMPLE:
If
you
try
to
allocate
a
block
that
isn't
available,
the
DOS
will
set
the
error
message
to
number
65,
NO
BLOCK,
and
set
the
track
and
block
numbers
in
the
error
message
to
70

Table of Contents

Related product manuals