Commodore vic-1540 User Manual

Page 1
commodore
WiC-Ii
USER'S
MANUAL
SINGLE
DRIVE
FLOPPY
piSK
by
Page 2
SINGLE
DRIVE
FLOPPY
DISK
USER'S
MANUAL
p
N154OOO18-OS
commodore
Page 3
The
information
in
this
manual
has
been
reviewed
and
is
believed to
be
entirely
reliable.
No
responsibility,
however,
is
assumed
for
inaccuracies.
The
material
in
this
manual
is
for
information
purposes
only,
and
is
subject
to
change
without
notice.
©Commodore
Business
Machines,
Inc.,
September
1981
"All
rights
reserved."
Commodore
Business
Machines
3330
Scott
Boulevard
Santa
Clara,
California
95050
Page 4
TABLE
OF
CONTENTS
Page
Chapter
1
Introduction
j
General
Information
j
Description
j
Front
Panel
4
Back
Panel
4
Interior
Configuration
4
The
Diskette
4
Specifications
4
Care
Of
The
VIC-1540
7
Care
Of
The
Diskettes
7
Unpacking
The
Disk
Drive
7
Chapter
2
Preparing
To
Use
Your
Disk
Drive
9
Connecting
The
Disk
Drive
To
The
Computer
9
Performing
The
Power-On
Test
10
Inserting
The
Diskette
!
1
Disk
Drive
Performance
Test
12
Chapter
3
Learning
How
To
Use
Your
Floppy
Disk
Drive
15
The
Block
Availability
Map
(BAM)
..-...-
jg
The
Disk
Operating
System
(DOS)
.
16
Disk
Maintenance
Commands
jg
NEW
17
Initialization
19
The
Directory
20
LOADS
20
Printing
The
Directory
••21
VALIDATE
t
21
COPY
22
RENAME
23
SCRATCH
23
Page 5
Chapter
4
BASIC
Commands
For
Data
Handling
25
BASIC
Commands
Ascociated
with
Floppy
Disk
Drives
25
SAVE
(Writing
a
Program
toaDiskette)
26
VERIFY
27
LOAD
(Reading
a
Program
fromaDiskette)
27
OPEN
28
CLOSE
29
Closing
The
Command
Channel
30
Closing
The
Data
Channel
30
PRINT
#
31
INPUT
#
32
GET
#
33
MovingaTape
Program
to
Disk
34
Chapter
5
Advanced
Disk
Programming
35
Commodore
Disk
Operating
System
(DOS)
35
Special
OPEN
and
CLOSE
Statements
for
Direct
Access
..
3$
Disk
Utility
Command
Set
36
BLOCK-READ
38
BLOCK-WRITE
39
BLOCK-EXECUTE
39
BUFFER-POINTER
39
BLOCK-ALLOCATE
40
BLOCK
FREE
40
MEMORY
41
MEMORY-WRITE
41
MEMORY-READ
41
MEMORY-EXECUTE
42
USER
42
Structure
of
Diskette
43
Page 6
Chapter
6
Sequential
File
49
To
CreateaSequential
File
and
Accessing
49
Example
ofaSequential
File
Program
5q
Chapter
7
Random
File
53
Data
Flow
in
Random
File
..
53
Example
of
Using
Record
Number
55
Example
ofaRandom
File
Program
57
Chapter
8
Error
Messages—Pattern
Matching
File
Names
61
Requesting
Error
Messages
..
61
Summary
of
DOS
Error
Messages 61
Description
of
DOS
Error
Messages
62
Pattern
Matching
66
Appendix
69
List
of
Illustrations
Figure
Title
Page
1
Front
Panel
5
2
Back
Panel
5
3
Floppy
Disk
Hookup
jq
4
Position
For
Diskette
Insertion
11
5
1540
Format.
Expanded
View
ofASingle
Sector
47
6
Data
Flow
between
Computer,
Buffer
and
Disk
Drive
53
Page 7
List
of
Tables
Table
Title
Page
1
Suggested
Reading
List
2
2
Specifications:
Model
1540
Single
Drive
Floppy
Disk
6
3
Standard
Jump
Table
43
4
Block
Distribution
by
Table
43
5
1540
BAM
Format
44
6
1540
Directory
Header
44
7
Directory
Format
45
8
Sequential
Format
46
9
Program
File
Format
46
10
Allocation
of
Record
Number
57
Page 8
Chapter
1
INTRODUCTION
GENERAL
INFORMATION
With
the
purchaseofyour
Commodore
VIC-1540
Single
Drive
Floppy
Disk
you
have
greatly
enhanced
the
computing
power
of
your
Commodore
VIC
system.
To
get
the
most
outofyour
system
you
should
study
your
computer's
user
guide,
and
if
necessary
the
BASIC
manuals
listed
in
Table
1.
You
will
benefit
mostifyou
first
read
through
this
entire
manual,
taking
note of
those
features
that
relatetoyour
particular
floppyaswellasthose
which
are
commontoall
Commodore
Floppys.
The
information
presentedinthis
manualisextensive
and
may,insome
cases,
present
information
that
is
currently
beyond
your
particular
level
of
expertise.
However,
by
carefully
and
thoughtfully
studying
its
contents
you
will
gain
the
confidence
necessary
to
progressively
upgrade
your
programming
skills
and
expertise.
This
manual
presents
discussions,
descriptions, practices
and
procedures
relat
ingtothe use
and
operation
of
the
VIC-1540
Single
Floppy
Disk
Drive.
DESCRIPTION
The
VIC-1540
described
in
this
manual
is
an
intelligent
single
drive
diskette
storage
device.
Its
individual
primary
components
consists
of
read/write
controls,
drive
motor
electronics,
drive
mechanism,
read/write
head,
and
track
positioning
mechanism.
The
disk
drive
discussed
in
this
manual
uses
Serial
interface
same
as
The
VIC-1515
graphic
printer.
Because
the device
is
an
"intelligent"
peripheral,
its
operation
requires
no
space
in
the
computer's
memory.
This
means
you
have
just
as
much
computer
memory
available
to
you
as
when
youdonot have
the
disk
attached.
Page 9
Table1.Suggested
Reading
List
Pet/CBM
Personal
Computer
Guide.
C.S.
Donahue
and
Jit.
Enger,
Osborne/McGraw-Hill,
630
Brancroft
Way,
Berkeley,CA94710
Hands-On
Basic
withaPet.
H.D.
Peckham,
McGraw-Hill
1979
Entering
BASIC.
J.
Sack
andJ.Meadows,
Science
Research
Associates,
1973
BASIC:AComputer
Programming
Language.
C.
?Qgeh,Holden-Day,
Inc.,
1973
BASIC
Programming.
J.
Kemeny
and
T.
Kurtz,
Peoples
Computer
Co.,
1010
Doyle
(P.O.
Box
3100),
Menlo
Park,
CA
94025,1967
BASIC
FOR
HOME
COMPUTERS.
Albrecht,
Finkle
and
Brown,
People
Computer
Co.,
1010
Doyle
(P.O.
Box
3100),
Menlo
Park,
CA
94025,1973
A
Guided
TourofComputer
Programming
in
BASIC.
T.
Dwyer,
Hough
ton
Mifflin
Co.,
1973
Programing
Time
Shared
ComputerinBASIC.
Eugene
H.
Barnet,
Wiley-Interscience,
L/C
72-175789
Programing
Time
Shared
ComputerinBASIC.
Eugene
H.
Barnett,
Wiley-Interscience,
L/C
72-175789
Programming
Language
#2.
Digital
Equipment
Corp.,
Maynard,MA01754
101
BASIC
Computer
Games.
Software
Distribution
Center,
Digital
Equipment
Corp.,
Maynard,
MA
01754
WhatdoTo
After
You
Hit
Return.
Peoples
Computer
Co.,
1010
Doyle
(P.O.Box
3100),
Menlo
Park,
CA
94025
Basic
BASIC.
JamesS.Coan,
Hay
den
Book
Co.,
Rochelle
Park,
NJ
WORKBOOKS
1-5.
T.I.S.,
P.OJBox
921,
Los
Alamos,NM87544
Programming
the
6502.
R.
Zaks,
Sybex,
1978
Page 10
24
Tested,
Ready-to-Run
Game
ProgramsinBasic.
K.
Tracton,
Tab
Books,
1978
Some
Basic
Programs.
M.
Borchers
andR.Poole,
Osborne&Assoc.
Inc.,
1978
Basic
Programming
for
Business.
I.H.Forkner,
Prentice-Hall
1977
The
Channel
Data
Book.
B.
Lewis,
5960
Mandarin
Ave.,
Goleta,CA93017,1978
PET
and
the
IEEE
488
Bus
(GPIP).
Osborne/McGraw-HW,
630
Bancroft
Way,
Berkeley,
CA
94710
Personal
Computingonthe
VIC
20
Commodore
International,
Ltd
Norristown,
PA
19403,
1981
VIC-20
Programmer's
Reference
Guide
Commodore
Business
Machines
Inc.
3330
Scott
Blvc.
Santa
Clara,
CA95050,1981
Page 11
Front
Panel
The
front
panelofthe
disk
drive
consistsofan
identification
panel
across
the
top;
slotinwhichtoinsertadiskette;
andadoortoclose
after
inserting
the
diskette.
When
the
door
is
closed,
the
diskette
is
clamped
onto
the
diskette
spindle
hub.
Alsoonthe
front
panel
are
two
LED
indicator
lights.
The
red
LED
on
the
slot
side
lights
when
driveisactive
and
flashes
wheneveradisk
error
occurs.
The
green
LED
on
the
lower
left
side
isapower
indicator
which
lights
when
powerisON.
Back
Panel
The
Back
of
the
disk
drive
contains
two
serial
interface
connectors.
Near
the
panel's
lower
edge
is
the
power
connector.
There
is
alsoa"slow
blow"
fuse.
Interior
Configuration
The
interior
of
your
floppy
contains
a
disk
drive.
All
the
logic
for
the
disk
drive
is
contained
within
the
unit.
The
mechanical
devices
are,
for
the
most
part,
located
beneath
the
disk
spindle.
The
Diskette
The
diskette
(also
known
asaminifloppy,
floppy
diskette,
minidiskette,
etc.)
is
similar
to the standard
flexible
disk.
There
are
several
reputable
manufacturers
of
the
5&-inch
diskettes.
You
should
make
sure
that
you
buy
diskettes
for
SOFT
SECTORED
FORMAT.
Your
Commodore
dealer
can
supply
your
needs.
Specifications
Table2presents
the
specifications
for
the
VIC-1540.
Page 12
iVIC-1540!
\
\
DRIVE
INDICATER(RED
LED)
LIGHT:ACTIVE FLASH:
ERROR
POWER
INDICATER
(GREEN
LED)
LIGHT:POWER
ON
Figl. Front
Panel
POWER
SWITCH
SERIAL
BUS
FUSE/HOLDER
Fig
2.
Back
Panel
Page 13
Table
2.
Specifications
VIC-1540
Single
Drive
Floppy
Disk
STORAGE
Total
capacity
Sequential
Relative
*
Directory
entries
Sectors
per
track
Bytes
per
sector
Tracks
Blocks
IC's:
6502
6522(2)
Buffer
2114(4)
PHYSICAL:
Dimensions
Height
Width
Depth
Electrical:
Power
requirements
Voltage
Frequency
Power
MEDIA:
Diskettes
174848
bytes
per
diskette
168656
bytes
per
diskette
167132
bytes
per
diskette
65535
records
per
file
144
per
diskette
17to21
256
35
683
(664
blocks
free)
microprocessor
I/O,
interval
timers
2KRAM
97
mm
200
mm
374
mm
100,120,220,
or
240
VAC
50or60
Herts
25
Watts
Standard
mini
5%",
single
sided,
single
density
*
Although
VIC-1540isdesigned
withacapability
to
handle
relative
files,
it
can
notbeused
with
the
current
versionofVIC-1001
personal
computer.
Page 14
CAREOFTHEVIC-1540
The
disk
drive
shouldbeplacedona
flat
surface
freeofvibration.
It is
important
that
dust
particles
be
kept
ataminimum
sinceaparticle
buildup
will
interfere
with
optimum
operation.
If
you
should
experience
a
hardware
failure
contact
your
Commodore
dealer.
Any
attempt
to
correct
the
problem
yourself
could
resultinvoiding
the warranty.
CARE
OF
THE
DISKETTES
Handle
diskettes
with
care.
Follow
these
instructions
to
maintain
the
quality
of
the
diskette
and
to
protect
the
integrity
of
the
data:
1.
Return
the
diskette
to
its
storage
envelop
whenever
it is
removed
from
the
drive.
2.
Keep
the
diskettes
away
from
magnetic
fields.
Exposure
toamagnetic
field
can
distort
the
data.
3.
Never
leaveadisketteontop of
your
computerordisk
drive.
4.
Do
not
writeonthe
plastic
jacket
withalead
pencilorball-point
pen.
Use
a
felt
tip
penorfill
out
the
label
before
attaching
ittothe
jacket.
5.
Do
not
expose
diskettes
to
heat
or
sunlight.
6.
Do
not
touch
or
attempt
to
clean
the
diskette
surface.
Abrasions
will
cause
lossofstored
data.
7.
Before
applying
power
to
the
VIC-1540
open
the
drive
door
and
remove
the
diskette.
UNPACKING
THE
DISK
DRIVE
Before
unpacking
the
disk
drive,
inspect
the
shipping
carton
for
signs
of
ex
ternal
damage.Ifthe
cartonisdamaged,beespecially
careful
when
inspecting
its
contents. Carefully
remove
all
packing
material
and
the
contentsofthe
carton.DONOT
discard
any
packing
material
should
contain:
1.
VIC-1540
Single
Floppy
Disk
Drive
2.
UserMannual,
Number
1540018-02
3.
TEST/DEMO
diskette:
4.
WARRANTY
CARD
If
any
items
are
missing,
please
contact
your
Commodore
dealer
immediately.
Page 15
NOTES
Page 16
Chapter
2
PREPARING
TO
USE
YOUR
DISK
DRIVE
Before
starting
to
use
your
disk
drive,
make
sure
it
is
in
good
working
condition.
This
includes
properly
connecting
it
to
your
computer,
giving
itapowr-on
and
initial
checkout
test,
and
finally
the
performance
test
using
the
appropriate
TEST/DEMO
diskette.
CONNECTING
THE
DISK
DRIVE
TO
THE
COMPUTER
The
connector
cable
is
required
to
interface
the
floppy
to
the
computer.
This
cable
is
be
supplied
with
your
disk
drive.
NOTE:
The
disk
drive
should
be
the
first
peripheral
attached
to the
computer
if
other
devices
aretobe
"daisy-chained".
Follow
these
stepstoconnect
the
disk
drivetoyour
computer:
STEP
1:
Turn
power
OFF
to
the
computer
and
the
expansion
module,
STEP
2:
Place
the
disk
drive
inaconvenient
location
as
close
as
possible
to
the
computer.
DO
NOT
connect
the
disk
drive
to a
power
outlet
at
this
time.
STEP
3:
Connect
the
serial
cable
between
the
serial
interface
connector
on
the
computer
and
the
connectoronthe
disk
drive.
STEP
4:
Connect
the
disk
drive
power
cable
to
an
AC
outlet.
DO
NOT
turn
on
power
at this
time.
Page 17
VIC-20
Personal
Computer
VIC-1540
Single
Drive
Floppy
Disk
VIC-1515
Graphic
Printer
Fig
3.
Floppy
Disk
Hookup
PERFORMING
THE
POWER-ON
TEST
You
are
now
ready
to
proceed
with
the
power-on
part
of
the
checkout:
STEP
1:
Open
the
disk
drive
door.
Ensure
that
no
diskette
is
present
in
the
drive.
STEP
2:
Turn
Power
ON
to
the
expansion
module
(have
the optional
cartridge
inserted
before
turning
power
on.)
STEP
3:
Turn
power
ON
to
the
COMPUTER
and
verify
that
is
working
properly.
STEP
4:
Apply
power
to
the
disk
drive.
All
two
indicator
lights
(LED)
on
the
front
panel
will
light.
After
about1second
the
red
drive
indicator
will
go
out
and
the
green
power
indicator
will
remain
on.
If
the
red
drive
indicator
keeps
on
flashing,
turn
the
power
OFF.
Wait
one
minute
and
try
again.
If
the
above
condition
continues,
contact
your
Commodore
dealer.
10
Page 18
Note:
If
the
problem
persists,
try
disconnecting
the
other
devices
attached
to the
sesial
interface.
This
should
assure
thataproblem
related
to
another
device
does
not
affect
the
disk
drive.
WRITE
PROTECT
NOTCH
WHEN
COVERED,
DISKETTE
CONTENTS
CANNOT
BE
AL
TERED
Fig4.Position
for
Diskette
Insertion
INSERTING
THE
DISKETTE
CAUTION:
NEVER
APPLY
POWER
TO THE
DISK
DRIVEIFDISKETTE
IS
PRESENT
(LOCKED
AND
SEATED)
IN
THE
DRIVE.
STEP
1:
Ensure
that
the
power
to
the
disk
drive
is
OFF
and
DO
NOT
apply
power
until
you
complete
this
step.
Open
the
disk
drive
door
and
make
sure
that
no
diskette
is
present
in
the
drive.
STEP
2:
STEP
3:
STEP
4:
STEP
5:
If
the
preceeding
conditions
have
been
met,
you
may
apply
power
to
the
disk
drive.
Insert
the
diskette
into
the
slot
and
with
the
write
protect
tab
oriented to
the
left.
Once
the
diskette
is
in
the
slot,
gently
push
on
it
until
it
is
fully
seated.
Press
DOWN
firmly
on
the
spring-loaded
door
of
the
drive
until
you
hearadistinct
"click".
The
diskette
is
now
locked
and
seated
in
the
drive,
ready
for
processing
by
the
computer.
STEP
6:
To
remove
the
diskette,
insert
your
index
finger
under
the
lip
of
the
spring-loaded
door
and
gently
PULL.
This
will
release
the
door
and
permit
access
to
the
diskette.
The
diskette
is
now
free
to
be
removed
from
the
drive
11
Page 19
DISK
DRIVE
PERFORMANCE
TEST
When
you
have
successfully
completed
the
Power-On
test,
proceed with
the
Performance
Test.
Don't
worryifyou
don't
fully
understand
exactly
what
is
happening
in
this
test.
At
this
point,
enter
the
commands
just
to
getafeel
for
what
you
can
do
with
your
disk.
If
UNEXPECTED
results
are
obtained
during
any
step
of
the
test,
stop
and
start
over
again.
The
most
likely
cause
of
a
problem
is
an
improperly
entered
command.
This
is
to
be
expected
until
you
become
familiar
with
your
disk
unit.
All
commands
are
entered
via
the
keyboard
and
must
be
followed
byacarriage
return:
press
the
RETURN
key
on
your
keyboard.
NOTE:
Commands
must
be
entered
exactly
as
shown.
DO
NOT
insert
any
spaces
unless
shown
in
the
example.
If
the
error
indicator
lights,
you
may
be
able
to
continue
the
example anyway.
Re-enter
your
last
command.
If
the
light
goes
out,
your
correction
was
successful
and
you
may
continue.
STEP1:
Insert
the
DEMO
diskette
into
the
drive
as
previously
instructed.
STEP
2:
Type:
OPEN
1,
8,15,
"10"
and
press
return.
This
pocedure
initializes
the
diskette
and
makes
it
ready
for
use.
STEP
3:
Type
LOAD
"PERFORMANCE
TEST",
8
The
screen
will
display:
SEARCHING
FOR
PERFORMA
NCE
TEST
LOADING
READY.
STEP
4:
Type:
RUN
and
press
RETURN,
the
following
will
display:
FERFQRMflNCE
TEST
INSERT
SCRflTCH
DISKETTE
IN
DRIVE
12
Page 20
B:SK
NEW
CCMMRNB
WRIT
flBOUT
30
SECONDS
Do
not
use
diskettes
containing
any
valuable
information
since
the
Performance
Test
Program
will
re-format
it
and any
data
will
be
lost.
The
test
program
will
label
this
diskette
"Test
Disk".
This
diskette
is
ready
for
further
use
when
the
test
program
is
completed
and
the
performance
test
has
been
satisfied.
The
computer
will
first
format
the
diskette
in
the
drive.
At
the
end
of
the
operation
the
screen
displays:
9
OK
0
9
DRIVE
PflSS
MECflNICRL
TEST
The
computer
conducts
the
remainder
of
the
Performance
Test
and
displays:
OPEN
URITE
FILE
0
OK
0 0
WRITING
DRTfl
0
OK
6 0
CLOSE
WRITE
DflTfl
9
OK
0 0
0^
RERD
g
0K
0
e
RERDING
DflTR0ok
^ @
SCRRTCH
FILE
CRflTCHED
10
13
Page 21
WRITE TRRCK
35
8
OK
0
9
WRITE
T'?flCK
1
0
OK
0
9
REflD
TRRCK
35
8
OK
0 0
REflD
TRflCK
1
0
OK
0
0
HBS
PfiSSEB
PERFORMfiRCE
TEST!
PULL
DISKETTE
FROM
DRIVE
BEFORE
TURNING
POWER
OFF.
STEPS:
Remove
the
diskettes
and
return
them
to
their
protective
jackets.
The
floppy
has
passed
the
Performance
Test.
STEP
6:
If
any
problems
have
been
encountered
during
this
phase
of
the
test,
return
to
Step1and
repeat
the
entire
procedure.
If
problems
persist
and
you
do
not
reachasatisfactory
conclusion
to
the
Performance
Test,
contact
your
Commodore
dealer.
14
Page 22
Chapter
3
LEARNING
HOW
TO
USE
YOUR
FLOPPY
DISK
DRIVE
Your
Floppy
Disk
Drive
adds
and
enhances
your
computing
power
with
added
storage
and
file
handling
capability
andiscontrolled
directly
with:
BASIC
commands
entered
via
the
keyboard,
BASIC
statements
within
programs,
and
special
disk
commands.
In
this
chapter
you
will
learn
howtoapply
those
commands
and
statements.
This
chapter
is
organized
in
suchaway
that
the
functions
and
format
of
disk
commands
are
described
inamanner
which
permits
the
user
to
perform
disk-
related
tasks.
Before
using
your
floppy
disk
make
sure
you
know
how
to:
1.
operate
your
Commandore
VIC
Computer,
2.doelementary
programming
in
BASIC,
and
3.
open
and
close
files.
This
chapter
will
first
acquaint
the
user
with
those
fundamental
disk
commands
that
perform
disk
maintenance
and
file
manipulation
and
will
then
progressively
advance
towardanunderstanding
of
those
BASIC
commands
used
for
data
handling.
Approachedinthis
manner,
the
user
will
then have
developed
the
necessary
confidence
and
programming
skills
to
proceed
to
advanced
disk
programming
techniques.
Practice
the
disk
commands,
read
the
examples,
and
follow
the
step-by-step
illustrations
of
their
usage.
The
understanding
of
the
more
advanced
disk
programming
techniques
will
dependtoa
large
degree
upon
how
well
the
fundamentals
have
been
mastered.
To
facilitate
your
understanding
and
masteryofCommodore
BASIC,
two
computer
terms
are
stressed
in
this
Chapter:
Block
Availability
Map
(BAM)
and
Disk
Operating
System
(DOS).
Although
these
are
conventional
terms,
they
will
be
riefly
discussed
as
they
relate
to
Commodore
Floppy
Disk
Usage.
15
Page 23
THE
BLOCK
AVAILABILITY
MAP
(BAM)
The
BAM
isadisk
memory
representation
of
available
and
allocated
space
on
a
disk.
When
the
system
stores
informationona
disk,
the
BAM
willbeauto
matically
referenced
by
the
DOS
to
determine
what
space
is
available
and
how
many
blocks
can
be
allocated.
Iff
sufficient
space
is
available
to
storeagiven
file,
it
will
be
stored
on
the
disk
and
the
BAM
updated
to
account
for
the
space
allocated.
However,
if
the
DOS
detects
thatafile
will
occupy
more
space
than
available,
an
error
message
will
be
generated.
Formatting
a
disk
creates
the
BAM
which
is
then
loaded
into
DOS
memory
upon
initialization.
The
BAM
is
stored
on
diskette
in
varying
locations
depending
upon
the
drive
used:
BAM
Location
and
Memory
Required
Track
18,
Sector0128
bytes
As
changes
occur
to
the
BAM
in
DOS
memory,
the
BAM
on
disk
will
be
updated
to
reflect
these
changes.
Updates
to
the
BAM
occur
whenaprogram
is
saved
or
a
CLOSE
is
performed
onanew
SEQuential
data
file.
THE
DISK
OPERATING
SYSTEM
(DOS)
The
DOS
is
responsible
for
managing
information
exchange
between
the
disk
controller
and
the
computer.
The
DOS
performs
many
functions
which
are
transparent
to
the
user
but
which
are
vital
to
the
operation
of
the
system.
For
example,
the
DOS
monitors
the
input/output
(I/O)
of
the
disk
so
that
channels
are
properly
assigned
and
that
no
lengthy
waits
for
an
open
channel
occur.
In
addition
to
monitoring
of
disk
I/O,
the
DOS
also
uses
the
channel
structure
to
search
the
directory
and
to
delete
and
copy
files.
DISK
MAINTENANCE
COMMANDS
The
following
disk
commands
permit
the
user
to
perform
file
manipulation
and
disk
maintenance.
16
Page 24
Diskette
Level
<
File
Level
<
BASIC
COMMAND
NEW
INITIALIZE
LOAD
"$"
VALIDATE
COPY
RENAME
SCRATCH
FUNCTION
Formatsadisk
Prepare
diskette
for
use
Read
disk
directory
Reconstruct
Block
Availability
Map
(BAM)
Copies
files
(optional
con
catenation)
Renamesafile
Erasesafile
NOTE:
Diskette
commands
can
be
transmitted
to
the
disk
by
PRINT#
com
mands.
The
examples
in this
chapter
assume
thatafile
has
been
opened
with
the
OPEN
15,
8,
15
command.
If
the
error
message?FILE
OPEN
ERROR
ap
pears
upon
typing
the
OPEN
command,
it
means
that
the
logical
file
was
opened
but
had
not
been
properly
closed.
When
this
error
appears
such
logical
file
mustbeproperly
closedbytyping
CLOSE
15.
NEW
Each
timeadiskette
is
placed
in
one
of
the
drives,
both
the
diskette
and
the
drive
must
be
prepared
for
use.Apreviously
unused
diskette
must
first
be
formatted
in
the
soft-sector
format
recognized
by
your
particular
disk
drive.
This
may
be
accomplished
by
use
of
the
NEW
disk
command.
To
use
the
NEW
command,
to
format
the
diskette
and
initialize
the
disk
drive,
enter
the
command:
PRINT#15,
"commandstring"
where
15
is
the
logical
file
number
ofafile
which
has
been
opened
to
the
disk
command
channel
(primary
address
8,
secondary
address
15).
The
format
of
NEW
is:
17
Page 25
"NEWdr:fn,xx"
or
"Ndrfnjcx"
Where
d=the
drive
number0(0
may
be
omitted)
fn=the
file
name
you
wishtoassigntothe
disk.Itmaybeup
to
16
characters
long.
xx=a
unique
two-character,
alphanumeric
identifier
supplied
by
the
user.
The
NEW
command
(with
ID
specified)
is
used
on
an
unformatted
diskette
or
one
which
the
user
wishestoreformat.
NEW
creates
the
block
headers,
writing
the
sync
characters,
disk
ID,
and
track
and
sector
numbers
at
the
beginning
of
each
block.
The
directory
header
and
the
BAM
are
created
and
the
diskette
is
made
readytoaccept
data.
The
command
maybeusedonan
already
formatted
diskette
(with
no
ID
specified)
to
clear
the
disk
directory
and
reinitialize
the
BAM,
deallocating
all
blocks
on
the
diskette.
The
time
involved
in
reformatting
withoutanIDismuch
less
than
formatting
withanID.
Example1:OPEN
15,8,15
PRINT#15,
"NO:TESTDISK,
88"
These
commands
will
open
the
command
and
error
channeltothe
disk
drive
and
format
a diskinthe
drive,
givingita
disk
identifer
of
88.
The
following
simplified
form
maybeused
for
this
purpose:
Example
2:
OPEN
15,
8,15,
"NO:TESTDISK,
88"
Here'sanexampleofreformatting
a diskette
using
the
NEW
command
and
no
disk
ID.
Example
3:
OPEN
1,8,15,
"NO
:NEWNAME"
The
diskette
will
be
assigned
the
name
"NEWNAME"
and
the
directory
and
BAM
will
be
cleared.
This
procedure
will
work
only
if
the
diskette
has
been
formatted.
The
NEW
disk
command
SHOULD
NOT
be
confused
with
the
NEW
command
18
Page 26
in
BASIC.
The
latter
will
delete
the
program
currently
in
memory
and
clear
all
variables
before
enteringanew
program.
INITIALIZATION
Wheneveradiskette
is
inserted
into
the
drive,
for
any
reason,
it
MUST
be
initialized
to
ensure
that
the
information
on
the
BAM
(in
the
disk
memory)
is
the
proper
information
for
the
diskette
currently
in
the
drive.
Failure
to
proper
ly
initialize
a
diskette
each time
it
is
inserted
or
reinserted
into
the
drive
will
result
inaDISK
ID
MISMATCH
ERROR
and/or
loss
of
data.
The
VIC-1540
utilizes
a
DOS
2.6
software
routine
each
time
the
disk
is
ad-
dresed
to
determine
if
initialization
is
required.
Ifadifferent
ID
is
detected, the
VIC-1540
will
automatically
initialize
the
new
disk.
Operator
initialization
is
not
required
if
unique
IDs
are
assigned
each
diskette.
The
format
of
INITIALIZE
command
is:
PRINT#15,
"INITIALIZEdr"
Where:
dr=drive
number0(0
may
be
ommitted).
Note:
You
may
abbreviate
INITIALIZEtoI.
Example1:OPEN
15,
8,15
PRINT#15,"I0"
Example2:OPEN
15,
8,15,"I"
(You
may
omit
the
closing
double
quotation)
NOTE:
FILE
OPEN
ERROR
could
occurifa
previously
opened
file
was
ad
dressed
withasecond
OPEN
command.
When
this
error
appears
such
logical
file
must
be
properly
closed
by
typing
CLOSE
lfn.
The
disketteinthe
driveisnow
initialized.
Do
not
confuse
formatting
and
initialization.
Remember
that
formatting
is
usuallyaone-time
operation
and
that
re-formatting
a
disk
will
destroy
previously
stored
data.
Since
the
VIC-1540
initialization
function
depends
uponachange
of
ID
to
detectachange of
diskette,
inserting
a
diskette
with
an
ID
identical
to
one
previously
used
may
lead toaloss
of
data.
This
happens
because
the
computer
will
reference
the
BAM
left
over
from
the
previous
diskette.
Since
the
IDs
are
19
Page 27
identical
the
DOS
assumes
there
have
beennochangeofdiskette.
A
SAVE
command
may
now
cause
new
datatobe
written
over
good
data
already
present
on
the
disk
because
the
DOS
will
use the
old
map
of
available
storage
area,
instead
of
the
current
one.
The
results
are
unpredicable,
and
the
diskette
may
become
totally
useless.
For
this
reason,
unique
disk
IDs
must
be
used
when
ever
possible
for
each
diskette.
THE
DIRECTORY
Confirm
that
the
newly
formatted
disk
has
the
correctIDand
disk
name
by
using
oneofthe
following
methodstolist
the
directory.
The
directory
display
includes
the following
information:
Disk
name
Disk
ID
DOS
version
number
File
name
File
type
Numberofblocks
used
Number
of
available
(free)
blocks
To
list
the
directory,
at
first
type
LOAD
"$0",
8.
(LOAD
"$",
8)
LOADS
This
procedure
will
destroy
any
program
currently
in
computer
memory
when
the
directory
is
LOADed.
STEP
1:
Placeaformatted
disk
in
the
drive.
STEP
2:
Type:
LOAD'T',8then
press
RETURN.
The
screen
displays:
LOAD"$",
8
SEARCHING
FOR
$
LOADING
READY'
STEP
3:
Type:
LIST
The
directory
for
the
drive
willbedisplayed.
20
Page 28
Printing
The
Directory
Quite
often,itbecomes
convenient
to
affixadiskette
directory
listing
directly
on
the
protective
jacket.
This
permits
the
user
to
scan
the
printed
directory
listing
without
having
to
insert
the
diskette
into
the
drive
to
obtain
this
in
formation.
Should
you
desiretoprint
the
directory,
place
the
disketteinthe
drive
and
enter
the
following
commands:
LOAD
"$",
8
Loads
the
directory.
OPEN
4,
4:CMD4
Opens
device4(printer)
and
changes
the
primary
output
deviceto4.
LIST
Prints
the
directory.
PRINT#4:CLOSE4
Returns
output
to
the screen
and
closes
the
file.
VALIDATE
The
VALIDATE
command
traces
through each block
of
data
contained
in
all
files
on
the
diskette.
If
this
trace
is
successful,
a
new
BAM
is
generated
in
the
disk
memory
and
written to the
diskette.
Any
blocks
which
have
been
allocated
but
are
not
associated
withafile
name,
as
in
the
case
of
direct
access
files
will
be
freed
for
use.
In
addition
to
reconstructing
the
BAM,
VALIDATE
deletes
files
from
the
directory
that
were
never
properly
closed.
IfaREAD
error
is
encountered
duringaVALIDATE,
the
operation
aborts
and
leaves
the
diskette
in
its
pre
vious
state.
IfaVALIDATE
error
does
occue,
you
must
re-initialize
before
proceeding.
The
formatofVALIDATE
is:
PRINT#15,
"VALIDATEdr"
Where:
dr=drive
number0(0
may
be
ommited)
NOTE:
You
may
abbreviate
VALIDATE
to
V.
Example:
OPEN
1,8,15
PRINT#l,"V0"
21
Page 29
or
OPEN1,8,15
"V"
COPY
The
COPY
command
allows
you
to
create
multiple
copies
(under
different
names)offilesonthe
same
diskette.
This
command
can
alsobeusedtocon
catenate
data
files.Upto
four
source
files
canbeconcatenated
into
the
destina
tion
file.
The
COPY
command
may
be
abbreviated
withaC.
COPY
disk
command
canbeformatted
two
ways
depending
upon
application:
To
copyasingle
file:
PRINT#1
fn,
"COPYddr:dfn=sfn"
or
PRINT#lfn,
"Cddr:dfn=sdr:sfn"
To
concatenate
and
copy:
PRINT#lfn,
"COPYddr:dfn=sfn,
sdnsfn
...
or
PRINT#lfn,
"Cddr:
dfn=sdr;sfn,
sdnsfn
Where:
ddr=is
the
destination
drive0(0
may
be
ommitted)
dfn=is
the
destination
file
name.
This
name
must
beanew
name.
sdr=is
the
source
drive0(0
may
be
omitted)
sfn=is
the
source
file
name.
Example
1:
PRINT#1,
"CO:ACCT1=0:ACCT"
A
file
named
ACCT,
is
copied
underanew
name
ACCT1
Example
2:
PRINT#1,"CO:JDATA=O:
ACCT1,
0:
ADATA,
O:BDATA"
Files
are
concatenated
intoafile.
Note
that
file
names
shouldbeshort,
as
the
maximum
lengthofa disk
command
stringis40
characters.
NOTE:
The
COPY
command
is
normally
used
in
the
Dual
Drive
Floppy
disk
to
copy
files
from
one
diskettetoanother.
But
this
function
can
not be
used
in
the
VIC-1540
which
isaSingle
Drive
Floppy
Disk.
22
Page 30
RENAME
The
RENAME
command
renamesanexisting
file.Afile
can not
already
exist
with
the
file
name
specified
in
the
commandorthe
FILE
EXISTS
error
message
willbegenerated.
The
formatofRENAME
is:
PRINT#lfn,
"RENAMEdr:nfn=ofn"
Where:
dr=the
drive
number0(0
may
be
ommitted)
nfn=the
new
name
of
the
file.
ofn=the
old
nameofthe
file.
lfn=a
logical
file
number.
You
assign
this
number
arbitrarily
and
it
maybeany
whole
number
between1and
255.
NOTE:
The
letterRisalegal
abbreviation
for
RENAME.
NOTE:
Close
any
open
files
before
using
the
RENAME
command
since
the
disk
will
not
execute
this
command
on
any
active
files.
SCRATCH
The
SCRATCH
command
erases
unwanted
files
from
the
specified
diskette
and
its
directory.
You
can
eraseonfile,
several
files,orall
the
filesona
diskette.
The
formatofSCRATCH
IS:
PRINT*
lfn,
"sdr:fn,
dr:fn
. ..:dr:fn"
Where:
dr
is
the
drive
number
0.
(0
may
be
omitted)
fn
is
the
name
of
the
file
to
be
erased.
To
erase
one
file
enter,
the
entire
nameofthe
file:
Example:
PRINT#1,
"SO:ACCT"
To
erase
several
files
with
unrelated
names,
enter
the
entire
name
of each
file
to
be
deleted:
23
Page 31
Example:
PRINT#1,
"SO:ACCT,
CUSTOMER,
INV"
To
erase
several
files
at
one
time
when
names
have
something
in
common,
refer
to the
rulesinclapter8concerning,
pattern
matching.
You
may
erase
all
files
onadiskette
using
pattern
matching
as
in
the
following
example:
Example:
PRINT#1,
"SO:*"
NOTE
24
Page 32
Chapter
4
BASIC
COMMANDS
FOR
DATA
HANDLING
BASIC
COMMANDS
ASSOCIATED
WITH
FLOPPY
DISK
DRIVES
The
BASIC
commands
described
in
this
chapter,
allow
the
user to
communicate
with
and
transfer
datatoand
from
the
disk
drive.
These
commands
are
available
for
ALL
versions
of
Commodore
BASIC:
OPENlfn,
8,
sa,
"dr:fn,
ft,
mode"
VERIFY
"dr.fn",
8
CLOSElfn
PRINT#lfn
LOAD
"dr:fn"
8
GET#lfn
SAVE
"dr:fn",
8
INPUT#lfn
Where:
lfn=logical
file
number
(any
number
between1and
255)
fh=file
name
suppliedbyuser
dr=disk
drive
number0:
(0
may
be
omitted)
8=device
number
(8
for
disk,2for
second
cassette,
4
for
printer)
sa=secondary
address
ft=the
file
type.
It
may
be
SEQ
(for
sequential),
USR
(for
user),
or
PRG
(for
program)
mode=either
READ(R)
or
WRITE(W).
All
upper-case
characters
shown
in
format
are
essential
for
the
proper
execution
ofacommand
and
must
be
typed
by
use.
These
commands
are
entered
via
the
keyboard
using
unshifted
characters only.
NOTE:
The
device
numberofthe
disk
driveissetat8atthe
factory
prior
to
shipment.
If
you
wish
to
change
the
device
number
to
use
multiple
number
of
VIC-1540
etc.
Please
consult
your
Commodore
dealer
(the
device
number
may
be
any
number
from8to
11)
25
Page 33
SAVE
(Writing
a
Program
toaDiskette)
Ifaprogramisin
computer
memory,itcanbemovedtoa
diskette
for
storage.
Thisisaccomplished
with
the
SAVE
commands.
Any
data
transferred
with
the
SAVE
command
are
automaticaly
designated
by
the
DOS
asaprogram
(PRG)
file.
Command
transfers
PRG
files
from
the
computer's
memory
to
the
specified
diskette.
You
must
specify
the
drive
number,
the
program name, and
the
device
number.
The
device
number
will
default
to
device1which
is
the
tape
unit
if
it
is
not
specified.
The
format of
SAVE
is:
SAVE"dr:fn",
dn
Where:
dr=is
the
drive
number0(0:
may
be
omitted)
fn=is
any
file
name
of
16
characters
or
less
you
wish
to
assign
to
the
file
to
be
transferred
to
the
diskette.
Blanks
are
counted
as
characters.
dn=is
the
device
number
anditmustbe8.
This
following
example
illustrates
creating
a
one
line
program,
SAVEing
it
on
the
diskette
in
the
drive
under
the
name
TESTPROG.
Example:
10?"THIS
ISATEST"
SAVE"0:TESTROG",
8
Another
formatofSAVE
is
SAVE"@dr:fn",dn
Where
@=means
to
replace
the
contents
of
an
existing
diskette
file.
fn=is
the
nameofthe
diskette
file
whose
contents
istobe
replaced.
Example:
SAVE
"@0:
TESPROG",
8
In
this
caseaprogram
named
TESTPROG
will
be
replaced,
but
if
the
specified
program
does
not
exist,
then
normal
SAVE
procedures
are
executed.
NOTE:
In case@is
used
in
the
SAVE
command,
avoid
its
repeated
use.
If
@
must
be
repeatedly
used,
execute
the
VALIDATE
command
before
the
SAVE
command.
26
Page 34
VERIFY
The
VERIFY
command
performsabyte-by-byte
comparison
of
the
file
just
writtentothe
diskette
against
the
fileinthe
computer's
memory.
The
format
of
the
VERIFY
command
is:
VERIFY
"dr:fn",dn
Where:
dr=the
drive
number0(0:
may
be
omitted)
fn=the
same
file
nameasusedinthe
immediately
proceding
SAVE
command.
dn=the
device
number,inthis
case
8.
Another
formatofVERIFY
is:
VERIFY
"*",dn
Where:*causes
the
program
just
savedtobe
verified.
You
should
give
the
VERIFY
command
everytime
you
use
the
SAVE
command
to
placeafile
onadiskette.
If
you
do
this,
you
will
always
know
whether
or
not
the
file
was
copied
correctly.
LOAD
(Reading
a
Program
fromaDiskette)
A
program
stored
on
diskette
may
be
loaded
into
memory
using
the
LOAD
command.
The
LOAD
command
transfers
PRG
files
from
the
specified
diskette
to
the
computer's
memory.
You
must
specify
the
drive
number,
the
program
name,
and
the
device
number.
The
device
number
will
default
to
unit1which
is
the
cassette
unit.
The
formatofLOAD
is:
LOAD"dr:fn",
dn
Where:
dr=is
the
drive
number
0.
(0:
may
be
omitted)
fn=is
the
file
name
previously
specified
in
the
SAVE
command
and/or
stored
in
the
disk
directory.
27
Page 35
dn=is
the
device
number
and
it
must
be
8.
The
following
example
illustrates
howaprogramisloaded
from
the
diskette
into
the
computer
memory,
then
executed.
To
do
this
example,
first
type
NEW
and
depress
RETURN
keytoclear
your
computer's
memorysothat
you
can
see
that
it
really
works.
Don't
confuse
the
NEW
command
in
BASIC
with
the
NEW
disk
command
usedtoformat
your
disk.
Example1:LOAD"0:TESTPROG",
8
READY.
RUN
THISISA
TEST
A
successful
LOAD
closes
all
open
files.
Therefore
you
must
giveanew
OPEN
command
in
order
to
continue
communicating
with
the
disk
drive
command
and
error
channel.
OPEN
This
command
sets
upacorrespondence
betweenalogical
file
number
and
a
file
which
exists
on
disk.
It
also
reserves
the
buffer
space
within
the
disk
unit
for
operations
on
the
file
being
opened.
The
format
of
the
complete
OPEN
command
is:
OPENlfn,
dn,
sa,
"dr:fn,
ft,
mode"
Where:1fn=the
logical
file
number
dn=the
device
number,inthis
case
8.
sa=the
secondary
address.
It
maybeany
number
from2to14and
maybeused
either
for
inputoroutputasspecified
in
mode.
See
note
below
dr=the
drive
number
0.
(0:
may
be
omitted)
fn=the
name
of
the
file.
ft=the
file
type.
It
may
be
SEQ
(for
sequential),
USR
(for
user),
or
PRG
(for
program).
mode
describes
how
the
channel
is
to
be
used.
It
may
be
either
READ
(R)
or
WRITE
(W).
28
Page 36
NOTE:
Secondary
address15is
the
command
and
error
channel
and
has
special
uses
which
are
discussedinsubsequent
chapters.
Secondary
addressed
0
and
1
are
reservedbythe
operating
systems
(BASIC
and
DOS)
for
LOADing
and
SAVEing
programs.
Examples:
OPEN2,8, 2,
"O:FILE1,
SEQ,
WRITE"
OPEN
3,8,9,
"O:TESTDATA,
PRG,
WRITE"
OPEN8,8, 8,
,,0:NUM,USR,
READ"
The
contentsofan
existing
file
maybereplacedbypreceding
the
drive
number
with
an
at
sign
(@)
in
the
OPEN
command.
OPEN3,8,5,"@0:JDATA,
USR,
WRITE"
If
the
spefified
file
does
not
exist,
then
normal
OPENing
procedures
are
exe
cuted.
You
can
also
assign
some
of
the
OPEN
parameters
toavariable
name
as
il
lustrated
in
these
examples:
Example
1:
FL$="0:FILEA,
SEQ,
READ"
OPEN
1,8,14,
FL$
Example2:FL$="0:FILEA"
OPEN1,8,14,
FL$+",
SEQ,
WRITE"
The
preceding
methods
are
convenient
when
it
is
necessary
to
open
several
channelstothe
same
file
name.
CLOSE
The
CLOSE
command
closesafile
opened
by
the
OPEN
command.
Its
format
is:
CLOSE
lfn
Where:1fn=the
logical
file
number
ofafile
opened
by
the
OPEN
command.
Always
closeafile
after
working
with
it.
You
are
not
allowed
to
have
more
than
ten
open
files
in
the
computer
and
five
in
the
disk
drive,
so
it
is
prudent
to
make
a
habit
of
closing
files
as
soon
as
possible.
This
way
you
will
always
have
the
29
Page 37
maximum
numberoffiles
available
for
use.
CLOSING
THE
COMMAND
CHANNEL
Closing
the
command
channel
closes
all
channels
associated
with
the
disk
drive.
No
other
partofthe
logical
file
environment
is
affected.
That
is,
the
computer
does
not
recognize
that
the
files
have
been
closed.
The
following
example
illustrates
a
situation
in
which
several
channels
are
closed
downbya
single
CLOSE
command.
Example:
The
command
channelisopened.
OPEN3,
8,
2,
"0:FILE1,SEQ,
WRITE"
Data
Channels
are
opened
for
OPEN4,
8, 5,
"O:FILE2,
SEQ,WRITE"
writing.
PRINT#3,
"IMPORTANT
DATA"
PRINT#4,
"MORE
DATA"
OPEN3,
4
A
channel
is
opened
to
the
printer
by
mistake.
?FILE
OPEN
ERROR?
An
error
messageisdisplayed
on
READY.
the
screen.
a
Since
there
was
an
error,
all
logical
files
in
the
computer
are
closed,
but
the
channelsinthe
disk
drive
are
still
open.Toclose
the
disk
channels,
type:
OPEN1,8,15
CLOSE1
Now
all
data
channelsinthe
disk
drive
are
properly
closed.
CLOSING
THE
DATA
CHANNEL
The
CLOSE
command
closesafile
and
the
data
or
command
channel
associated
with
it.
Whenever
you
closeafile
opened
with
a write
channel,
the
closing
of
that
file
writes
the
final
block
of
data
to
the
disk
and
updates
the
disk
directory.
When
you
closeafile
opened
witharead
channel,
that
channel
is
simply
closed
down.
NOTE:
Whenadrive
is
initialized
with
INITIALIZE,
NEW,
or
VALIDATE,
all
30
Page 38
channels
associated
with
that
drive
are
deleted.
These
commands
should
not
be
executed
when
there
are
any
files
open
since
the
files
will
be
disrupted.
PRINT*
The
PRINT#command
transmits
a
disk
command
string
to
the
drive.
The
formatofPRINT#
is:
PRINT#lfn,
"commandstring"
Where:
lfn
=a
file
previously
opened
using
secondary
address
15
"commandstring"=disk
handling
or
disk
file
handling
commands.
These
disk
commands
are
discussedindetailinChapter3of
this
manual.
PRINT#
may
also
be
used
to
transmit
data
toapreviously-opened
sequential
or
user
file.
In
CBM
BASIC
V2
the
logical
file
number1to
127
send
carriage
return
alone
and
the
logical
file
number
128
to
255
send
CRLF.Asemicolon
(;)must
be
used
asaterminator
for
each
PRINT#
statement
when
using
the
logical
file
number
128to255toavoid
sending
extraneous
line
feedstothe
diskette.
It
is
important
to
be aware of
this
face
because
the
carriage
return
alone
is
seen
asaterminatory
by
the
DOS.
The
line
feedisthen
storedinthe
fileasthe
first
character
in
the
next
record.
To
avoid
this,
use
the
following
format:
Example:
PRINT#128,
"JONESABC";
CHR$(13);
The
CHR$(13)
is
the
carriage
return
necessary
for
the
proper
terminating
of
the
record
on
the
disk.
When
that
record
is
input,
the
result
will
be
JONESABC
whichisthe
desired
result.
The
following
format
may
that
be
used:
PRINT#lfn,A$
It
will
produce
the
desired
value
of
A$
for
the
record,
and
will
not
interfere
with
the
next
record.
Several
variables
maybewrittentothe
diskatthe
same
time.
31
Page 39
The
format:
PRINT#lfn,A$,B$,C$
will
result
inasingle
variable
(A$+B$+C$)
being
retrieved
by
the
input
command.
The
format:
PRINT#lfn,A$CHR$(13)B$CHR$(13)C$
will
result
in
the
variables
A$,
B$,
and
C$
being
separated
by
carriage returns,
and
they
may
thenbeinputasseparate
variables.
INPUT*
The
INPUT#
command
is
used
to
transfer
information
fromaperipheral
device
such
as
the
disk
drive
into
computer
memory.
INPUT#is
valied
only
when
used
inaprogram
and
only
when
referencing
a
logical
file
that
has
been
OPENed
for
input.
The
format
for
INPUT*is:
INPUT#1
fn,
A$
or
INPUT#1
fn,
A
Where:
1
fn=file
previously
opened
using
secondary
address
15
A$=astring
variable
which
will
contain
the
data
transferred.
A=a
numeric
variable
which
will
contain
the
data
transferred.
INPUT
may
also
be
used
to
transfer
several
strings
of
data
at
one
time:
INPUT#lfn,A$,B$,C$
Where:
A$,
B$,
C$
will
contain
the
data
transferred
from
the
disk.
In
this
format,
the
data
strings
must
have
been
separated
by
carriage
returns
(
CHR$(13)
)
at
the
time
they
were
written
to
the
disk
in
order
to
be
retrived
separately.
No
single
string
may
contain
more
than
88
characters
if
it is
to
be
INPUT.
32
Page 40
Example
1:
.
20
INPUT#2,
A
Input
the
next
data
item
which
must
be
in
numeric
form
and
assign
the
valuetoaviable
A.
Example
2:
10INPUT#8,A$
Input
the
next
data
item
asastring
and
assign
it
to
variable
A$.
Example
3:
60
INPUT#7,
B,
C$
Input
the
next
two
data
items
and
assign
the
first
to
numeric
variable
B
and
the
second
to
string
variable
C$.
For
strings
longer
than
88
characters,
the
GET#
commmand
must
be
used.
GET#
The
GET#
command
is
used
to
transfer
individual
bytes
of
information
from
an
serial
device
such
as
the
disk
drive
into
computer
memory.
GET#
is
valid
only
when
usedina
program
and
only
when
referencing
a
file
that
has
been
OPENed.
The
format of
GET#is:
GET#lfn,A$
Where:
lfn=a
file
previously
opened
using
secondary
address
15
A$=a
string
variable
which
will
contain
the data
transferred.
GET#
may
also
be
used
to
transfer
several
bytes
of
information,
which
is
useful
for
retrieving
strings
which
has
been
written
to
the
disk
inaformat
which
is
unacceptable
for
the
INPUT
command
(strings
longer
than
88
characters).
33
Page 41
Forexampel:
10AA$=""
20
FOR
1=1TO254
30GET#lfn,A$
40
AA$=AA$+A$
50
NEXT
isaprogram
segment
which
would
result
inastring
of
length
254
being
trans
ferred
from
the
disk
(logical
file
number
lfn) to
the
computer
memory
and
stored
in
the
variable
AA$.
MOVINGATAPE
PROGRAM
TO
DISK
This
example
illustrates
a
session
with
the
computer,atape
cassette
andadisk
drive.
The
purpose
is
to
copyacassette
program
toadiskette.
The
program
is
than
read
from
the
diskettetothe
computer's
memory
and
printed.Itis
assumed
that
the
BASIC
program
was
previously
stored
on
the
cassette.
Example:
LOAD"DEMO"
PRESS
PLAY
ON
TAPE
OK
SEARCHING
FOR
DEMO
FOUND
DEMO
LOADING
READY.
SAVE"DEMO",8
VERIFY
"DEMO",
8
READY.
NEW
LOAD
"DEMO",
8
SEARCHING
FOR
DEMO
LOADING
READY.
RUN
Load
the
file
from
the
cassette
tape
to
the
computer's
memory.
Createaprogram
file
containing
the
programondiskette.
Erase
everything
from
memory.
(The
NEW
command
in
BASIC
will
clear
memory;
the
NEW
disk
command
will
formatadisk.)
Load
the
program
back
into
the
com-
putegr's
memory
Run
the
program
to
verify
it
has
been
loaded.
34
Page 42
Chapter
5
ADVANCED
DISK
PROGRAMMING
This chapter
provides
detailed
information
about
DOS
structure
and
disk
utility
commands.
The
utility
commands
provide
the
programmer
with
low-level
func
tions
that
may
be
used
for
special
applications
such
as
special
disk
handling
routines
and
random
access
techniques.
COMMODORE
DISK
OPERATING
SYSTEM
(DOS)
The
DOS
file
interface
controller
is
responsible
for
managing
all
information
be
tween
the
disk
controller
and
the
serial
interface.
Most
disk
I/O
is
performed
on
a
pipelined
basis,
resulting
inafaster
response
to a
requested
operation.
The
file
system
is
organized
by
channels
which
are
opened
with
the
BASIC
OPEN
statement.
When
executed
with
the
OPEN
statement,
the
DOS
assigns
a
workspace
to
each
channel
and
allocates
either
one
or
two
disk
I/O
buffer
areas.
If
either
the
workspaceorthe
bufferisnot
available,
a
NO
CHANNEL
error
is
generated.
The
DOS
also
uses
the
channel
structure
to
search
the
directory,
and
to
delete
and
copy
files.
Three
of
the
eight
buffers
are
used
by
the
DOS
for
the
Block
Availability
Maps
(BAM),
variable
space,
command
channel
I/O,
and
disk
controller's
job
queue.
The
job
queueisthe
vital
link
between
the
two
controllers.
Jobs
are
initiated
on
the
file
sidebyproviding
the
disk
controller
with
sector
header
and
type
of
operation
information.
The
disk
controller
seeks
the
optimum
job
and
attempts
execution.
An
error
condition
is
then
returned
in
plade
of
the
job
command.
If
the
job
is
unsuccessful, the
file
side
re-enters
the
jobagiven
number
of
times,
depending
upon
the
operation,
before
generating
an
error
message.
The
secondary
address
giveninthe
OPEN
statementisusedbyDOSasthe
channel
number.
The
number
the
user
assignstoa
channelisonlyareference
number
thatisusedtoaccess
the
work
areas,
andisnot
relatedtothe
DOS
orderingofchannels.
The
LOAD
and
SAVE
statements
transmit
secondary
35
Page 43
addresses
of0and
1,
respectively.
The
DOS
automatically
interprets
these
secondary
addresses
as
LOAD
and
SAVE
functions.
Unless
these
functions
are
desired
when
opening
files,
avoid
secondary
addresses
of0and
1.
The
remaining
numbers,
2 through
14,
may
be
used
as
secondary
addresses
to
open
up
to
five
channels
for
data.
Special
OPEN
and
CLOSE
Statements
for
Direct
Access
The
BASIC
statement:
OPEN2,8,4,
"#"
or
OPEN2,8,4,
"#7"
opensachanneltoone
buffer,tobe
used
with
the
block
commands. The
first
available
bufferisallocatedtochannel4in
the
first
example.
The
second
exampleisan
attempttoallocate
buffer7to
the
channel.Ifthe
buffers
are
not
available,
a
NO
CHANNELS
error
conditionisgenerated.
The
explicit
buffer
allocation
canbeusedtoreserve
a buffer
for
position
dependent
code
as in
the
caseofan
execute
command.
You
can
find
the
number
of
the
allocated
buffer
by
executing
a
GET#
state
ment.
The
byte
transmitted
is
the
buffer
number.
The
only
time
you
can
get
a
buffer
numberisbefore
any
writeorread
operationtothat
buffer.
The
CLOSE
statement
clears
the
opened
channel
and
writes
the
BAMtothe
diskette
that
was
last
usedbythat
channel.Itis
recommended
thattoavoid
con
fusion,
you
limit
yourself
to accessing
one
drive
with
any
direct
access
channel.
DISK
UTILITY
COMMAND
SET
The
disk
utility
command
set
consistsofthe
following
commands:
Commands
BLOCK-READ
BLOCK-WRITE
BLOCK-EXECUTE
BUFFER-POINTER
BLOCK-ALLOCATE
BLOCK-FREE
memory-write
memory-read
memory-execute
USER
Abbreviations
B-R
B-W
B-E
B-P
B-A
B-F
M-W
M-R
M-E
U
General
Format
"B-R:"ch,dr,t,s
"B-W:"ch,dr,t,s
"B-E^'ch.dr.t.s
"B-P:"ch,p
"B-A:"dr,t,s
"B-F:"dr,t,s
"M-W"adl/adh/nc/data
"M-R"adl/adh
"M-E"adl/adh
"Ui:parms"
36
Page 44
Where:
ch
=
the
channel
number
in
DOS:
identical
to
the
secondary
address
in
the
associated
OPEN
statement.
dr
=
the
drive
number:
0
t
=
the
track
number:1through
35.
s
=
the
sector
number,0through
20.
For
each
track
number,
the
sector
rangeisshowninTable
4.
p
=
the
pointer
position
for
the
buffer
pointer.
adl=the
low
byte
of
the
address*.
adh=the
high
byte
of
the
address*.
nc
=
the
number
of
characters:
1
through
34*.
data=the
actual
data
in
hexidecimal.
This
is
transmitted
by
using
the
CHR$
function,
i.e.
CHR$(1)
would
send
the
binary
equivalent
of
hexidecimal
01,
(decimal
1).
i
=
the
index
to
the
User
Table.
parms=the
parameters
associated
with
theUcommand
(optional).
The
values
used
in
conjunction
with
the
memory
commands
exist
in
the
VIC-
1540
as
hexidecimal
values
and
must
be
transmitted
as
CHR$(n),
wherenis
the
decimal
equivalent
of
the
desired
hexidecimal
value.
NOTE:
If
using
variables
the
format
must
have
only
the
command
in
quotes.
For
example:
"B-R:"ch,dr,t,s
correct
"B-R:ch,dr,t,s"
incorrect
To
avoid
confusion,
it
is
good
practice
to
use
this
format
when
using
variables
or
constants.
As
implied
in
the
preceding
format,
these
commands
may
be
abbreviated
to
the
first
character
of
each
of
the
key
words.
Abbreviations
only
are
accepted
for
those
commands
shown
in
lower
case.
The
parameters
associated
with
each
com
mand
are
searched
for
starting
atacolon
(:),
or
in
the
fourth
character
position
ifacolon
is
not
present.
The
example
following
shows
four
ways
that
the
same
block-read
command
may
be
given.
37
Page 45
NOTE:
Initialize
the
disk
before
the
buffer
readorwrite.
Examples:
"BLOCK-READ:
"
2,0,4,0
"B-R"2,0,4,0
"B-R"2;0;4;0
"B-READ:"2;0;4;0
Parameters
following
the
key
words
within
quotation
marks
maybeseparated
by
any
combination
of
the
following
characters:
Character
Name
Keyboard
Representation
Skip
<
cursor
right
>
Space Space
bar
Comma
The
useofthese
characters
permits
sending
both
ASCII
strings
and
integers.
Parameters
not
within
the
confinesofquotation
marks
shouldbeseparated
by
semi-colons
(;).
In
the
following
discussions,
a
PRINT#is
assumed
in
all
examples.
BLOCK-READ
This
diskette
utility
command
provides
direct
access
to
any
block
on
a diskette
in
either
disk
drive.
Usedinconjunction
with
other
block
commands,arandom
access
file
system
may
be
created
through
BASIC.
This
command
finds
the
character
pointerinthe
0-position
of
the
block.
Whenacharacter
in
this
posi
tion
is
accessed
with
GET#
or
INPUT#,
an
End-or-Identify
(EOI)
is
sent.
This
terminates
an
INPUT#
and
sets
the
Status
Word
(ST)
to
64
in
the
computer.
The
format
"B-R:"ch;dr;t;s
is
illustrated
in
the
following
example.
Example:
"B-R:"5;0;18;0
Reads
the
block
from
track
18,
sector0into
channel5buffer
area.
After
using
BLOCK
READ
to
transfer
the
data
to
the
buffer,
the
data
may
be
transferred
to
memory
by
INPUT*
or
GET#from
the
logical
file
opened
to
that
disk
channel
(i.e.,
using
that
secondary
address).
38
Page 46
The
Ul
command
described
under
USER
is
similar
to
the
BLOCK-READ
com
mand.
BLOCK-WRITE
When
this
commandisinitiated,
the
current
buffer
pointerisusedasthe
last
character
pointer
andisplacedinthe0positionofthe
new
buffer.
The
buffer
is
then
writtentothe
indicated
blockonthe
diskette
and
the
buffer
pointerisleft
in
position
1.
The
format
"B-W:"ch;dr;t;s
is
illustrated
in
the
following
example.
Example:
"B-W:"
7;0;35;10
Writes
channel7buffertothe
blockontrack
35,
sector
10:
The
U2
command
described
under
USER
is
similar
to
the
BLOCK-WRITE
com
mand.
BLOCK-EXECUTE
This
command
allows
partofthe
DOSoruser
designed
routinestoresideondisk
andbeloaded
into disk
drive
memory
and
executed.
B-EisreallyaB-R
with
an
addition.
The
File
Interface
Controller
begins
executionofthe
contents
after
the
blockisread
intoabuffer.
Execution
mustbeterminated
withareturn
from
the
subroutine
(RTS)
instruction.
Future system
extensions
or
user-created
func
tions
may
implement
this
command.
The
format
"B-E:"ch;dr;t;s
is
illustrated
in
the
following
example.
Example:
"B-E:"6;0;l;10
Readsablock
from
track1,sector10into
channel6buffer
and
executes
its
contents
beginning
at
position
0
in
the
buffer:
BUFFER-POINTER
This
command
changes
the
pointer
associated
with
the
given
channel
toanew
value.
This
is
useful
when
accessing
particular
fields
ofarecord
inablock
or,
if
the
block
is
divided
into
records,
individual
records
may
be
set
for
transmitting
or
receiving
data.
39
Page 47
The
format
"B-P:"ch,p
is
illustrated
in
the
following
example.
Example:
"B-P:"2;l
Sets
channel2pointer
to
the
beginning
of
the
data
area
in
the
direct
access
buffer:
BLOCK-ALLOCATE
The
appropriate
BAM
is
updated
in
the
DOS
memory
to
reflect
the
indicated
block
as
allocated
(used).
In
future
operations,
the
DOS
skips
over
the
allocated
block
when
saving
programs
or
writing
sequential
files.
TTie
updated
BAM
is
written
to
diskette
upon
the
closure
ofawrite
file
or
the
closure
ofadirect
access
channel.
If
the
block
requested
has
been
previously
allocated,
the
error
channel
indicates
the
next
available
block
(increasing
track
and
sector
numbers)
withaNO
BLOCK
error.
If
there
are
no
blocks
available
that
are
greater
in
number
than
the
one
requested,
zeroes
are
displayed
as
track
and
sector
parameters.
The
format
"B-A:"dr;t;s
is
illustrated
in
the
following
example.
Example:
"B-A:"0;10;0
Requests
that
block
(sector)
0
of
track
10
be
flagged
as
allocated
on
the
diskette.
NOTE:
The
error
channel
should alwaysbecheck
when
using
BLOCK
AL
LOCATE,sothatifthe
blockisalready
allocated,
it
will
notbeoverwritten.
If
the
block
is
allocated,
the
error
message
will
also
indicate
the
next
available
block.
Example:
INPUT#15
,EN,EM$
JET
JES
Reads
the
next
track
and
sector,
respectively,
into
ET
and
ES,
as
suming
that
lfn=15
has
been
previously
OPENed
to
the
disk
error
channel.
BLOCK
FREE
The
BAMisupdatedinmemorytofree
the
block
indicated.
The
diskisup
datedona
closeaspreviously
mentioned.
Neither
the
B-A
nor
B-F
commands
40
Page 48
require
thatadirect
access
channel
be
open,
since
there
is
no
channel
relation
ship
associated
with
the
operations.
However,
if
the
BAM
is
to
be
updated
on
disk,
these
operations
should
be
used
in
conjunction
the
other
block
com
mands.
The
format
"B-F:"
dr;t;s
is
illustrated
in
the
following
example.
Example:
"B-F:"0;9;20
Freeupthe
block
(sector)20of
track
9.
MEMORY
All
three
MEMORY
commands
are
byte-oriented
so
that
the
user
may
utilize
machine
language
programs.
BASIC
statements
may
be
used
to
access
informa
tion
through
the
MEMORY
commands
by
using
the
CHR$
function.
The
system
accepts
only
M-R,
M-W,
and
M-E:
neither
verbose
spelling
or
the
use
of
the
colon
(:)
is
permitted.
Memory-Write
This
command
provides
direct
access
to
the
DOS
memory.
Special
routines
may
be
down-loaded
to
the
disk
drive
through
this
command
and
then
executed
using
the
MEMORY-EXECUTE
command
or
one
of
the
USER
(U)
commands.
Up
to
34
bytes
may
be
deposited
with
each
use
of
the
command.
The
low
byte
of
the
address
must
precede
the
high
byte
of
the
address.
The
format
"M-W:"adl/adh/nc/data
is
illustrated
in
the
following
example.
Example:
uM-W:"CHR$(00X:HR$(7X:HR$(4)CHR$(32)CHR(0)CHR$(17)-
CHR$(96)
Writes
four
bytes
to
$0700
(decimal
1792):
Memory-Read
The
byte
pointed
to
by
the
address
in
the
command
string
may
be
accessed
with
this
command.
Variables
from
the
DOS
or
the
contents
of
the
buffers
may
also
be
read
with
this
command.
The
M-R
command
changes
the
contents
of
the
error
channel
since
it
is
used
for
transmitting
information
to
the
computer.
The
next
GET#
from
the
error
channel
(secondary
address
15)
transmits
the
byte.
An
INPUT#
should
not
be
executed
from
the
error
channel
afteraMEMORY-
41
Page 49
READ
command
untilaDOS
command
other
than
oneofthe
MEMORY
com
mandsisexecuted.
The
format
"M-R:"adl/adh
is
illustrated
in
the
following
example.
Example:
"M-R"CHR$(128);CHR$(0)
Accesses
the
byte
located
at
$0080
(decimal
128):
Memory-Execute
Subroutines
in
the
DOS
memory maybeexecuted
with
this
command.
To
return
to
the
DOS,
terminate
the
subroutine
with
RTS
($60).
The
format
"M-E:"
adl/adh
is
illustrated
in
the
following
example.
Example:
"M-E"CHR$(128);CHR$(49)
Requests
the
executionofcode
beginningat$3180
(decimal
12672).
USER
This
command
provides
a
linkto6502
machine
code
accordingtoa
jump
table
pointedtoby
the
special
USER
pointer.
RefertoTable5.The
second
character
in
this
commandisusedasan
indextothe
table.
The
ASCII
character
0
through
9
orAthrough0may
be
used.
Zero
sets
the
USER
pointer
toastandard
jump
table
that
contains
linkstospecial
routines.
The
special
USER
commands
Ul
(or
UA)
and
U2
(or
UB)
can
be
used
to
replace
the
BLOCK-READ
and
the
BLOCK-WRITE
commands.
The
formatofUl
is:
"Ul:"ch;dr;t;s
Ul
forces
the
character
count
(buffer
pointer)
to
255
and
reads
an
entire
block
into
memory.
This
allows
complete
access
to
all
bytes
in
the
block.
The
format
dfU2
is:
"U2:"
ch;dr;t;s
42
Page 50
U2
writes a
buffertoa
blockonthe
disk
without
changing
the
contentsofposi
tion0as
B-W
does.
This
is
useful
whenablock
is
to
be
read
in
(with
B-R)
and
updated
(B-P
to
the
field
and
PRINT#),
then
written
back
to
diskette
with
U2.
Table3.Standard
Jump
Table
USER
DESIGNATION
Ul
U2
U3
U4
U5
U6
U7
U8
U9
U:
ALTERNATE
USER
DESIGNATION
UA
UB
UC
UD
UE
UF
UG
UH
UI
UJ
FUNCTION
BLOCK-READ
replacement
BLOCK-WRITE
replacement
jump
to
$0500
jump
to
$0503-
jump
to
$0506
jump
to
$0509
jump
to
$050C
jump
to
S050F
jump
to
$FFFA
powerupvector
U3
thru
U9
commands
are
user-defined.
The
locations
jumped
to
are
located
in
the
buffer
areas
of
RAM
and
routines
may
be
written
to
reside
there
and
down
loaded
using
the
M-W
command.
STRUCTURE
OF
DISKETTE
Any
block
onadiskette
may
be
examined
by
using
the
program
DISPLAY
T&S,
provided
on
the
TEST/DEMO
diskette.
Table4.Block
Distribution
by
Track
Track
number
1to17
18to24
25to30
31to35
Block
or
Sector
Range
0to20
0tol8
0tol7
0tol6
Total
21
19
18
17
Tables5through
11
will
assist
the
user
in
interpreting
information
obtained
using
the
DISPLAY
T&S
program.
43
Page 51
Table5.VIC-1540
BAM
Format
Track
18,
Sector
0.
BYTE
0,1
2
3
4-143
CONTENTS
18,01
65
0
DEFINITION
Track
and
sector
of
first
directory
block.
ASCII
character
A
indicating
1540
format
(Same
as
CBM
4040).
Null
flag
for
future
DOS
use.
Bit
map
of
available
blocks
for
tracks
1-35.
*1=available
block
0 =
block not
available
(each
bit
represents
one
block)
Table6.Directory
Header
Track
18,
Sector
0.
BYTE
144-161
162-163
164
165,166
166-167
171-255
CONTENTS
160
50,65
160
0
DEFINITION
Disk
name
padded
with
shifted
spaces.
Disk
ID.
Shifted
space.
ASCII
representation
for2AwhichisDOS
version
and
format
type.
Shifted
spaces.
Nulls,
not
used.
Note:
ASCII
characters
may
appearinlocations
180
thru
191onsome
diskettes.
44
Page 52
Table7.Directory
Format
Track
18,
Sector
1.
BYTE
0,1
2-31
34-63
66-95
98-127
130-159
162-191
194-223
226-255
DEFINITION
Track
and
sectorofnext
directory
block.
♦File
entry
1
*File
entry
2
♦File
entry
3
*File
entry
4
♦File
entry
5
♦File
entry
6
♦File
entry
7
♦File
entry
8
*
Structure
of
single
directory
entry
BYTE
0
1,2
3-18
19,20
21
22-25
26,27
28,29
CONTENTS
128
+type
DEFINITION
File
type
OR'ed
with
$80
to
indicate
properly
closed
file.
TYPES:0=
DELeted
1=SEQential
2=PROGram
3=
USER
4=RELative
Track
and
sector
of
1st
data
block.
File
name
padded
with
shifted
spaces.
Relative
file
only: track
and
sector
for
first
side
sector
block.
Relative
file
only:
record
size.
Unused.
Track
and
sector
of
replacement
file
when
OPEN©
is
in effect.
Number
of
blocks
in
file:
low
byte,
high
byte.
45
Page 53
Table8.
Sequential
Format
BYTE
0,1
2-256
DEFINITION
Track
and
sector
of next
sequential
data
block.
254
bytes
of
data
with
carriage
returns
as
record
terminators.
Table9.
Program
File
Format
BYTE
0,1
2-256
DEFINITION
Track
and
sector
of next
block
in
program
file.
254
bytes
of
program
into
stored
in
VIC
memory
format
(with
key
words
tokenized).
End
of
file
is
marked
by
three
zero
bytes.
Figure5illustrates
an
expanded
view ofasingle
sector
onadiskette
formatted
for
the
1540.
In
addition
to
other
information,
each
sector
contains
a
data
block
consisting
of
256
stored
characters.
Blocks
within
the
same
file
are
linked
to
gether
by
means
ofatwo
character
block
pointer.
By
pointing
to
the
location
of
the
next
data
block,
block
pointers
enable
the
system
to
retrieve
data
from
non-
continuous
blocks.
Retrieving
the
first
data
block
withinafile
triggers
a
search
for
the
next
data
block
which,
in
turn,
utilizes
block
pointers
to
locate
related
blocks
until
the
entire
file
is
assembled
and
made
available
for
display.
All
PRG,
SEQ,
and
USR
files
utilize
this
format.
A
data
block
is
addressed
by
track
and
sector.A1540
diskette
contains
35
tracks
(or
rings)
numbered1to
35.
The
number
of
sectors
per
track
will
vary
(as
illustrated
in
Table
4)
due
to
differences
in
track
circumference
and
recording
frequency.
The
1540
maintains
a
system
file
on
track
18
which
contains
the
BAM,
diskette
name,
ID,
and
file
directory.
The
BAM,
resident
in
the
first
128
bytes
of
sector
0,
monitors
available
and
occupied
storage
locations
on
diskette.
The
last
128
bytesofsector0are
usedtostore
the
diskette
name
and
ID.
The
file
directory
beginsonthe
next
sector,
sector
1.
46
Page 54
POINTERSTOLINK
Nv
TOGETHER
ALL
BLOCKS
\
WITHINAFILE
\
SYNC
08
ID1
ID2
TRACK
SECTOR
CHECK
SUM
GAP1
SYNC
07
i
I
254
BYTES
OF
DATA
CHECK
SUM
GAP
2
Fig.
5.
VIC-1540
Format:
Expanded
View
of a
Single
Sector
47
Page 55
NOTES
Page 56
Chapter
6
SEQUENTIAL
FILE
A
file
handling
of
sequential
file
which
is
the
most
basic
form
of
the
date
file
is
described
in
this
chapter.
A
sequential
fileisa
file
which
mayberead
onlyinthe
sequenceitwas
written
in.
For
example,afile
with
records,
A,Band
C,
must
be
read
in
the
sequence
of
A,BandCif
they
were
written
in
that
sequence.
The
recordCand
not
be
directly
read
without
reading
the
recordAand
B.
If
it
is
necessary
to
read
the
recordConly,
thenAandBmust
be
read
without
doing
any
work.
In
the
sequential
file,
no
partial
re-write
of
the
record
can
be
made.
Only
change
which
can
be
made
to
the
sequential
file
is
an
addition
of
new
record
to
the
end
of
the
file.
TO
CREATEASEQUENTIAL
FILE
AND
ACCESSING
The
following
steps
are
taken
to
create
a sequential
file
and
accessing.
STEP1
Openafile
for
write
in.
OPEN
2,8,2,
"0:DATE,
S,W"
A
sequential
file
withaname
DATE
is
opened
to
be
written
upon.
Note
the
designation
W
for
write
in at
the
end
of
the
command.
.STEP2Write
in
data
in
the
file
using
PRINT
#.
PRINT#2A$;B$;C$
In
this
case
the
datas
are,3string
variables,
A$,
B$,
and
C$.
STEP
3
Close
the
file
for
the
access
later
CLOSE
2
49
Page 57
STEP4
Open
the
file
withaname
DATAtobe
read
out.
The
designation
R
for
read
out
may
be
omitted.
OPEN
#2,8,2,
"0:
DATA,
S,R"
STEP
5
Read
in
the
data
from
the
sequential
file
to
the
program
using
INPUT
#.
INPUT#2,X$)Y$,Z$
STEP
6
Check
the
endofthe
filebytheSTvariable.
IF
(ST)
AND
64
THEN
CLOSE
2
EXAMPLE
OF A
SEQUENTIAL
FILE
PROGRAM
An
example
ofasimple
program
to
createasequential
file
is
shown
below.
Records
consisting
of
string
field
and
numeric
field
are
written
in
and
the
con
tents
of
the records
is
displayed
at
the
end
by
typing
END.
1
REM
***************
2
REM
*
EXfiMPLE
3
REM*REfiB&WRITE
4
REM*fl
SEQUENTIfll
5
REM*DflTfl
FILE
9
REM
***************
10
PRINT"3BW»i!INITIRlIZE
DISK."
29
DIMfl*<25>
30
DIME<25>
40
OPEN15,8,15,"I0"
60
GOSUB
1000
70
CRS=CHRf<13)
80
PRINT
90
PRINT"
WWRITE
SEQ
TEST
FILES"
95
PRINT
10Q
REM
*.**♦******♦**
101
REM
*
102
REM
*
WRITE
SEQ
103
REM
TEST FILE
104
REM
*
50
Page 58
105
REM
4************
110
0PEN2,S,2,"@Ci:SEQ
TEST
FILE
..S,U"
115
GOSUB
l&C'O
126
INPUT"fi*,B".:P!,B
13Q
IFR*="END"THEN
168
140
PRINT#2,
fl$","
STP.f
(B>CR#;
.145
GOSUB
1000
15G
GOTO
126
160
CLOSE
2
20Q
REM
*************
201
REN
*
202 REM
*
READ
SEO
203
REM
*
TEST FILE
204
REM
*
205
REM
*************
206
PRINT
207 PRINT"
MREflD
SEQ TEST
FILES"
208
PRINT
210
OPEN2,B,2,"0:SEQ
TEST
FILE
,S,R"
215
GOSUB
1000
220
INPUTt2,fl$<I),B<I)
224
RS*ST
225
OOSUB
1000
230
PRINTfif<I),Ba>
240
IFR
S-64
THEN
300
250
IF
RSO0
THEN
400
260
1*1+1
270
GOTO
220
300
CLOSE
2
310
END:
400 PRINT"
IBRDMDISKIBTRTUSMI
SIB"
RS
410
CLOSE
2
420
END
1000
REM
************
1601
REM
*
1002
REM
*
REBD
1003
REM*THE
ERROR
1004
REM
*
CHRNNEL
1005
REM
*
51
Page 59
1886
REN
♦♦*****♦»***
1818
INPUT#13,EN,EM$,ET,E$:
1828
IF
EN»8 THEN
RETURN:
1838
PRINT"iniflERROR
ON
DISK"
1048
PRINT"rEN,EM*,ET,ES"r
1858
CL0SE2
1068
END
52
Page 60
Chapter
7
RANDOM
FILE
A
random
access
fileiscreated
with
the
BLOCK
and
USER
commands
described
in
Chapter
5-Adranced
Disk
Programming.
DATA
FLOW
IN
RANDOM
FILE
In
the
random
access
file
the
data
can
notbeas
simply
writteninor
read
from
as
in
the
caseofa
sequential
file.
Itisnecessarytounderstand
the
data
flow
between
the
computer,
buffer
and
disk
driveinordertotransfer
the
datainthe
random
access
file.Itcanbeillust
ratedasFig.
6.
Channel
5
OPEN
5,8,15
PRINT#5,"B-W";3;0;6;4
Transfer
the
data
from
the
buffer
to
the
computer
Channel
3
OPEN
4,8,3,
"#7"
PRINT
#4,
A$;
CHR$(44)I;
CHR$(13)
Writeinthe
data
from
the
computer
into
the
buffer
move
the buffer
pointer
PRINT#5,"B-P"3;120
»
i
Disk
Drive
Buffer
Computer
f
\
move
the
buffer
pointer
PRINT#5,"B-P"3;120
Transfer
the
data
from
the
disk
to'
the buffer
Read
in
the
data
from
the
buffer
to
the
computer
PRINT#5,"B-R";3;0;6;4
INPUT
#4,
A$,
I
Fig.
6.
Data
Flow
between
Computer,
Buffer
and
Disk
Drive
53
Page 61
The
above
can
be
more
specifically
described
as:
STEP1.
Openafile
Disk
File
OPEN
5,8,15
'—
Command&Error
Channel
-Device
Number
-Logical
File
Number
Buffer
File
OPEN
4,8,3,
"#7"
'—Buffer
Number
-Channel
Number
-Device
Number
-Logical
File
Number
STEP
2.
Move
the
buffer
pointer
PRINT#5"B:P:"3;120
L'—Pointer
Position
—Channel
Number
of
(§)
SettingofBlock
Pointer
STEP
3.
Place
the
data
in
the buffer
PRINT
#4,
A$;
CHR$(44);
I;
CHR$(13)
Logical
File
Number
of
(
Comma
Carriage
Return
-Variables
STEP
4.
Transfer
the data
from
the
buffer
to
the
disk
PRINT^,"B-W:"3;0;6;4
Logical
File
Number
of
@
Write
•—Sector
number
-Track
number
Drive
number
-Channel
Number
of
(§)
54
Page 62
STEP
5.
Transfer
the
data
from
the
disk
to the
buffer
PRINT#5)"BTR:"3;0;6;4
Logical
File
Number
of
(A/
Read
Out—I
L-
Sector
Number
Track
Number
Drive
Number
Channel
Number
of
STEP
6.
Move
the buffer pointer
PRINT
#5,
"B-P:"
3;
120
Logical
File
Number
of
®J
-Pointer
Position
Channel
Number
of
(B)
Setting
of
Block
Pointer
STEP
7.
Take
out
the
data
from
the buffer
INPUT#4,A$,1
Logical
File
Number
of (By
Variables
EXAMPLE
OF
USING
RECORD
NUMBER
More
practical
program
which
uses
variables
will
be
as
follows:
It
assumes
OPEN
15,
8,
15
and
OPEN
CH,
8,
CH,
"#"
and
uses
Ul
and
U2
instead
of
B-W
and
B-R.
5166
5185
516S
5110
5120
5130
5140
5150
5160
5180
5190
REN
***'**3|e*#***#*sl**#******
REM*FDD
BLOCK
REflD
*
REM
*#*#**#***#**#*♦*******
GQSUB5330
print#i5,"U1:";ch;fb,ft/fs
print#15/"b-p:";ch;fp
GOSUB5270
FORFI=1TOFX
IHPUT#CH,FB$(FI.):
NEXT
RETURN
55
Page 63
520©
REM
*#*************♦*****•+•*
5281
REM*FDD
BLOCK
WRITE
*
5292
REM
******♦♦**#***♦***+•+***
5210
G0SUB5339
5220
PRINT#15
>"B-P
=";CH;
FP
5230
FORFI=1TOFX:
PRIHT#CH,
FBI-<FI
>■;
£HR*<13),=NEXT
5240
PRINT*15>"U2:";CH;FD;FT;FS
5250
GOSUB5270
5260
RETURN
5270
REM
♦**♦**♦+**♦*****♦•*♦*♦•**
5275
REM
*
ERROR
CHECK
*
527S
REM
**###♦**♦***#***#**♦***
5280
INPUT#15,EN,EM*,ET,ES
5290
IFEN=0THENRETURN
5390
PRINT"ERROR
STflTUS:",EN;EM*;ET;ES
53101HPUT"CONTINUE?">V*:IFY$="V"THEHRETURN
5320 STOP
5322
REM
**##******#*#**********
5324
REM*SET
TRflCK&SECTOR
*
5326
REM
***********************
5330
IFF<358THENF1=0:F2=22
=
F3=1=GOTO5370
5340
IFF>357RNDF<471TRENF1=357:F2=20
=
F3=19:GOTO5370
5350
IFF*>471RNDFO88THENF
1=4?1-F2=19:
F3=25:
G0T03378
5360
IFF>580THENF1=580:F2=18:F3=31
5370
FT=INT<<<P-F1)-1>/<F2-1))+F3
5380 FS=F-F1-<FT-F3)*F2+<FT-F3-1)
5390
RETURN
Where:
CH=Channel
number
FD=Drive
number
FP=Buffer
pointer
The
line
numbers
5270
to
5320
in
the
above
are
the
error
check
routine.
Also
indicated
in
above
by
GOSUB
5330
isasubroutine
which
is
for allocating a
sectorinthe
disk.
A
track
and
sector
mustbedesignated
in
the
random
access
whichisrather
troublesome
and,
therefore,
a
concept
of
record
number
is
used
here
to
reduce
the
burden
of
the
programmer.
For
example,
serial
numbers
as
shown
in
Table
below
are
assignedtothe
sector0in
the
track1to
the
sector16of
the track
35,
in
VIC-1540.
These
serial
numbers
are
called
as
the
record
number,
which
is
in-
56
Page 64
dicated
byFin
the
subroutine
starting
from
the
line
number
5330
in
the
above
example.
WhenaF
number
is
designated
and
this
subroutine
is
called,
the
corres
ponding
track
and
sector
are
allocated
automatically.
The
directory
will
not
be
destructed
as
the
track
18
has
been
avoided.
Table
10.
Allocation
of
Record
Number
Track
Number
1to17
18
to
24
25to30
31to35
Sector
0to20
Oto
8
0tol7
Oto
16
Number
of
Sector/Track
21
19
18
17
Record
No.
1-357
358471
478-579
586-664
EXAMPLE
OFARANDOM
FILE
PROGRAM
A
simple
program
has
been
made
using
method
to
createarandom
access
file
described
above.
This
program
can be used
for
the
preparation,
deletion
and
inquiry
of
an
address
list.
Line
number
line
number
line
number
Line
number
Line
number
line
number
50
100
200
300
5100
5200
-
76
-
190
-
280
-
390
-5190
-5260
Job
menu.
Creationoffile
Making
deletion
to
the
file
Search
processirig
File
input
routine
File
output
routine
16
REM
******♦****##*****#**#*
12
REM*RRNDOM
FILE
EXRMPLE
*
14
REM
##*#♦##♦♦*♦#*♦♦#**#*#**
16
BIMI$<664>:FD=
18
PRINT'TMW-
20
PRINT"
BINSERT
DRTfl
SHEETS"
22
PRINT"
:
";
24
PRINT"WW
STflRT
PRESS
rS'B"
26
GETP*:IFP*O"S"THEN26
28
0PEN15,8,15,"16":0PEN2,8,2,"#'
38
PRINT"3M-
II
>
32
PRINT"INDEX
FILE
OPERATION"
34
PRINT"
57
Page 65
36
INPUT"W
MEN
SHEET?
NIMH"
;0$=PRINT'S"
38
IF0*="N"THEN46
48
IF0*O"V"THEN36
42
PRINT:PRINT"
WflIT!":FORI=1TO664
44
PRINT"
>fr
»§mm*M*Mf.
45
PRINTI*
<I>
=NEXT:GOTO50
46
OPEN5,8,5,"0:INDEX,S,R
4?
FORI=1TO664:INPUT#5,
4S
PRINT"
»TXtiMRl«}!MO»»ai»
49
NEXTI:CLOSES
56
PRINT
'TM
52
PRINT"
JOE MENU
54
PRINT"
56
PRINT
53
PRINT"
60
PRINT"
62
PRINT"
IIISII"
I;:I$< I
>='V"
IB91B!"
I;
I$<
I)
l=CREfiTE"
2=DELETE"
3=SEP.RCH"
0=ENH"
64
PRINT"
65
PRINT
66
INPUT"1
,2,3,0
1UM";O*
68
IFO$="0"THENCLOSE15:CLOSES:CL0SE2:END
70
IFO*="1"THEN104
72
IFO*="3"THEN300
74
IFO*O'"2"THES50
76
GOTO200
100
REM
♦*#*#*♦#***♦******♦***#
102
REM*MflSTER
FILE
CREflTE
103
REM
*#*****#*#**#***♦♦*#***
104
PRINTMBW
";
105
PRINT"
MflSTER
FILE
CREflTE"
106
PRINT"
"
107
INPUT"IRECORD
NO.=0IIIB";F
109
IF
F=0THEN170
110
IHPUT'NflME
=.IHI";FB$<1)
120
INPUT"RDDRESS
«.IMH";FB*<2>
130
INPUT"ZIP
=.III!",FEJ(3>
132
INPUT
"TEL
a.HM";FB*<4)
134
INPUT'COMMENT
=.IM!";FB$<5>
140
GOSUB5200
150
58
Page 66
160
GOTO104
170
OPENS,8,5,"80=INDEX,S
M"
175
FORI=1TO664:PRINT#5,I$<I);CHR*<13);
180
PRINT"
WUUHMKHDM»l»ftUR
IT!
IHIII"
I;I$
< I >
185
NEXT:CLOSES
196
G0T074
200 REM
***********************
201
REM
*
MflSTER
FILE
DELETE
*
202
REM
*********************+*
210
PRINT"
ZtiM
"
•■
212
PRINT"
MflSTER
FILE
DELETE"
214
PRINT"
"
PRINT
220
INPUT"iRECORD
NO.=031153",
F
230
IFF=QTHEN260
'235
IFI*<F)O"1"THEN220
240I*<F)
=" /"■PRINT"
WKECORD
NO."
F;"
DELETES"
250
GOTO220
260
OPENS,8,5,"SO:INDEX,£,1*1"
265
FOR
I=1T0664:
PRINT#5,1
i-
(I);
CHR*<13
>;
276 PRINT"
*!lS»M?I»W»*Si»lJH
IT!
IllSai"
I;I$<I)
275
NEXT:CLOSES
280
GOTG50
300
REM
***********************
301
REM
*
FILE
SEflRCH
*
302
REM
***********************
310
PRINT
".KM
-";
312
PRINT"
SEflRCH
314
PRINT"
":
PRINT
320
INPUT"1RECORD
NO.=SIIIB'SF
321
IFF=0THEN50
322
IFI$(F)O"1"THEN320
325
GOSUB5100
360
PRINT"NRME=";FB*<1)
370
PRINT"flDDRESS
=
";FB*<2>
330
PRINT"ZIP
=
";FB$<3>
382
PRINT"TEL
=
";FB$<4>
383
PP.INT
"COMMENT=";FB$<5)
385
PRINT"
"
390
GOTO320
59
Page 67
51S6
REM
******************+**+*
5185
REM*FDD BLOCK
RERL
*
5168
REM
*♦♦*♦**********♦*****+*
5116
G0SUB5330
5120
PRINT#15,
"Ul:
",CH.;FD,F7;F5
5136
PRIHT#15,"B-
P;",CH,FP
5140
G0SUB5276
5150
FGRFI=1TOFX
5160
1HPUT#CH..FB$(FI):
51S0
NEXT
5190 RETURN
5209
REM
#.#*♦**#********♦*#*****
5201
REM*FDD-BLOCK
WRITE
*
5202
REM
#******#*******♦*******
5210
GOSUB5330
5220
PRINT#15,"B-P:";CH;
FP
5230
FORFI=1TOFX=PRINT#CH,F£$<FI);CHR$<13)>
■NEXT
5240
PRINT#15,"U2:"iCH;FD;FT;FS
525Q
GOSUB5270
5260
RETURN
5270
REM
******************#****
.5275
REM
*
ERROR
CHECK
*
527S
REM
********#****♦♦♦♦******
5280
INPUT#.l
5..
EH,
EM*
.•
ET,
ES
5296
IFEN=0THENRETURN
5360
PRINT"
ERROR
STflTUS:"
.■
EH;
EM*;
ET;
ES
5310
INPUT'-CONTINUE?";'f't
=
IFV$="V"THENRETURN
5320 STOP
5322
REM
**********if:********+if:*+
5324
REM*SET
TRflCK&SECTOR
*
5326
REM
#*#**#**♦****♦*********
5330
IFFC358THEHF1=0:F2=22
=
F3=1:GOT05378
5340
IFF>357FlHIiF<471THEHFl=357:
F2=20
'•
F3=19:
GOTO5370
5350
IFF>471fiHDF<580THENFl=471:F2=19:F3=25:GOTO5370
5366
IFF>580THENF1=589
=
F2=18:F3=31
5370
FT=INT<
<<P-F1>-1)/(F2-l))+F3
5380
FS=F-F1-<FT-FS)*F2+(FT-F3-1>
5330
RETURN
60
Page 68
Chapter
8
ERROR
MESSAGES-
PATTERN
MATCHING
FILE
NAMES-
REQUESTING
ERROR
MESSAGES
When
the
drive
indicator
of
the
disk
drive
flashes,
it
indicates
an
error
occurred
in
the
disk
drive.
The
execution
of
the
following
program
displays
the
error
on
the
computer
screen
and
resets
the
device
error
indicator:
10
OPEN
1,8,15
20INPUT#l,A,B$,C,D
30
PRINT
A,B$,C,D
where
A=error
message
number
B$=error
message
C
=
track
D=sector
SUMMARY
OF
DOS
ERROR
MESSAGES
0
OK,noerror
exists.
1
Files
scratched
response.
Not
an
error
condition.
2—19
Unused
error
messages:
shouldbeignored.
20
Block
header
not
foundondisk.
21
Sync
character
not
found.
22
Data
block
not
present.
23
Checksum
errorindata.
24
Byte
decoding
error.
25
Write-verify
error.
61
Page 69
26
Attempttowrite
with
write protect on.
27
Checksum
error
in
header.
28
Data
extends
into
next
block.
29
Disk
id
mismatch.
30
General
syntax
error.
31
Invalid
command.
32
Long
line.
33
Invalid
filename.
34
No
file
given.
39
Command
file
not
found.
50
Record
not
present.
51
Overflow
in
record.
52
File
too
large.
60
File
open
for
write.
61
File
not
open.
62
File
not
found.
63
File
exists.
64
File
type
mismatch.
65
No
block.
66
Illegal
trackorsector.
67
Illegal
system
trackorsector.
70
No
channels
available.
71
Directory
error.
72
Disk
full
or
directory
full.
73
Power
up
message,
or
write
attempt
with
DOS
mismatch.
74
Drive
not
ready.
DESCRIPTION
OF
DOS
ERROR
MESSAGES
NOTE:
Error
message
numbers
less
than
20
should
be
ignored
with
the
excep
tionof01
which
gives
information
about
the
numberoffiles
scratched
with
the
SCRATCH
command.
20:
READ
ERROR
(block
header
not
found)
The
disk
controller
is
unable
to
locate
the
header
of
the
requested
data
block.
Caused
by
an
illegal
sector
number,
or
the
header
has
been
destroyed.
21:
READ
ERROR
(no
sync
character)
The
disk
controller
is
unable
to
detectasync
mark
on
the
desired
track.
Caused
by
misalignment
of
the
read/write
head,
no
diskette
is
present,
or
unformatted
or
improperly
seated
diskette.
Can
also
indicate
a
hardware
failure.
62
Page 70
22:
READ
ERROR
(data
block
not
present)
The
disk
controller
has
been
requested
to
read
or
verifyadata
block
that
was
not
properly
written.
This
error
message
occursinconjunction
with
the
BLOCK
commands
and
indicates
an
illegal
track
and/or
sector request.
23:
READ
ERROR
(checksum
error
in
data
block)
This
error
message
indicates
that
there
is
an
error
in
one
or
more
of
the
data
bytes.
The
data
has
been
read
into
the
DOS
memory,
but
the
check
sum
over
the
data
is
in
error.
This
message
may
also
indicate
grounding
problems.
24:
READ
ERROR
(byte
decoding
error)
The
data
or
header
has
been
read
into
the
DOS
memory,
butahardware
error
has
been
created
due
to
an
invalid
bit
pattern
in
the
data
byte.
This
message
may
also
indicate
grounding
problems.
25:
WRITE
ERROR
(write-verify
error)
This
message
is
generated
if
the
controller
detects
a
mismatch
between
the
written
data
and
the
datainthe
DOS
memory.
26:
WRITE
PROTECT
ON
This
message
is
generated
when
the
controller
has
been
requested
to
write
a
data
block
while
the
write
protect
switch
is
depressed.
Typically,
this
is
caused
by
usingadiskette
withawrite
protect
tab
over
the
notch.
27:
READ
ERROR
(checksum
error
in
header)
The
controller
has
detected
an
error
in
the
header
of
the
requested
data
block.
The
block
has
not
been
read
into
the
DOS
memory.
This
message
may
also
indicate
grounding
problems.
28:
WRITE
ERROR
(long
data
block)
The
controller
attemptstodetect
the
sync
markofthe
next
header
after
writingadata
block.Ifthe
sync
mark
does
not
appear
withinapre-deter-
mined
time,
the
error
messageisgenerated.
The
erroriscausedbya
bad
diskette
format
(the
data
extends
into
the
next
block),
or
by
hardware
failure.
29:
DISKIDMISMATCH
This
messageisgenerated
when
the
controller
has
been
requestedtoac
cessadiskette
which
has
not
been
initialized.
The
message
can
also
occur
ifadiskette
hasabad
header.
30:
SYNTAX
ERROR
(general
syntax)
The
DOS
cannot
interpret
the
command
sent
to
the
command
channel.
63
Page 71
Typically,
this
is
caused
by
an
illegal
number
of
file
names,
or
patterns
are
illegally
used.
For
example,
two
file
names
may
appear
on
the
left
side
of
the
COPY
command.
31:
SYNTAX
ERROR
(invalid
command)
The
DOS
does
not
recognize
the
command.
The
command
must
start
in
the
first
position.
32:
SYNTAX
ERROR
(long
line)
The
command
sent
is
longer
than
58
characters.
33:
SYNTAX
ERROR
(invalid
file
name)
Pattern
matching
is
invalidly
used
in
the
OPEN
or
SAVE
command.
34:
SYNTAX
ERROR
(no
file
given)
The
file
name
was
left
out
ofacommand
or
the
DOS
does
not
recognize
it
as
such.
Typically,
a
colon
(:)
has
been
left
out
of
the
command.
39:
SYNTAX
ERROR
(invalid
command)
This
error
may
result
if
the
command
sent
to
command
channel
(secondary
address
15)
is
unrecognizable
by
the
DOS.
50:
RECORD
NOT
PRESENT
Result
of
disk
reading
past
the
last
record
through
INPUT#,
or
GET#
commands.
This
message
will
also
occur
after
positioning
toarecord
be
yond
endoffileina
relative
file.Ifthe
intentisto
expand
the
file
by
adding
the
new
record
(withaPRINT#
command),
the
error
message
may
be
ignored.
INPUT
or
GET
should
not
be
attempted
after
this
error
is
detected
without
first
repositioning.
51:
OVERFLOWINRECORD
PRINT#
statement
exceeds
record
boundary.
Information
is
truncated.
Since
the
carriage
return
which
is
sent
asarecord
terminator
is
counted
in
the
record
size,
this
message
will
occur
if
the
total
characters
in
the
record
(including
the
final
carriage
return)
exceeds
the
defined
size.
52:
FILE
TOO
LARGE
Record
position
withinarelative
file
indicates
that
disk
overflow
will
result.
60:
WRITE
FILE
OPEN
This
message
is
generated
whenawrite
file
that
has
nQt
been
closed
is
being
opened
for
reading.
64
Page 72
61:
FILE
NOT
OPEN
This
message
is
.generated
whenafile
is
being
accessed
that
has
not
been
opened
in
the
DOS.
Sometimes,
in
this
case,amessage
is
not
generated;
the
requestissimply
ignored.
62:
FILE
NOT
FOUND
The
requested
file
does
not
exist
on
the
indicated
drive.
63:
FILE
EXISTS
The
file
nameofthe
file
being
created
already
existsonthe
diskette.
64:
FILE
TYPE
MISMATCH
The
file
type
does
not
match
the
file
typeinthe
directory
entry
for the
requested
file.
65:
NO
BLOCK
This
message
occursinconjunction
with
the
B-A
command.Itindicates
that
the
blocktobe
allocated
has
been
previously
allocated.
The
para
meters
indicate
the
track
and
sector
available
with
the
next
highest
number.
If
the
parameters
are
zero
(0),
then
all
blocks
higher
in
number
areinuse.
66:
ILLEGAL
TRACK
AND
SECTOR
The
DOS
has
attemptedtoaccessatrackorsector
which
does
not
exist
in
the
format
being
used.
This
may
indicate
a
problem
reading
the
pointer
to
the
next
block.
67:
ILLEGAL
SYSTEM
TORS
This
special
error
message
indicates
an
illegal
system
trackorsector.
70:
NO
CHANNEL
(available)
The
requested
channel
is
not
available,
or
all
channels
are
in
use.Amaxi
mum
of
five
sequential
files
may
be
opened
at
one
time
to the
DOS.
Direct
access
channels
may
have
six
opened
files.
71:
DIR
ERROR
The
BAM
does
not
match
the
internal
count.
There
isaproblem
in
the
BAM
allocation
or
the
BAM
has
been
overwritten
in
DOS
memory.
To
correct
this
problem,
reinitialize
the
diskette
to
restore
the
BAM
in
memory.
Some
active
files
may
be
terminated
by
the
corrective
action.
NOTE:
BAM=Block
Availability
Map
72:
DISK
FULL
Either the
blocks
on
the
diskette
are
used
or
the
directory
is
at
its
limit
of
65
Page 73
144
entries.
73:
CBMDOSV2.6V170
The
DOS
version
of
the
VIC-1540
is
2.6.
DOS
2.6
and
1.0
(CBM2040/
3040)
are
read
compatible
but
not
write
compatible,
that
is,
the
disk
formatted
on
DOS1.0
may
be
read
but can not
be
written
upon
with
VIC-
1540,
and
the
disk
formattedonDOS2.6
mayberead
but
can
not
be
written
upon
with
DOS
1.0.
DOS2.6
and
2.0
(CBM4040)
are
read
and
write
compatible,
that
is,
the
disk
formattedoneither
version
mayberead
and
written
upon
with
the
other
version.
DOS2.6
and
2.5
(CBM8050)
are
not
read
or
write
compatible,
that
is,
the
disk
formatted
on
either
version
can
not be
readorwritten
upon
with
the
other
version.
This
errorisdis
played
wheneveranattemptismadetowrite
uponadisk
which
has
been
formattedina
non-compatible
format.
This
message
may
also
appear
after
power
up.
74:
DRIVE
NOT
READY
An
attempt
has
been
madetoaccess
the
VIC-1540
Single
Drive
Floppy
Disk
without
any
diskette
presentinthe
drive.
PATTERN
MATCHING
Pattern
matchingoffile
namesisavailable
on
all
Commodore
floppys.
Pattern
matching
uses
the
question
mark
(?)
and
the
asterisk
(*)
to
perform
operations
on
several
files
with
similar
names.
The
asterisk
is
used
at
the
end
ofastring
of
characters
to
indicate
that
the
rest
of
the
name
is
insignificant.
For
example:
could
refertofiles
named
or
or
or
FIL*
FIL
FILE1
FILEDATA
FILLER
or
any
other
file
name
starting
with
the
letters
FIL.
The
question
mark
may
be
used
anywhere
within
the
string
of
characters
to
in
dicate
that
the
character
in
that
particular
position
should
be
disregarded.
For
example:
66
Page 74
?????
.SRC
could
refer
to
files
named
TSTER.SRC
or
DIAGN.SRC
or
PROGR.SRC
but
not
SRC
.FILES
Both
the
characters
and
the
position
of
the
characters
are
significant.
The
question
mark
and
asterisk
maybecombinedinmany
ways:
does
not
make
sense
because
the
question
marks
areinan
area
whichisinsignifi
cant
(because
of
the
asterisk).
P???FIL*
will
access
files
with
the
names
PET
FILE
or
PRG
FILE-32
or
POKEFILES$$
or
any
other
files
starting
withPand
having
FIL
in
positions
5-7.
SCRATCH
with
pattern
matching
should
be
used
carefully,
since
multiple
files
will
be
scratched.
LOAD
will
load
the
first
file
which
fits
the
pattern
matching.
OPEN
with
pattern
matching
maybeusedtoopenanexisting
file,inwhich
case
the
first
existing
file
encountered
which
fits
the
description
willbeopened.
However,
OPEN
should
notbeused with
pattern
matching
when
creating
a
new
file.
Never
use
RENAME,
SAVE,orCOPY
for
pattern
matching
sinceanerror
condition
will
result,
if
attempted.
67
Page 75
68
Page 76
APPENDIX
The
following
isalist
of
the
programs
contained
on
the
TEST/DEMO
diskette.
o
m
4
6
14
4
9
5
13
689
tTni-nmiflrnnranrn
"DIR"
"VIEW
BRM"
"DISPLRY
T&S"
"CHECK
DISK"
"PERFORMRNCE
TEST"
"SEQUENTIRL
FILE"
"RRNDOM
FILE"
BLOCKS
FREE.
Ha
PRG
PRG
PRG
F'RG
PRG
PRG
F'RG
DIR
simplifies
the
commands
for
the
display
of
the
disk
directory
or the
disk
operation.
VIEW
BAM
will
read
the
BAM
on
VIC-1540
diskette
and
display
on
the
VIC-
1001
personal
computer.
It
isamatrix
type
map
with
the
sector
numbers
on
the
vertical
axis
and
the
track
number
on
the
horizontal
axis.
The empty
blocks
are
displayed
brightly
and
the
used
blocks
are
displayed
dark.
Because
of
the
formatting
of
VIC-1540,
sector
19
on
is
not
persent
on
tracks
18
to
24,The
VIEW
BAM
program
will
show
these
blocks
as
allocated.
DISPLAY
T&S
will
show
the
users
any
block
of
information
fromadiskette
(including
the
directory
and
BAM)
to
the
screen
or
printer
in
both
ASCII
and
hexidecimal.
(Refer
to
Chapter
5.)
CHECK
DISK
will
performavalidateona disk
then
identify
blocks
that
can
not
be
read
by
the
disk.
This
is
useful
for
detecting
a
damaged
disk.
PERFORMANCE
TEST
performsacheck
outonthe
performance
of
VIC-1540.
SEQUENTIAL
FILE
is
an
example
of
how
to
write
and
readasequential
file
data.
(Refer
to
Chapter
6.)
RANDOM
FILEisan
exampleofdirect
access
file
handling
using
BLOCK
and
USER
commands.
(Refer
to
Chapter
7.)
69
Page 77
I.DIR
4
0PEN2,8,15
5
PRINT"33":G0T0
10000
10
20
4u
GET#l,fi*,B*
59
C=8
60IFfl$OIIU
THEN
C=fiSC<R$)
70IFB$O1M1
THEN
C=C+flSC<B$)*256
80
PRINT"flia"MID$<STR$<C),2);TRB<3>;
"S2"i
90
GET#1>B$:IF
STO0
THEN 1000
1U0IFB*OCHR$<34>
THEN
90
110
GET#1,B*=IF
B$OCHR$<34)THEN
PRINTED;-GOTQlID
120
GET#1,B$:IF
B*=CHR$<32)
THEN
120
130
PRINT
TflB<18);:C$=IMI
140
C$=C*+B$--GET#1,B*:IF
B$Oni1
THEN
140
150
PRINT"Iia11LEFT$<C*,3>
160
GET
T$:IF
TOO"11
THEN
GOSUB
200Q
170IFST=0
THEN 30
1000
PRINT"
BLOCKS
FREES"
1010
CLOSEl:GOTO
10000
2800IFT$="Q"
THEN
CLOSED
END
2010
GET
T$-IF
T$=""
THEN
2000
2020
RETURN
4000
REM
DISK
COMMflND
4010
C$="":PRINTI1>M;
4011
GETB$:IFB$=IM1
THEN4011
4012
PRINTB$;:IF
B$=CHR$<13>
THEN
4020
4013
C*=C$+B$:GOTO
4011
4020
PRINT#2,C$
5008
PRINT"51";
.*•.•■
5010
GET#2,fl$:PRINTfl$;:IF
fl$OCHR$(13>GOTO5010
5020
PRINT"*"
10000
PRINT
"D-DIRECTORY"
10CU0
PRINT
">-BISK
COMMflND"
10020
PRINT
"Q-QUIT
PROGRflM"
10030
PRINT
"S-DISK
STflTUS
"
10100
GETfi*:IFfl$=""THEN10100
10200IFfl$="D"
THEM
10
10300IFR$=".(tORfl$-">11ORfl$=">"
THEN
4000
10310IFfl$="Q"
THEN
END
1032OIFfi*="S"
THEN
5Oo0
19539
GOTO
10100
2.
VIEW
BAM
100
REM
101
REM*VIEW
BflM
FOR
VIC-1540
*
102
REM
♦*♦♦**♦*******♦**♦*♦*******
105
0PEN15,8;15
110
PRINTtlS/'^^NUI^-'N/fl
N/fl N/fl
N/fl
N/fl":Z4=l
120
0PEN2,8,2/'#"
138
v$
148
X$
150
DEF
FNS<Z>=2t<S-INT<S/8>*8>
RND
<SB<INT<S/8>>)
70
Page 78
160
PRINT#15,"Ui:";2;0;i8;0
170
PRINT#J5,"B-P";2;l
1S0
PRINT11:!1;
19Q
V=22:X=l:GOSUB430
280
FORI=0TO20:PRINT:PRINT"mMRIGHT$<STR$<I)+"
",3>;:NEXT
210
GET#2,flS
220
GET#2,fl$
230
GET#2,fi*
240
TS=0
250
FORT=1TO17:GOSUB450
266
V=22:X=T+4:GOSUB430:GOSUB540:NEXT
278
FORI=1TO2000:NEXT
=PRINT"3"
286
V=22:X=l:GOSUB430
290
FORI=0TO20
=
PRINT•PRINT11T]I1RIGHT$<STR$<I)+11
",3);
:NEXT
300
F0RT=18T035
310
GOSUB450
320
V=22:X=T-13:GOSUB430•GOSUB540•NEXT
330
FORI=1TO1000-NEXT
34Q
print"jmmr
350
PRINT#15/'B-P";2;144
360
N*=IMI
:FORI=lTO20:GET#2,fl$-N$=N$+fl*:NEXT
376
PRINT"
"N$"
"TS-17;"BLOCKS
FREE"
3SQ
FORI=1TG4000:NEXT
330
PRINT"?]"
400
INPUT-'MUWWiaflNOTHER
DISKETTE
NIIIG";R*
410
IFfl$="V"THENRUN
420
IFWCV'THENEND
430
PRINTLEFT*<V$,V>LEFT$(X$,
X>
"II";
440
RETURN
456
GET#2>SC$:SC=RSC<RIGHT$<CHR$<0)+SC$,1)>
460
TS=TS+SC
470
GET#2,fi$:lFfl$=""THENfl$=CHR$<0>
480
SB<0)=flSC<fl$>
490
GET#2ifl*f-
IFfl$=""THENfl$=CHR$<0)
500
SB<l>=RSC<fl$>
510
GET#2>fl$:IFfl$=n"THENfl$=CHR$<0)
520
SB<2)=nSC<fl$>
530
RETURN
540
PRINT":?H"RIGHT$<STR$<T>.
1>;
"im";
550
REM
PRINTT"
"SC"
"SB<0>"
"SB<l)n
nSB<2)=CHR$<0)
560
IFT>24flNBS=13THEN:PRINTMII)*':NU^,Z4,l);
:GOTO660
570
FGRS=0TO20
530
1FT<18THEN620
590
IFT>30RNLS=17THEN:PRINTMID$<NU$.Z4,1);:GOTO660
6O0
IFT>24flNDS=13THEN:PRlNTMID*<NU^Z4>l>j
-GOTO660
610
IFT>24mNDS=19THENPRINTMID$<NU$,Z4>1);:GOTG660
620
IFT>17flNDS=20THENPRINTMID$<NU*,Z4,1);
^Z4=Z4+1:
639PRINT"a11;
640IFFNS'.:S)=0
THEN
PRINT"+M;
•G0TG66Q
659
PRINTIIB+";
:REHRIGHT$(STR$<S)/
1>;Z4,1>;
:G0T072
fA#
PRINT'TIB";
6?d
NEXT
630
RETURN
71
Page 79
3.
-Dl
SPLAY
T
& S
100
REN******************************
110
REM*
DISPLRV
flNV
TRfiCK%SECTOR
*
120
REM*ONTHE
VICTOTHE
SCREEN
*
130
REM*ORTHE
VIC PRINTER
*
140
REM******************************
150
print":hm
••;
160
print»displrv
block
contents";
163
PRINT"
"••
170
REM******************************
180
REM*
SET
PROGRRM
CONSTflNT
*
130
REM******************************
200
SP$="
":NL*=CHR*<0):HX$»"0123456789RBCDEF"
210
FS$=""-F0RI=:64
TO
95:FS$=FS$+"Sl'+CHR$a>+11!"
'NEXT
I
220
SS*="
"-FOR
1=192TO223'SS*eSS$+"Sll+CHR$<I>+llI"
-NEXT
I
240 DIM
R$<15>,NB<2>
251
D*»"0"
253
PRINT"
ftKREENXIIIIIIIIIOR
XHSPWINTER"
254
OETJJflF
JJ$=""
THEN254
255IFJJ$="S"THENPRINT"
HSBBCREENSS"
256IFJJt»"P"THENPRINTu
WSIPRINTERS!11
260
0PEN15,8,15/'r'+D*'GQSUB
650
265
0PEN4,4,7"
276
OPEN
2,8,2,
"r"GOSUB
650
230
REM******************************
290
REM*
LORD
TRRCK
RND
SECTOR
*
306
REM*
INTO
DISK
BUFFER
*
310
REM******************************
320
iNPurfcirrRRCK,
sector11
;t,s
330IFT=0ORT>35
THEN
PRINT#15/lI"Di'CL0SE2-CL0SE4:CL0SE15'-PRINTllEND"-EN
340IFJJ^'S"
THEN
PRINT"»WTRRCKIIT"
SECTOR1^11*!"
341IFJJ*=»"P"
THEN
PRINT#4-PRINTS/'TRRCK'^11
SECT0RMS:PRINT#4
350
PRINTttlS/'Ul^/'DiiTiS'.GOSUBeS©
360
REM******************************
370
REM*
RERD
BVTE0OF
DISK
BUFFER
*
390
REM******************************
400
PRINT#15/'B-P:2,r'
410
PRINTftlS,"M-R"CHR$<0)CHR$(6>
420
GETttl5,fi$<0)>.IFR$<0>=IMITHENR$<0>=NL$
423IF.JJ$="S"THEN430
430IFJJ$a"P"THEN460
431
REM******************************
432
REM*
RERD&CRT
DISPLRV
*
433
REM*
RESTOFTHE
DISK
BUFFER
*
434
REM******************************
436
K»r-NBa>=RSC<R*<0>)
43Q
FOR J=0TO63-IF
J»32 THEN
GOSUB
710'IF
Z*="N"THEN
J«80-GOTO
458
440
FOR
I*K
TO 3
442
GET#2,fl*<I)-IF
fi$<I)»IMI
THEN
R$<I)«NLi
444IFK*l
RND
I<2
THEN
NB<2)*RSC<R$<D)
446
NEXT
I'K=0
449
R$=""'•B$="•"•N=J*4•GOSUB
790'
fl$*fl$+»
:
»
456 FOR
1=0TO3:N=flSC<fi*<I>>:G0SUB
790
452
C$=fl*a>'-GOSUB
850'Bt=Bf+C$
454
NEXT
I•IF
JJ$="S"
THEN
PRINTR$B$
453
NEXT
J^G0T0571
72
Page 80
460
REM******************************
462
REM*
RERD&PRINTER
DISPLRY
*
464
REM******************************
466
K-fNB(l)-RSC<R$<0))
463
FOR J-0TO15
470
FOR
I»KTO13
472
0ET#2,flf(I):lF
fl$(I)-IMI
THEN
Rf<I>»Nl*
474IFK«l
RND
,I<2
THEN
NB<2>-fiSC<fl$<I>>
476
NEXT
l'.K«e
478
R*«"H•
B*«"■":N-J*16'•OOSUB
790:
fi$«fl$+"
*•
"
480
FOR
I«0TO15:H"RSC<Rt<X»'-G0SUB
790:IF
Z*»"N"THEN
J«40'GQTO
371
432
C*»R*a>:
OOSUB
850:B*«Bt+C*
434
NEXT
I
436IFJJ*-"P»
THEN
PRINT#4,fl$B$
433
NEXT
J:G0T0S71
571
REM********#*****#*******#**##«**
572
REM* NEXT
TRRCK
RND
SECTOR
#
573
REMm*mm*mmiMi***********
575
PRINT"NEXT
TRRCK
RND
SECT0Rl(NB<l)NB<2)
MM"
536
PRINT"DO
VOU
WRNT
NEXT
TRRCK
RND
SECTOR"
590
GET
Z$-IF
Z$=""
THEH590
600IFZ*-^11
THEN
T-NB(1)--S«NB<2>:GOTO330
610IFZ$=»"N"
THEN
320
620
GOTO
590
630
REM******************************
649
REM*
SUBROUTINES
*
650
REM******************************
660
REM*
ERROR
ROUTINE
670
REM******************************
630
INPUT#15,EN,EM$,ET,ES-IF
EN=0
THEN
RETURN
690
PRINT"3DISK
ERRORS"EN>EM*,ET,ES
700
END
710
REM******************************
720
REM*
SCREEN
CONTINUE
MSSG
730
REM******************************
740
PRINTM»MIICONTINUE<V/N>3"
750
GETZ^IF
Z*«IMI
THEN
750
760IFZ$="N"
THEN
RETURN
770IFZ$O"V"
THEN
750
780
PRINT'TJTRRCK11
T"SECTOR"S
"T'RETURN
790
REM******************************
300
REM*
DISK
BVTETOHEX
PRINT
*
810
REM******************************
820
Rl=INT<N/16>:R*«fi*+MID$<HX$,Rl+l,l>
830
R2=INT<N-16*fll):fi*»fi*+MID$<HX$,fi2+l,l>
840
RisRt+SP**.
RETURN
850
REM******************************
860
REM*
DISK
BVTETORSC
DISPLRV
*
870
REM*
CHRRRCTER
330
REM******************************
890IFRSCCC$><32
THEN
C*»"
"-RETURN
910IFRSC<C$X128ORRSC<C$»159
THEN
RETURN
920
C$=MID$<SS$,3*<fiSC<C$)-127>,3>:RETURN
73
Page 81
4.
CHECK
DISK
1
REM
CHECK
DISK—VER
1.4
2
BN=8:REM
FLOPPV
DEVICE
NUMBER
5
DIMT<100>:DIMS<100):REri
BflD
TRflCK,
SECTOR
flRRflY
9
PRINTMBKW
";
19
PRINT"
CHECK DISK
PROGRRM"
12
PRINT"
"
20
D$="0"
39
0PEN15,DN,15
35
PRINT#15,"y"D*
45
N/i=RND<TI)*255
50
fl$="":
FORI=:1TO255
=
fl*=fl*+CHR$<255flNIKI+N/i)):
NEXT
60
GOSUB900
70
0PEN2.DN,2.II#"
80
PRINT:PRINT#2,fi$;
85
T=i:S=0
90
PRINT#15,"B-fl:"D*;T;S
100
INPUT#15,EH,EM$,ET,ES
110
IFEN=0THEN130
115
IFET=0THEN200:REM
END
120
130
134
NB=NB+i:PRINT"
CHECKED
BLOCKS"NB
135
PRINT"
TRflCK
liHI"T;"
SECTOR
IHm"S".Tl"
140
INPUT#15>EN,EM$,ES,ET
150IFEN=0THEN35
160
T(J>=T
S<-J>=S:J=J+1
165
PRINT"MWBflD
BLOCK:III",T;S"S"
170
G0T035
200
PRINT#15,"rD$
210
GOSUB900
212
CL0SE2
215
IF>0THENPRINT")Ttt»»HO
BflD
BLOCKS!
":END
217
0PEN2>DN,2,"#"
213
PRINT"W)«flD
BLOCKS","TRflCK","SECTORS"
220
FORI=0TOJ-1
230
PRINT#15,"B-fl-";D$,T<I>,S<I>
240
PRINT,,T<I),S<I)
250
NEXT
260
PRINT"M"J"BflD
BLOCKS
HflVE
BEENflLLOCflTED"
270
CLOSE2=END
900
INPUT#15,EN,EM$,ET,ES
910IFEN=0
THEN
RETURN
920
PRIkr'MHERROR
#"EN,EM$;ET;ES"3"
930
PRINT#15,"I"D*
5.
PERFORMANCE
TEST
1600
REM
PERFORMflNCE
TEST
1.1
1010
:
1020
REM
VIC-1340
SINGLE
FLQPPV
DISK
DRIVE
1630
'
1040
:
1050
OPEN
1,9,15--0PEN13,8i13
1060
LT=35
1070
LT$*STR$(LT)
74
Page 82
1080
HT=30
1090
PRINT'TJO-
1100
PRINT"D
PERFORMRNCE
TEST"
1110
PRINT"
•'
1120
PRINT
1130
PRINT"
JIINSERT
SCRflTCH"
1140
PRINT
1150
PRINT"
DISKETTEINDRIVE"
1160
PRINT
1170
PRINT"M
PRESS
^RETURN!"
1180
PRINT
1130
PRINT"
WHEN
RERDVM"
1200
FOR
1=0TO50:GET
ft*:NEXT
1.210
GET
R$:IF
fl*OCHR$<13>
THEN
1210
1220
:
1230
1.240TI$="000000"
1250
TT=13
1260
PRINT*1,"N0'TEST
DISK,00"
1270
Cl$="ii
DISK
NEW
COMMflND
"
1280
C2$="3M
WRIT
RBOUT80SECONDS"
1290
CC$=C1$+C2$GOSUB
1840
1300IFTKNTTHEN1370
1310
PRTNT"»3VSTEM
IS"
1320
PRINT"H
NOT
RESPONDING"
1330
PRINT"
CORRECTLYTOCOMMRNDS"
1340
GOSUB
1330
1350
"•
1360
:
1370
PRINT"MDRIVE
PfiSS"
1380
PRINT"
MECHRNICRL
TESTW"
1390
TT=21
1400
OPEN
2,3,2,"0=TEST
FILE,S,W"
1410
CC*»"OPEN
WRITE
FILE"
:GOSUB
1840
1450
CH»2:CC$-"MRITE
DRTfl"
:GOSUB
1930
1430
CC$="CLOSE
"+CC$
:GOSUB
1840
1440
OPEN
2,8,2,"0:TEST
FILE,S,R"
1450
CC**"OPEN
RERD
FILE"
-GOSUB
1840
1460
CH=2
:GOSUB
1990
1470
PRINT#1/'S0-TEST
FILE"
1480
CC$="SCRRTCH
FILEW"-TT=1
:GOSUB
1840
1490
••
1510
TT«21
1520
OPEN
4,8,4,"#"
1530
NN5i»<
1+RND<TI
>*254+NNSORND255:
PRINT#1,
"B-P";
4;
1540
NN*-MII:FOR
1-1TO255:NN$«NN*+CHR$<I)
:NEXT
1550
PRINTS
4,NN$;
1560
PRINT*
1/'U2'";4;0;LT;0
1570
CC*="WRITE
TRRCK"+LT$-GOSUB
1840
1580
PPINT#i/'U2-";4;0;i;0
1530
CCS="WRITE
TRRCK
1"
:GOSUB
1840
I600
PRlNT#i/'ur";4;0;LT;0
1610
CC$="RERD
TRRCK"+LT$
:GOSUB
1840
1620
PRINT#l,«Ul:H;4;e:l;0
1630
CCf="RERD
TRRCK
1"
:GOSUB
1840
1640
CLOSE
4
1650
:
1660
'■
75
Page 83
1678
PRINT
"Ml
UNIT
HflS
PRSSED"
J689
PRINT"
PERFORMflNCE
TEST!"
1690
PRINT-W
PULL
DISKETTE
FROM"
1700
PRINT-S
DRIVE
BEFORE
TURNING"
1710
PRINT"
POWER
OFF."
1720
END
1736
1740
••
1750
PRINT"
MHCONTINUE
<V/N)?B";
1760
FOR
1=0TO50-GET
fl$=NEXT
1770
GET
fl$:IF
fl$-M"
THEN
1770
1780
PRTNT
R$"W"
1790IFR*="N"
THEN
END
1800IFfi$»"V"
THEN
RETURN
1810
GOTO
1760
1820
1830
1840
PRINT
CC*
1850
INPUT*
1,EN,EM$,ET,ES
I860
PRINTTRB<12)"ai'EN;EM$;ET;ES;"SM
1870IFEN<2
THEN
RETURN
1880
PR1NT"M
UNITISFRILING"
1890
PRINT"M
PERFORMflNCE
TEST"
1900
TM$-TI$:OOSUB
1750-TI$=TMi-RETURN
1910
1920
1930
PRINT-WRITING
DflTfl"
1940
FOR
I«1000TO2000'PRINT#CH,I'NEXT
1950
GOSUB1850
I960
CLOSE
CH-RETURN
1970
••
1980
*■
1990
PRINT"RERDING
DflTR"
2000 GETR*
2810
FOR
1=1008
TO 2000
2020
INPUT*
CH,J
2030IFKM
THEN
PRINT":RERD
ERROR:I"•GOSUB
1850
2040
NEXT
2050
GOSUB
1350
2060
CLOSE
CH:RETURN
76
Page 84
-ERRATA-
P12416
P56,
P60
Wrong
TYPE:
OPEN1,8,15/10"
5340
IFF>357ANDF<471
5360
IFF>580THENFl=5
P57
tablelO
P69
P72
25to30
0tol718478-579
31to35
0tol617586-664
DISPLAY
T&S
RANDOM
FILE
410
PRINT#15/M-R"
CHR$(0)
CHR$(6)
Correct
TYPE:
OPEN1,8,15/I0"
5340
IFF>357ANDF<472
5360
IFF>579THENF1=579
25to30
0tol718472-579
31to35
0tol617580-664
These
programs
require
an
expander
RAM.
410
PRINT#15,*M-R"
CHR$(0)
CHR$(5)
CAUTION-
AttemptingtoLOAD
Disk
Progranrs
that
exceed
your
VIC's
memory
area
will
overflow
into
the
screen
area.Toavoid
this
problem
you
should
add
sufficient
memorytoyour
VIC
withanexpander
RAM
cartridge.
1982-06-02
Page 85
Page 86
Loading...