4.
Connect
the
power
cord.
Check
the
ON/OFF
switch
on
the
back
of
the drive
(see
Figure
2)
and
make
sure
it's
OFF.
Connect
the
power
supply
where
indicated
in
Figure
2.
Plug
the
other
end
into
an
electrical
outlet.
Don't
turn
the
power
on
yet.
Figure2.ConnectionofPower
Cord
and
Interface
Cablesto1581
BACK
OF
C128
SERIAL
PORT
CONNECTOR
ON
C128
POWER
CORD
SOCKET
BACK
OF
1581
SERIAL
PORT
CONNECTORS
FOR
INTERFACE
CABLES
DIP
SWITCHES
FOR
CHANGING
DEVICE
NUMBER
ON/OFF
SWITCH
POWER
OUTLET
NOTE
Throughout
this
manual,
when
the
format
foracom
mand
is
giv^n,
it
will
followaparticular
style.
Anything
that
is
capitalized
must
be
typed
in
exactly
as
it
is
shown
(these
commands
are
listed
in
capital
letters
for
style
purposes,
DO
NOT
use
the
SHIFT
key
when
entering
these
com
mands).
Anything
in
lower
case
is
more
or
lessadefinition
of
what
belongs
there.
Anything
in
brackets
is
optional.
For
instance,
in
the
format
for
the
HEADER
command
given
on
the
following
page,
the
word
HEADER,
the
capital
I
in
lid,
the
capitalDin
Ddrive#,
and
the
capitalUin
Ude*-
vice#
must
all
be
typed
in
as
is
(Ddrive#
and
Udevice#
are
optional).
On
the
other
hand,
diskette
name
tells
you
that
you
must
enteraname
for
the
diskette,
but
it
is
up
to
you
to
decide
what
that
name
will
be.
Also,
the
id in
lid
is
left
to
your
discretion,
as
is
the
device#
in
Udevice#.
The
drive#
in
Ddrive#
is
always0on
the
1581,
but
could
be0or1on
a
dual
disk
drive.
Be
aware,
however,
that
there
are
certain
limits
placed
on
what
you
can
use.
In
each
case,
those
limits
are
explained
immediately
following
the
format
(for
in
stance,
the
diskette
name
cannot
be
more
than
sixteen
characters
and
the
device#
is
usually
8).
Also
be
sure
to
type
in
all
punctuation
exactly
where
and
how
it
is
shown
in
the
format.
Finally,
press
the
RETURN
key
at
the
end
of
each
command.
HOW
TO
PREPAREANEW
DISKETTE
A
diskette
needsapattern
of
circular
magnetic
tracks
in
order
for
the
drive's
read/write
head
to
find
things
on
it.
This
pattern
is
not
on
your
diskettes
when
you
buy
them,
but
you
can use
the
HEADER
command
or
the
NEW
command
to
add
it
toadiskette.
That
is
known
as
formatting
the
disk.
This
is
the
command
to
use
with
the
C128
in
C128
mode
or
Plus/4:
HEADER
"diskette
name",Iid,Ddrive#[,Udevice#]
Where:
"diskette
name"
is
any
desired
name
for
the
diskette,
up
to
16
charac-
10
ters
long
(including
spaces),
"id"
can
be
any
two
characters
as
long
as
they
don't
formaBASIC
keyword
(such
as
IF
or
ON)
either
on
their
own
or
with
the
capital
I
before
them.
"drive#"
is0.
"device#"
is
8,
unless
you
have
changed
it
as
per
instructions
in
AppendixA(the
1581
assumes8even
if
you
don't
type
it
in).
The
command
for
the
C64,
VIC
20,
or
C128
in
C64
mode
is
this:
OPEN
15,device#,15,"NEWdrive#:diskette
name,id"
CLOSE
15
The
device#,
drive#,
diskette
name,
and
id
are
the
same
as
described
above.
The
OPEN
command
is
explained
in
the
next
chapter.
For
now,
just
copy
it
as
is.
-NOTE
FOR
ADVANCED
USERS
If
you
want
to
use
variables
for
the
diskette
name
or
id,
the
format
is
as
follows:
C128,
Plus/4:
HEADER
(A$),I(B$),D0
C64:
OPEN
15,8,15:PRINT#15,"N0:"
+A$+","+B$:
CLOSE15
Where:
A$
contains
the
diskette
name
(16
character
limit)
B$
contains
the
id
(2
characters
long)
After
you
formataparticular
diskette,
you.
can
reformat
it
at
any
time.
You
can
change
its
name
and
erase
its
files
faster
by
omitting
the
id
number
in
the
HEADER
command.
DISKETTE
DIRECTORY
A
directory
isalist
of
the
files
onadiskette.
To
view
the
directory
on
the
C128
or
Plus/4,
type
the
word
DIRECTORY
onablank
line
and
press
the
RETURN
key
or
simply
press
the
F3
key
on
the
C128.
That
doesn't
erase
anything
in
memory,
so
you
can
call
upadirectory
11
CHAPTER
2
BASIC
2.0
COMMANDS
This
chapter
describes
the
disk
commands
used
with
the
VIC
20,
Commodore
64
or
the
Commodore
128
computer
in
C64
mode.
These
are
Basic
2.0
commands.
You
send
command
data
to
the
drive
through
something
called
the
command
channel.
The
first
step
is
to
open
the
channel
with
the
following
command:
OPEN15,8,15
The
first
15
isafile
number
or
channel
number.
Although
it
could
be
any
number
from1to
255,
we'll
use
15
because
it
is
used
to
match
the
secondary
address
of
15,
which
is
the
address
of
the
command
channel.
The
middle
number
is
the
primary
address,
better
known
as
the
device
number.
It
is
usually
8,
unless
you
change
it
(see
Appendix
A).
Once
the
channel
has
been
opened,
use
the
PRINT#
command
to
send
information
to
the
disk
drive
and
the
INPUT#
command
to
receive
information
from
the
drive.
You
must
close
the
channel
with
the
CLOSE15
command.
The
following
examples
show
the
use
of
the
command
channel
to
NEW
an
unformatted
disk:
OPEN15,8,15
PRINT#15,"NEWdrive#:diskname,id"
CLOSE15
You
can
combine
the
first
two
statements
and
abbreviate
the
NEW
command
like
this:
OPEN15,8,15,"Ndrive#
:diskname,id"
If
the
command
channel
is
already
open,
you
must
use
the
following
format
(trying
to
openachannel
that
is
already
open
results
ina"FILE
OPEN"
error):
PRINT#15,uNdrive#:diskname,id"
15
dangeradisaster
such
as
losing
power
midway
through
the
process
would
destroy
both
the
old
and
hew
copies
of
the
file.
Nothing
happens
to
the
old
copy
until
after
the
new
copy
is
saved
properly.
VERIFY
The
VERIFY
command
can
be
used
to
make
certain
thatapro
gram
file
was
properly
saved
to
disk.
It
works
much
like
the
LOAD
command,
except
that
it
only
compares
each
character
in
the
program
against
the
equivalent
character
in
the
computer's
memory,
instead
of
actually
being
copied
into
memory.
If
the
disk
copy
of
the
program
differs
evenatiny
bit
from
the
copy
in
memory,
"VERIFY
ERROR"
will
be
displayed,
to
tell
you
that
the
copies
differ.
This
doesn't
mean
either
copy
is
bad,
but
if
they
were
supposed
to
be
identical,
there
isaproblem.
Naturally,
there's
no
point
in
trying
to
VERIFYadisk
copy,
of
a
program
after
the
original
is
no
longer
in
memory.
With
nothing
to
compare
to,
an
apparent
error
will
always
be
announced,
even
though
the disk
copy
is
automatically
verified
as
it
is
written
to
the
diskette.
FORMAT
FOR THE
VERIFY
COMMAND:
VERIFY
"drive#:pattern",device#,relocate
flag
where
"drive#:"
is
an
optional
drive
number,
"pattern".is
any
string
expression
that
evaluates
toafile
name,
with
or
without
pattern-
matching
characters,
and
"device#"
is
the
disk
device
number,
nor
mally
8.
If
the
relocate
flag
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
files
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
@SAVE,
include
at
least
part
of
the
file
name
that
is
to
be
verified
in
the
pattern.
19
One
other
note
about
VERIFY—when
you
VERIFYarelocated
BASIC
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
VERIFY
files
saved
from
the
same
type
of
machine,
and
identi
cal
memory
size.
For
example,
a
BASIC
program
saved
fromaPlus/4
can't
be
verified
easily
withaC64,
even
when
the
program
would
work
fine
on
both
machines.
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
can
only
be
done
on
the
same
machine
and
memory
size
as
the
one
on
which
the
files
were
first
created.
SCRATCH
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
eitherasingle
file
or
several
files
at
once
via
pattern-matching.
FORMAT
FOR
THE
SCRATCH
COMMAND:
PRINT#15,"SCRATCH0:pattern"
or
abbreviate
it
as:
PRINT#15,"S0:pattern"
"pattern"
can
be
any
file
name
or
combination
of
characters
and
wild
card
characters.
As
usual,
it
is
assumed
the
command
channel
has
already
been
opened
as
file
15.
Although
not
absolutely
necessary,
it
is
best
to
include
the
drive
number
in
SCRATCH
commands.
If
you
check
the
error
channel
afteraSCRATCH
command,
the
value
for
ET
(error
track)
will
tell
you
how
many
files
were
scratched.
For
example,
if
your
diskette
contains
program
ftles
named
"TEST,"
"TRAIN,"
"TRUCK,"
and
"TAIL,"
you
may
SCRATCH
all
four,
along
with
any
other
files
beginning
with
the
letter
"T,"
by
using
the
command:
PRINT#15/S0:T*'
Then,
to
prove
they
are
gone,
you
can
type:
GOSUB
59990
20