[comp.sys.amiga.hardware] What does MSBSYNC do?

ccplumb@rose.uwaterloo.ca (Colin Plumb) (01/12/91)

I've read the description of the bit in the floppy controller section of
the hiardware manual, and it has something to do with being able to read
Apple II floppies.  But does anyone know in more detail how it modifies
the function of the disk circuitry?

Some research has uncovered the Apple II low-level disk format, for
the curious:

The disk interface is incredibly simple.  A standard clock-recovery
thingie (at 4us/bit) produces a bit stream, which is fed to an 8-bit
shift register visible to the processor via an 8-bit transparent
latch. When the high bit (the first bit in) of the shift register becomes
one, the latch freezes the data and the shift register is cleared.  Reading
the latch unfreezes it ready for the next one bit to reach the shift
register's MSB.

Ordinary data bytes are packed 6 bits to a byte, with the two MSBs set
to 10.  The 1 has to be there for the sync to work.

Sector sync is marked with eight 1 bits, followed by two 0 bits, repeated
maybe a dozen times.  To find a sector, you read the latch until the
MSB is set (lda latch; bpl load), and then check for $FF.  If you get it
(this cannot arise in normal data because it can have at most 7 consecutive
1 bits due to the 1,0 bits at the start of each byte), a software timing
loop (based on 4 processor cycles per bit) checks later for the following
00 bits (two allows for some inaccuracy, since the BPL loop takes
almost two bit times), and then goes back to asking for $FF.

If several sync marks are found, the code starts looking for non-$FF bytes
containing typical sector identification information, which are also
not standard data ($D5 I think starts a sector header, but it doesn't really
matter), and then the usual "this is a header" followed by track, sector,
format id, and checkdum; or "this is data" followed by data and checksum.
The data is, as mentioned before, expanded by 4/3 to fit the block.
It's probably 256 bytes data + 2 bytes checksum = 258, times 4/3 = 344
bytes raw.

But anyway, how does the Amiga's hardware make this any easier to read?

(Just curiosity, by the way.)
-- 
	-Colin