User`s guide

EXAMPLE:
To free the sector in which we wrote our name
in
the Block Write example,
and
allocated in the first Block-Allocate example, we could use the following command:
PRINT#l5
,
"B-F"
;O;l;I
USING RANDOM FILES (ADVANCED USERS ONLY)
By combining
the
commands
in this
chapter,
it is possible
to
develop a
file.
handing
program
that
uses
random
files.
What
you
need
to
know
now
is
how
to
keep
track
of
which blocks
on
the
disk such a file
has
used. (Even
though
you
know
a sector
has
not
been allocated
by
your
random
file,
you
must
also
be
sure
it wasn't
allocated by
another
unrelated file
on
the
diskette.)
The most common way
of
recording which sectors have been used by a random
fil
e
is
in
a sequential file. The sequential file stores a list
of
record numbers, with the tra
ck,
sector, and byte location
of
each record. This means three channels are needed by a
random file: one for the command channel, one for the random data, and the last for
the
sequential data.
72
CHAPTERS
INTERNAL DISK COMMANDS
Expert programmers can give commands that directly alter the workings
of
the 1541,
111
uch as skilled programmers can alter the workings
of
Basic inside the computer with
feeks, Pokes and Sys calls.
It
is
also possible to write machine language
progral\JS
that
load
and run entirely within the
1541
, either
by
writing them into disk memory from the
computer, or
by
lOll.ding
them directly from diskette into the desired disk memory buffer.
In
use, this
is
similar to loading and running machine language programs
in
your
computer.
As
when learning to use Peek(), Poke and Sys
in
your computer, extreme caution
is
advised
in
using the commands
in
this chapter. They
are
essentially machine language
commands, and lack all
of
Basic's safeguards. If anything goes wrong, you may have to
tum the disk drive off and on again (after removing the
di
skette)
to
regain control.
Do
not
practice these commands on any important diskette. Rather, make a spare copy and work
with
that. Knowing how to program a 6502
in
machine language will help greatly, and
you
will also need a good memory map
of
the
1541
. A brief
1541
map appears below.
Location
0000-00FF
0100-0lFF
0200-02FF
0300-07FF
1800-180F
ICOO-ICOF
CIOO-F258
F259-FE66
FE67-FE84
FE85-FEE6
PEE7-FFOF
FFE6-FFFF
1541
MEMORY
MAP
Purpose
2K
of
RAM memory
Zero page work area:
job
queue, important variables & pointers
Stack work area
Command buffers
& tables: channels, parser, output, variables
Data buffers
0-4, 1 per page
of
memory.
Input/Output
chips
6522 VIA:
1/0 to computer
65f2
VIA: I/O to disk controller
Disk
Operating
System
ROM
Interface Processor: receive & interpret commands from computer
Floppy
Di
sk Controller: executes IP's commands, controls mech
a-
nism
IRQ handler: switches from lP to FDC
& back every
10
ms
.
ROM tables & constants
Patch area
JMP table:
User command vectors
73