The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
called TRACKs. Each track is then divided in<strong>to</strong> subareas called SECTORs. Each sec<strong>to</strong>r is<br />
uniquely identified by a pattern of information preceding each sec<strong>to</strong>r called an ID FIELD.<br />
<strong>The</strong> division of a surface in<strong>to</strong> sec<strong>to</strong>rs may be envisioned as a pie cut up in<strong>to</strong> equal sized<br />
pieces. <strong>The</strong> process of generating each of the tracks and sec<strong>to</strong>rs is termed the formatting<br />
process. <strong>The</strong> physical length of a sec<strong>to</strong>r will be greater on the outer tracks of the<br />
surface than the inner tracks of the surface (similar <strong>to</strong> the grooves of a phonograph<br />
record). Although the number of sec<strong>to</strong>rs per track may vary from one media type <strong>to</strong><br />
another, the number of sec<strong>to</strong>rs in each track of the same media must always be a constant.<br />
<strong>The</strong> DOS assigns numbers <strong>to</strong> every sec<strong>to</strong>r, every track, and every surface. Surfaces are<br />
numbered consecutively by one starting from zero. Tracks are numbered consecutively by<br />
one starting from zero at the outermost portion of the disk giving the innermost track<br />
the highest number. A CYLINDER consists of the like-numbered tracks on all surfaces. For<br />
example, on a two-surface media, track zero of surface zero and track zero of surface one<br />
are grouped <strong>to</strong>gether in<strong>to</strong> cylinder zero.<br />
Floppy disk drives use a read/write head that is positioned lateral <strong>to</strong> the disk surface.<br />
<strong>The</strong> head can step in <strong>to</strong>wards the center of the disk and step out <strong>to</strong> the circumference of<br />
the disk while the disk rotates on its hub. <strong>The</strong> rotational speed is 300 rpm for 5-1/4"<br />
floppy disk drives and 360 rpm for 8" floppy disk drives. Hard disk drives rotate at<br />
speeds of 3600 rpm and higher. Because the physical lengths of the sec<strong>to</strong>r vary from the<br />
outer <strong>to</strong> the inner track, the bit density of each sec<strong>to</strong>r varies per track. <strong>The</strong>refore, the<br />
amount of information s<strong>to</strong>red in all sec<strong>to</strong>rs is dependent on the maximum bit density<br />
permitted in its shortest sized sec<strong>to</strong>r. Some manufacturers of computer systems are using<br />
a design which keeps the bit density per sec<strong>to</strong>r constant by use of a variable speed drive<br />
which maintains a constant linear velocity of the surface across the head regardless of<br />
the track position. This technique promotes a greater capacity for s<strong>to</strong>rage but requires a<br />
more precisely controlled drive. If such a drive control were utilized under this DOS, a<br />
suitable translation filter would be needed which would permit the DOS <strong>to</strong> think that each<br />
track still contained the same number of sec<strong>to</strong>rs.<br />
If we concern ourselves with a 5-1/4" double density floppy drive rotating at 300 rpm, we<br />
can calculate that a disk makes one complete rotation every 200 ms (60/300). Since there<br />
are 18 sec<strong>to</strong>rs per track, a sec<strong>to</strong>r's ID FIELD passes by the drive's head every 11.1 ms.<br />
In a system where the transfer of data <strong>to</strong> and from the disk is under the control of the<br />
CPU rather than through auxiliary Direct Memory Access (DMA) hardware, the CPU spends its<br />
time handshaking with the controller while transferring each byte of data. If we are<br />
trying <strong>to</strong> access a series of sec<strong>to</strong>rs sequentially (as would be the case with a<br />
sequentially accessed file), there will rarely be sufficient time for the CPU <strong>to</strong><br />
establish the handshaking with the controller for the access of the next sec<strong>to</strong>r once it<br />
has finished transferring the current sec<strong>to</strong>r. Thus, if we number the sec<strong>to</strong>rs<br />
consecutively, most likely the ID FIELD of the sec<strong>to</strong>r we next want <strong>to</strong> read has just<br />
passed by the head and we must wait a complete revolution of the disk before getting <strong>to</strong><br />
the ID FIELD again. In fact, the worst case would require us <strong>to</strong> wait just under 211.1 ms<br />
per sec<strong>to</strong>r while the time <strong>to</strong> read an entire track would be 3.8 seconds!<br />
A practical solution <strong>to</strong> increasing the data transfer is <strong>to</strong> stagger the sec<strong>to</strong>r numbers so<br />
that the next sec<strong>to</strong>r <strong>to</strong> transfer is arriving at the head just after we start looking for<br />
it. If we could read many sec<strong>to</strong>rs per single rotation, we could speed up the transfer of<br />
data. This can be done when the disk is formatted. It can also be done when the disk is<br />
accessed by means of a lookup table that translates a logical sec<strong>to</strong>r number <strong>to</strong> a<br />
staggered physical sec<strong>to</strong>r number. <strong>The</strong> process of staggering the sec<strong>to</strong>r numbers is termed<br />
INTERLEAVE. An interleave of two means that sequential sec<strong>to</strong>r numbers are in every second<br />
physical sec<strong>to</strong>r. An interleave of three uses every third position. For a single density<br />
5-1/4 diskette, this pattern would be 0-5-1-6-2-7-3-8-4-9. An 18 sec<strong>to</strong>r per track<br />
diskette with an interleave of three would have a pattern of 0-6-12-1-7-13-2-8-14-3-9-15-<br />
4-10-16-5-11-17. <strong>The</strong> interleave can be precisely calculated with knowledge of the <strong>to</strong>tal<br />
time it takes <strong>to</strong> execute the machine instructions between sec<strong>to</strong>r I/O. This is generally a<br />
most difficult task; therefore, interleave patterns are generally derived empirically.<br />
4-2