Sellam asked about details of Apple Disk II GCR encoding.
I wrote:
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.
Now I remember. They added the requirement that there *must* be a
pair of consecutive one bits in the nybble, not counting the MSB.
They don't require that for the address/data field marker bytes (D5
and AA). But that requirement leaves exactly 64 valid nybble values,
which can encode six bits, and it does it in such a way that the
boot PROM can easily generate the decode table.
There's a GPL'd C program on my web site that shows how a table of
valid nybbles can be programmatically generated:
http://www.brouhaha.com/~eric/software/diskii_nybble/
The output from the program is:
13 sector nybbles:
0: ab ad ae af b5 b6 b7 ba bb bd
10: be bf d6 d7 da db dd de df ea
20: eb ed ee ef f5 f6 f7 fa fb fd
30: fe ff
16 sector nybbles:
0: 96 97 9a 9b 9d 9e 9f a6 a7 ab
10: ac ad ae af b2 b3 b4 b5 b6 b7
20: b9 ba bb bc bd be bf cb cd ce
30: cf d3 d6 d7 d9 da db dc dd de
40: df e5 e6 e7 e9 ea eb ec ed ee
50: ef f2 f3 f4 f5 f6 f7 f9 fa fb
60: fc fd fe ff
Eric