On 08/09/2013 03:46 PM, Al Kossow wrote:
I suspect Chuck Guzis is very familiar with all of
this. I also thought
that on floppies precomp
was only applied after tk 23 on 5" and 43 on 8"
Reduced write current on 8" floppies after 43. TG43 *could* be used to
trigger precomp, but usually isn't. As a matter of fact, I'm aware of
no FDC datasheet that specifies when precomp is asserted--some allow for
it to be explicitly specified. I suspect that some FDCs simply precomp
all cylinders as there's no way for the controller to tell if you're
writing 40 cylinders or 77 or 80.
Write precompensation is a very clover scheme to, as Al observes, to
get around the effects of "bit shifting" on inner cylinders, where
attempting to record a flux change too close to another already written
will tend to shift the one being written away from the one already
written. It's usually done with MFM, because MFM is somewhat more
susceptible to timing jitter, but there's no reason that it couldn't be
used on, say, GCR as well.
The confusing part about most descriptions of the process is that they
don't make it clear that when they're talking about 1 and 0, they're not
talking about the data stream being encoded, but rather the stream after
encoding. So, 1 = flux change, 0 = no flux change.
The actual amount of precompensation is somewhat arbitrary and differs
from vendor to vendor. Floppies usually use a unit of
about 1/16 of a
bit cell, or, in the about 125 microseconds in the case of a 500KHz
data
rate. Older hard disk MFM controllers used delay lines for this, but
simply deriving it from the floppy clock is usually good enough.
So, you need a window into the data stream heading out to the write
circuitry. You need to know what you've written, what you're about to
write and what you're going to write after that.
Clearly, if you're going to write a 0, i.e. no flux change, you don't
need to make any decision, wince you're not doing anything.
Here's a scheme that I use, and it seems to work very well. Note that
what's being written is a "1" (flux change) and we'll denote
"now" with
a "|":
Next Last
(1) 010 | 000
(2) 010 | 001
(3) 100 | 010
(4) 000 | 010
Note that in MFM, you never have two flux changes ("1") immediately
adjacent to each other.
The first two are "late"; that is, we delay our flux change, so it's
recorded closer to the "1" we're going to record next, which will shift
it "backwards".
The second two cases are "early". That is, if just wrote the "1"
on-center, it would get shifted as if it were delayed, so we compensate
by writing it earlier than usual.
That's really all there is to it. This is by no means the only scheme
and you can even mimic some of the hard drive logic that adjusts precomp
depending on the cylinder. Generally, you apply precomp somewhere
after you've reached the halfway point on a disk, but that can vary from
drive to drive.
You may find the ENCODE routine in the Linux Catweasel driver to be more
suited to a software implementation. It accomplishes the same thing,
but doesn't require lookup tables. The language, however, is a bit
confusing if you're thinking about flux reversals--the author uses the
terms "long pulse" and "short pulse".
--Chuck