[CCTALK] Commodore 1541 Drive

From: Sellam Ismail <foo_at_siconic.com>
Date: Wed May 15 18:07:07 2002

On Wed, 15 May 2002, Ethan Dicks wrote:

> The GCR used by Commdore is a 5-to-4 arrangement - five bits on the
> disks (32 possibilities) are used to encode 4 data bits (16 possibilities).

Very similar to how the Apple disk drive works. But the description of
encoding is different (though the mechanism probably the same).

On the Apple we have 6&2 encoding and 4&4. What this means is that 6 bits
of an 8-bit byte are stored in one group of data inside a sector and the
remaining 2-bits are shared with the remaining 2-bits of 2 other bytes (to
come up with another 6-bit value). A translation table is used to map the
6-bit value to an 8-bit value than can be legally written onto disk.

> I don't have the docs right in front of me, but I think I can take a stab
> at what patterns aren't used just based on following those two rules above
>
> Too many 0s in front, back or middle...
>
> 00000 00001 00010 00011 00100 00101 00110 00111
> 01000 01100 10000 10001 10100 11000 11100
>
> Too many 1s in front, back or middle...
>
> 11111
>
> Good patterns
>
> 01001 01010 01011 01101 01110 01111 10010 10011
> 10101 10110 10111 11001 11010 11011 11101 11110

The translation table contains 8-bit bytes that would generally be
equivalent to what Ethan has posted. I.E. bytes that do not violate the
rule that no more than two consecutive zero bits can be written and no
more than (some number) of one bits (I am not quite sure how many
consecutive 1-bits are legal on the Apple Disk ][, or if there is a
limitation. I know that there are special bytes called "sync bytes" that
are 8 1-bits followed by two 0-bits, the idea being that a mess of them
are written at the beginning of a track and the beginning of sectors, so
that no matter where they begin being read, they will always eventually
"sync up" to a pattern of eight 1-bits followed by two 0-bits).

The 4&4 encoding is simple. One 8-bit byte is stored inside two 8-bit
bytes. Each bit of the byte is interleaved inside a series of 1 bits. So
for example, the value 10001100 which contains at least one obvious
example of an illegal bit string would be encoded as such:

11101010 11111010
 ^ ^ ^ ^ ^ ^ ^ ^
 1 0 0 0 1 1 0 0

This is how sector header and trailer data is written on an Apple ][
formatted disk.

> If I had a copy of "Inside the 1541" or the like, I'd look it up, but I
> don't have one in front of me. Essentally, the disk stores those GCR
> codes and the 1541 processor translates buffers back and forth manually,
> kinda like an Amiga with MFM, but without a coprocessor.

The same thing goes on in Apple DOS and ProDOS, except it's all done in
software (in the main machine). The equivalent reference book would be
_Beneath Apple DOS_ or _Beneath Apple ProDOS_ both by Quality Software,
and both highly recommended.

Also, the manual for Bag of Tricks (an excellent early disk repair tool)
has lots of relevant and very worthwhile information.

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

 * Old computing resources for business and academia at www.VintageTech.com *
Received on Wed May 15 2002 - 18:07:07 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:35:16 BST