The first figure is flat-out wrong. Only the "D" bits they've marked
are stored on the diskette as the presence (D=1) or absence (D=0) of a
magnetic flux change. Those clock bits exist neither on the diskette
nor in the internals of the controller. (The controller does have its
own separate clock signals, but these are independent and never
intermixed with the data bits.)
The second digram gives an accurate picture of what's stored on the
diskette: a stream of 1
and 0
bits encoded as a flux change or
lack of a flux change.
That said, as well as GCR encoding for the sector data fields, the
Disk II system did use FM encoding for the sector address fields as
is shown later in Beneath Apple DOS and below. To understand how
this worked we need to understand how the controller (with some
assistance from software) reads data from the diskette and divides it
up into bytes.
Byte Framing
To start reading, the shift register that holds the read data is
cleared (set to $00) and the controller starts in a state that Jim
Sather calls "QA WAIT,"¹ where it is waiting for a 1
bit (i.e., a
flux transition) to appear. Once a 1
appears, it clocks that and
next seven bits (1
s or 0
s) into the shift register. The software
is expected to continuously test bit 7 of the shift register for the
appearance of that initial 1
bit and take that as the signal that a
full byte has been read. In the mean time, after it finishes reading a
byte the controller has re-entered QA WAIT and will leave the shift
register alone until another 1
bit appears. Shortly after that it
will clear the shift register and start clocking in another byte.
This explains why bytes stored on the disk must always start with a
1
bit: that's what triggers the start of the shift register load
sequence. When starting to read a series of bytes the controller will
start at a random bit (most likely in the middle of a byte); the
"autosync" sequence of bits in the second figure in the question shows
how, via ignoring 0
bits when starting a byte read, the controller
can sync to the byte boundaries of data being read from the diskette.
(The 0
values in that figure not covered by the braces underneath
are the ones ignored while in the QA WAIT state.)
That bytes must start with a 1
bit is particular to how the Disk II
controller assembles bytes. The other major limitation, that there may
not be more than two 0
bits in a row within a byte, is a general
limitation of reading self-clocked data from a variable speed medium.²
FM vs. GCR Encoding
The two major limitations above determine that only a subset of all
bytes valued $00 to $FF can be reliably read from a diskette; the byte
values that can be used always start with a 1
in the most
significant bit and never have more than two (or in DOS 3.2 or
earlier, one) 0
bits in a row.
This allows for use of both FM and GCR encoding, and in fact Apple DOS
uses both. On page 3-12 of Beneath Apple DOS they show the format
of the address field for each sector:
As you can see, the bytes encoding the volume, track, sector and
checksum are in a version of FM encoding: each byte is a series of 1
bits alternating with data bits. (The data bits are ordered the way
they are to make decoding easier: left-shift the XX byte, loading 1
into the LSB, and AND the result with it with the YY byte.)
For the data field for each sector, however, a GCR encoding is used.
Note that the sync, prologue, and epilogue bytes are not "encoded" at
all; they are simply raw bit patterns that follow the rules above but
are invalid in either encoding,³ allowing the system to recognize
them as "control bytes" rather than any kind of data.
Other Encodings
From the above you can see that the Disk II system seems also, with
appropriate software, probably capable of reading diskettes using
Shugart's standard single-density soft-sectored formats
that use FM encoding, such as 18 × 128 byte sectors per track (78.75
KB).⁴
However, the limitations above also indicate why an Apple II cannot
read any of the double-density MFM standard formats: they encoded
data in such a way that some bytes could start with a 0
, and the
Disk II controller cannot sync to those (though a different controller
could be designed to do so using the same drive).
¹Jim Sather, Understanding the Apple II, Figure 9.16.
Chapter 9 is a good but very detailed (42 dense pages) description
of the Disk II hardware and software; here I attempt to give an
accurate but limited description of just the parts relevant to the
question.
²The limitation for DOS 3.2 and earlier is one 0
bit; this is
due to using a different state machine in the first generation of
controllers. Generically, the particular number of 0
bits in a row
that are allowed will depend on the design of a particular system and
how much accuracy it loses as it goes longer without flux transitions, but
system designers will always set a particular limit.
³Actually the middle $AA is valid FM of half a byte, but would
never be read as such because the preceding byte is not valid FM. The
trailing $EB is actually never fully written; see Understanding the
Apple II for details.
⁴The data rate must also be the same, of course. This is limited
by the media itself, which is probably why common controllers such as
the Western Digital FD1791 and Fujitsu MB8866 use the FM data rate
established by the IBM 3740 format: 125 kHz, or 4 μs for the clock bit
and 4 μs for the data bit. The Disk II system uses 4 clock cycles per
bit, which at 1.023 MHz is very close to 4 μs.