[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DOS 3.3, remember it??



Scott Maxwell writes:

>Does the DOS manual explain autosync bytes? I've read the section on
>them in Beneath Apple DOS about 5 times and I still don't get it. The
>diagram is on page 3-9. I've got it that they're 10 bit bytes (a strange
>concept) but that diagram confused me. It shows how DOS can sync to the
>track no matter where it starts reading. Help!

  Let's see whether I can explain it any better :-)

  The disk drive reads data from a disk one bit at a time (i.e. sequentially).
As each bit is read, it is pushed into a register from right to left.  This
register starts off containing all zeroes, then each bit gets pushed into it--
when the top bit of the registers changes from zero to one, it is assumed that
a byte has been read (in other words, all bytes of data on a disk are in the range
128 to 255).  The register is then cleared and the process starts all over again.

  e.g. if the data on the disk is 10111001, then the register contains the
following values after each bit is read:

   00000000
   00000001
   00000010
   00000101
   00001011
   00010111
   00101110
   01011100
   10111001
   ^
   Top bit is set, so a byte has been read.

  Now, to synchronise the disk drive so that it does start reading a byte in the
middle of it, the following pattern of one's and zero's are written at the start of
a track (and between each sector, actually).

  1111111100 1111111100 1111111100 1111111100 1111111100 1111111100 ...

  As you can see, it's just 8 one's followed by two zeros.  Now this pattern is
a very clever one, because no matter where the disk drive starts reading the
pattern, after reading five of them, it has gotten itself into sync.  As an
example, I'll show arrows at every point along the patterns where the disk drive
thinks it has read one byte (remember that the top bit must be set).  I'll start
reading from a random bit in the first pattern.

  1111111100 1111111100 1111111100 1111111100 1111111100 1111111100 ...
       ^        ^        ^         ^          ^          ^
       1st byte 2nd byte 3rd byte  4th byte   5th byte   6th byte

  Because each pattern is 10 bits, each byte starts at a different point in the
next pattern (to be precise, two bits further left).  Eventually the disk drive
reaches the start of one pattern, and from there on it's in sync because the
two zeros after the byte read are not considered to be part of the next byte!
Remember that the drive keeps on reading bits until the top bit becomes a one.

  So there you have it.  Does that make any more sense, or is my explanation
just as confusing?


--
| Philip Stephens, Systems Programmer. | "Many views yield the truth.         |
| Address:  43 Malcolm Road, Braeside, |  Therefore, be not alone."           |
|           Victoria, 3195, AUSTRALIA. |                                      |
| Internet: philip@labtam.labtam.oz.au |    -- Prime Song of the Viggies      |