[comp.sys.apple] How to write synch bytes on a 3.5"

orcus@pro-lep.cts.com (Brian Greenstone) (06/02/89)

Does anyone here know how you go about writing and reading synchronized
tracks from a 3.5" drive?

-Brian

dlyons@Apple.COM (David Lyons) (06/03/89)

In article <8906021716.AA25779@crash.cts.com> pnet01!pro-nsfmat!pro-lep!orcus@nosc.mil writes:
>Does anyone here know how you go about writing and reading synchronized
>tracks from a 3.5" drive?
>
>-Brian

I don't have the answer, but I know that (if the terms mean the same thing in
the 3.5 world that they do in the 5.25 world) self-sync bytes and synchronized
tracks are two different things.

Self-sync bytes are special nibbles that are used when reading to get
synchronized with the nibbles on disk--otherwise you might find yourself
reading part of one nibble and part of another nibble & thinking they
were one nibble.

Synchronized tracks means that each track starts at a particular place
compared to the track next to it.

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

kadickey@phoenix.Princeton.EDU (Kent Andrew Dickey) (06/04/89)

In article <32218@apple.Apple.COM> dlyons@Apple.COM (David Lyons) writes:
>In article <8906021716.AA25779@crash.cts.com> pnet01!pro-nsfmat!pro-lep!orcus@nosc.mil writes:
>>Does anyone here know how you go about writing and reading synchronized
>>tracks from a 3.5" drive?
>>
>>-Brian
>
>I don't have the answer, but I know that (if the terms mean the same thing in
>the 3.5 world that they do in the 5.25 world) self-sync bytes and synchronized
>tracks are two different things.
>
>Self-sync bytes are special nibbles that are used when reading to get
>synchronized with the nibbles on disk--otherwise you might find yourself
>reading part of one nibble and part of another nibble & thinking they
>were one nibble.
>
>Synchronized tracks means that each track starts at a particular place
>compared to the track next to it.
>
> --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
>   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
>   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
>   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
>   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

OK, I 'sort of' know this information--I've looked over code which
directly accesses the 3.5" drive, but I haven't memorized it...

First, there is a big difference between the Apple 3.5" drive and the
Unidisk drive--I'm only going to cover Apple 3.5" drive.

It works a lot like an ordinary 5.25" drive (in terms of soft-switches
to access), but when writing to the drive, the drive will tell you when
to write--you poll C0EC waiting for it to go high (BPL loop), and then
do a STA $C0ED (or whatever the exact location is...again, I'm fuzzy
here).  This allows you to run code at 2.5 MHz that will still write to
the disk at 32 micro-sec intervals.  Try tracing through the ROM code
for the 3.5" disk access routines--some of the interesting stuff is at
$ff/6000-$6600 (or so).  Wait...maybe it's bank $FE--the code is easy to
pick out (the $C0EC references, etc.).

The way sync bytes are written is to pre-shift the 10-bit pattern for
sync bytes and then write that sequence out repeatedly.  The bytes to
write out would be: $3F, $CF, $F3, $FC, $FF, $3F, etc...Write out those
bytes as consecutive bits--they should consist of 2 0-bits followed by 8
1-bits, continuously...that's the trick for 3.5" disks. 

I've obviously skimmed over a GREAT DEAL here--I am assuming that you
know a fair amount about low-level drive access, otherwise what you are
implying is quite difficult.

Anyone:  Feel free to send me e-mail for more info.  But this is a
toll-call for me, so there may be quite a delay before I reply.  And my
account is supposed to die in a few weeks...

			Kent Dickey
kadickey@phoenix.Princeton.EDU
kadickey@PUCC.bitnet