Alto Hardware Manual
Section
6:
Disk and Controller
46
STRT. Before setting KBLK, the Alto program should
put
a
JMP
STRT instruction in STRT; afterward it
should jump
to
STRT. The
disk
controller transfers data
downward,
from high to low addresses,
so
that
when
location' STRT
is
changed the reading
of
the block
is
complete. (See section 3.4 on the standard
bootstrap loading microcode.)
Another trick
is
to chain
disk
reads through their label
blocks.
That
is,
the label block for sector n
contains part
of
the disk command block
for
reading sector n +
1,
and
so
on.
6.1
Disk
Controller
Implementation
The following walk-through
of
an average day in the life
of
the standard disk controller is not intended
for
the casual reader,
but
rather
as
a roadmap
to
ease
the pain
of
learning the innermost workings
of
the
controller.
If
you
really want
to
benefit from this next section,
you
should have a copy
of
the standard
disk controller microcode and
logic
drawings
close
at hand.
The disk controller consists
of
a modest amount of hardware and two microcode tasks (the sector task
and the word task). Communication with the emulator
is
via
the four special main memory words, the
disk
command blocks, and the interrupts described earlier. In
following
few
paragraphs the actions
of
the
standard
disk
controller microcode are described. Occasionally it
may
be
unclear whether the actor
is
microcode or hardware. Referring
to
microcode listings and/or
logic
drawings
will
resolve any such
questions.
The sector
task
is
awakened
by
a sector signal
from
the disk. When awakened, it stores the status
of
the
disk
and controller in the special disk status word (KBLK + 1). In addition,
if
this sector signal terminates
a disk command (for
example;
a data transfer during the previous sector), the status
of
the disk and
controller are stored in the status word
of
the
disk
command block containing the terminated command,
and the command block pointer
(KBLK)
is
advanced.
If
a command
was
terminated with an error, KBLK
(DeB
pointer)
is
set
to
0 and
KBLK
+ 2 (current disk address)
is
set to
-1.
The effect
of
this is to cause the
disk controller
to
abandon the current disk command chain and to forget where the disk arm
is
positioned. '
Next, the sector
task
considers the first command on the
disk
command block chain (by using KBLK).
If
there
is
none, or
if
the disk unit
is
not ready
to
accept a command, the sector task goes
to
sleep until the
next sector pulse. Otherwise, the sector specified in the
new
command
is
verified to be less than 13.
Then, the
disk
and cylinder specified in the
new
command
are
compared with those stored in KBLK + 2
(current disk address), and then the
new
disk address
is
stored in
KBLK+2
and in the disk controller
hardware. Part
of
the
new
command
is
also
stored in the hardware.
If
the comparison
is
unequal, a seek
is
initiated and the sector
task
goes
to sleep until the next sector pulse.
If
the comparison
was
equal, the
SEEKOK
hardware
flag
is
tested.
If
that
is
OK,
then the no-transfer bit
of
the disk command (bit
14
of
the command word
of
the current disk command block) is tested to see
whether a data transfer
is
required.
If
not, the sector task
goes
to
sleep such that the command will
terminate at the next sector pulse.
If
a data transfer
is
required, the specified sector number and the
current disk sector number are compared.
If
unequal, the sector task goes to sleep until the next sector
pulse.
If
sector numbers are equal, awakening
of
the word
task
is
enabled and the sector task goes
to
sleep
such that the command
will
terminate at the next sector pulse.
The word task awakens
when
a word has been processed
by
the
disk
controller hardware and the word
task
has been enabled
by
the sector
task.
First, a starting
delay
is
computed, based on whether the
current record
is
to
be read or written. Second, control
is
dispatched based on the current record
number. A record length and main memory starting address are computed based on the record number.
In addition, special starting
delays
are computed
for
record number
O.
The disk unit
is
set into the delay
mode appropriate
for
the operation (read/write) and the word
task
goes
to sleep the appropriate number
of
times;