User`s guide

SA VE WITH" REPLACE OPTION
If
a file already exists, it
can't
be saved again because the disk only allows one copy
of
any given file name
per
diskette.
It
is possible to get around this problem using the
Rename and
Scratch commands described later. However,
if
all
you wish to do is replace
a program
or
data file with a revised version, another command is
n;iore
convenien~
.
Known as Save-with-replace ,
or
@Save, this option tells the disk to replace any file 1t
finds in the directory with the same name, substituting the new file for it.
FORMAT
FOR SA VE WITH REPLACE:
BASIC 2
SA
VE
"@Drive
#:file
name",
device#
FORMAT FOR SA VE WITH REPLACE:
BASIC
3.5
DSAVE
"@file
name"
,Ddrive
# ,
Udevice #
where all the parameters are as usual except for adding a leading
"at"
sign
(@
.
)Th
e
''O:''
in the Basic 2 version, though a holdover from earlier dual drives is required here.
EXAMPLES:
SAVE"@O
:REVISED
PROGRAM"
,8
DSA VE
"@REVISED
PROGRAM"
The
actual procedure is that the new version is saved completely, then the old version
is scratched, and its directory entry altered to point to the new version. Because it works
this way, there is little,
if
any, danger that a disaster such as having the power going off
midway through the process would destroy both the old and new copies
of
the
fil
e.
Nothing happens to the old copy until after the new copy is saved properly.
However, we do offer one
caution-do
not use @Save on an almost-full diskette.
Only use it when you have enough room on the
disk~tte
to hold a second complete copy of
the program being replaced. Due to the way
@Save works, both the old and new versio
ns
of
the file are on disk simultaneously at one point, as a way
of
safeguarding against loss of
the program.
If
there is not enough room left on diskette to hold that second copy, only
as
much
of
the new version will be saved on the
1541
as there
is
still room for. After
th
e
command completes, a look at a directory will show the new version is present, b
ut
doesn't
occupy enough blocks
to
match the copy in memory. Unfortunately, the Veri
fy
command (see next section) will not detect this problem, because however much did g
et
saved will have been saved properly.
VERIFYING PROGRAMS
Although not as necessary with a disk drive as with a cassette, Basic's Veri
fy
command can be used to make doubly certain that a
progr_am
file was properly saved
to
disk.
It
works
much
like
the
Load
command,
except
that
it
only
compares
ea
ch
char~cter
in
the
program
against
the
equivalent
character
in
the
computer's
me
rn·
ory,
instead
of
actually
being
copied
into
memory.
30
If
the disk copy
of
the program differs even a tiny bit from the copy in memory,
«VERIFY
ERROR"
will be displayed, to tell you that the copies differ. This in itself
doesn't mean either copy
is
bad, but
if
they were supposed to be identical, one
or
the other
has a problem.
Naturally, there's no point
in
trying to verify a disk copy
of
a program after the
original is no longer
in
memory. With nothing to compare to, an apparent err
or
will
always be announced, even though the disk copy is always and automatically verified as
it
is
written to the disk.
FORMAT FOR
THE
VERIFY COMMAND:
VERIFY
" drive # :pattern",device
#,relocate
Hag
where
"drive#
:"
is
an optional drive number (0 on the 1541,)
"pattern"
is
any string
expression that evaluates to a file name, with
or
without pattern-matching characters, and
"device
#"
is the disk device number, normally 8.
If
the relocate
Hag
is present and
equals 1 , the file will be verified where originally saved, rather than relocated into the
Basic text area.
A useful alternate form
of
the command is:
VERIFY
"
*",device#
It verifies the last
file
used without having to type its name or drive number. However, it
won't work properly after save-with-replace, because the last file used was the one
deleted, and the drive will try to compare the deleted file to the program in memory. No
harm will result, but
"VERIFY
ERROR"
will always be announced.
To
use verify after
@SA VE, include at least part
of
the file name that
is
to be verified in the pattern.
One other note about
Verify-when
you Verify a relocated file, an error will nearly
always be announced, due to changes in the link pointers
of
Basic programs made during
relocation. It is best to only verify files saved from the same type
of
machine, and
identical memory size. For example, a Basic program saved from a VIC 20 can't easily be
verified using a Commodore 64, even when the program would work fine on both
machines (unless the program
is
re-saved). This shouldn't matter, as the only time you'll
be
verifying files on machines other than the one which wrote them
is
when you are
comparing two disk files to see
if
they are the same. This is done by loading one and
verifying against the other, and as suggested, can only be done on the same machine and
memory size as the one on which the files were first created.
ERASING OLD PROGRAMS: BASIC 2
The Scratch command allows you to erase unwanted files, and free the space they
occupied for use by other files .
It can be used
to
erase either a single file,
or
several files at
once via pattern-matching.
31