Watch Out For Splat Files; Printing A Directory; Reading A Directory As A File; Another Way To - Commodore 1541 User Manual

Hide thumbs Also See for 1541:
Table of Contents

Advertisement

The
rest of
the directory
contains
one line per program or
file, each
line
supply"
three pieces of information about its
subject.
' Q
I
RINTING A DIRECTORY
At
the
left
end of
each line
is
the
size
of that line's file in blocks
(or sectors) of
2Si
p
characters
.
Four blocks are
equivalent
to IK
(1024 characters)
of RAM
(read/w
.
To make a permanent
copy of a
directory
,
perhaps to
fasten
to the di kette's
outer
·
'd h
ntc
·11
d
h
·
memory ms.•
et e
compu~er.
(paper)
envelope.
you w1
ne~
to
send
t
e
directory to
a
printer.
such as Commodore's
The middle of
each
directory line
contains
the name of the file,
enclosed in
quotati
MPS SOI, 1520
and
1
.
5 26
se
rial
bus
model
.
To
do
this
,
you
may need to refer to
your
marks
.
All
characters
between the quote marks are part of the name, and must be ind
uct°'
rinter manual, but briefly the procedure for listing
a
directory to device 4
is as follows
:
when loading
or
opening that file
.
et
p
The right portion of each directory line
is
a three
character
abbreviation
for
the
fil
~ype
of .that entry.' As we will
see
in later
chapters,
there
are
many ways to
sto~
mformauon on a diskette, most
of
which are associated with a distinctive file type.
TYPES OF FILES
AV
Al LAB LE
Currently used file types
include:
PRG
=
Program files
SEQ
=
Sequential data files
REL
=
Relative data files
USR
=
User
(nearly
identical to
sequential)
DEL
=
Deleted
(you
may never
see
one of these .)
(Not~:
Direct Access files
,
also
called
Random files, do not automatically appear
in
the directory
.
They
are
discussed in Chapter 7
.)
LOAD"$0",8
OPEN 4,4 :CMD
4:LIST
PRINT#4:CLOSE
4
Also note that
all of
the
statements
that
can
be
combined on one
line
already
have
been.
Type them in immediate mode to
avoid
disturbing the directory
.
All other options
,
such as differing
device numbers
,
and elective
directories
(see
next section) can also be
specified
a~
usual
in the Load command
.
WARNING: Be
sure
to include the PRINT#
command
after every printer
listing
.
Otherwise, the printer will remain as an unwanted listener
on
the
serial
bus,
and may disrupt
other work
.
Also, do not abbreviate PRINT# as
?#.
Although it
will look proper when listed out, it will
cause
a SYNTAX ERROR in use
.
The
proper abbreviation
for
PRINT# is pR
.
".1-fter all the directory entries have listed, the directory finishes with a
messagi
showing
how many blocks of the diskette
are
still
available for use
.
This number
can
van
~------------------------------_J
from 664 on a new diskette to 0 on
one
that is already completely full.
.
WATCH OUT FOR SPLAT FILES!
READING A DIRECTORY AS A FILE
One indicator
you
may
occasionally
notice on
a
directory line, after you begin
savi
nj
I~
you w.ould like to read a directory from within
a
program,
you
may do
so.
In Basic
programs and files,
is
an asterisk appearing just before the file type of a file that
is
I
3
.s.
simply include the DIRECTORY
command
in
your
Basic program
.
In Basic
2,
blocks long
.
This indicates the file was not properly closed after it was
created,
and
thall
however, and
optionally
in the
others,
you will have to Open the directory as though it
should
not be relied upon
.
These
"splat"
files
(as
they are called in England)
wil
were
a data file
and read
it
character
by
character.
See
the discussion
of
Get#
in
Chapter
5
normally need to be erased from the diskette and rewritten. However, do not u
e
tll
for
more information
.
Scratch
command
to
get
rid of them
.
They
can
only be
safely
erased by the Validate
all'
Collect commands
.
One of these
should
normally be used whenever a
splat
file is
noticei
ANOTHER WAY TO BE SELECTIVE
on
a diskette
.
(All
these
commands
are described in the next
chapter.)
.
.
There are two
exceptions
to the
above
warning: one is that Validate and
ColleC
Before d1scu
sing
the
pattern-matching options available for
use
in
several
disk
cannot
be used
on some
diskettes that include direct access
(random) files,
and the
othen
c~mmands,
let's
cover one
more that is
only
usable
in a
directory
.
Several different
types
that if the information in the
splat
file was
crucial and can't
be replaced there is
a
way
1
1
°
files can
coexist peacefully on
the
same
diskette
.
By
altering our
directory load
'
~mmad
·
.
rescue whatever part of the file was properly written
.
(This option is also described
in
1
11
.
n
we
can create a
directory from the files
of a single selected
type
.
Thus,
we
next
chapter)
.
~~~ht
request a list
of all
sequential data files
(see Chapter 5), one of all
the
relative data
(see Chapter 6)
,
or one of only
program
files
.
To do this
,
imply
add
to the
end of
Your sele
t'
d'
.
t
c
1ve 1rectory request the
equals sign (
=)
followed
by the
first
letter
of
the
file
Ype
you want in
your
directory
.
For example
,
the Basic
2 command:
20
21

Advertisement

Table of Contents
loading

Table of Contents