Good description of Apple ][ disk controller

Vintage Computer Festival vcf at siconic.com
Tue Mar 22 09:56:09 CST 2005


On Mon, 21 Mar 2005, Eric Smith wrote:

> Sellam wrote:
> > I am pretty surprised that I can't find any good technical descriptions of
> > the Apple ][ disk controller.  It's not in the DOS manual and, come to
> > think of it, I can't think of any publication Apple came out with that
> > describes it.  I wonder why this is?
>
> Because Apple considered it somewhat proprietary.  Though there's
> a patent on it:
>     http://www.brouhaha.com/~eric/patent/us/4210959.pdf
>
> There's also a patent on the later IWM chip, which was basically
> a single chip version with a few improvements:
>     http://www.brouhaha.com/~eric/patent/us/4742448.pdf

Interesting.

> > I want to know what's going on in the PROMs,
>
> You want the book "The Apple II Circuit Description", or "The Apple IIe
> Circuit Description", by Winston Gayler.  Out of print, of course, but
> you can get a copy for the low, low price of only $250 from an Amazon
> used seller.

While that's a good book, it has nothing on the disk controller.  See my
previous message for a better selection.

> > and why
> > the certain rules of encoding data are why they are (i.e. first bit of
> > every disk byte must be set,
>
> The bits shift in from the right, and there's no counter.  The only
> way you can tell that the complete "nybble" has been read is that the
> MSB of the shift register is set.

How...lame.  There's a specific number of cycles that it takes to assemble
an 8-bit byte.  Why can't one just go off this timing to determine when a
full byte is read?  And if this is possible, then does that mean that one
can really store a byte that doesn't have the MSB set, and subsequently
read it back?

> The restriction on no more than one consecutive zero (with the older
> 13-sector state machine), or no more than two consecutive zeros (with
> the newer 16-sector state machine) is required because the state
> machine cannot reliably discrimiate the length of a long period of
> time with no transitions.  For example, it couldn't accurately
> distinguish four empty bit times on a drive that was slightly fast
> from three empty bit times on a drive that was slightly slow.

I see.  And this is where I'm confused.  Beneath Apple DOS shows diagrams
that indicate there's a clock pulse between every data bit.  So either
that diagram is wrong, and there are no clock pulses, or my understanding
of disk drive technology prevents me from understanding why the controller
can't use the clock pulses to determine whether 3 or 4 zero bits have
passed under the head.

> The 16-sector state machine was redesigned to allow it to accurately
> discriminate slightly longer delays between transitions, allowing the
> use of two consecutive zero bits, but never three or more.  There are
> 81 valid nybbles with that constraint.  This is not enough to encode
> seven bits, but it is enough for six (2**6 == 64).  Even with the extra
> two codes used for marks, only 66 nybble values are required, so 17 of
> the 81 have to be chosen as invalid.  By adding the somewhat arbitrary
> prohibition of two double-zeros in a nybble, the number of valid
> nybbles is reduced to 72, which is still 6 more than necessary.  A
> few more are also eliminated; I don't recall whether there was an
> easily stated criterion that was used to eliminate the remaining 6.

According to my reading (in Beneath Apple DOS), you can only have *one
pair* of consecutive zeros in any one byte, but it was not clear if that
was a hardware constraint or an artificial constraint to pare down the
number of "legal" values.

> When I say "somewhat arbitrary", that's not completely true.  One
> of the criterion for choosing which of the 81 possible nybbles should
> be used for the actual data encoding is that it had to be possible in
> a very small amount of 6502 code to generate the decode table, because
> that had to be done in the 256-byte boot PROM along with the rest of
> the code needed to enable drive 0, recalibrate (seek to track 0), find
> sector 0, read it in, and jump to it.  Both the 13-sector and 16-sector
> disk boot PROMs are amazing examples of virtuoso 6502 programming.

I've stated this on numerous occasions myself :)

> But then, basically everything about the Disk II controller design
> and software is incredibly amazing.

In the top ten great hacks of all time, this is certainly one of them.

-- 

Sellam Ismail                                        Vintage Computer Festival
------------------------------------------------------------------------------
International Man of Intrigue and Danger                http://www.vintage.org

[ Old computing resources for business || Buy/Sell/Trade Vintage Computers   ]
[ and academia at www.VintageTech.com  || at http://marketplace.vintage.org  ]



More information about the cctalk mailing list