Modified frequency modulation (MFM) is a run-length limited (RLL) line code[1] used to encode data on most floppy disks and some hard disk drives. It was first introduced on hard disks in 1970 with the IBM 3330 and then in floppy disk drives beginning with the IBM 53FD in 1976.
MFM is a modification to the original frequency modulation encoding (FM) code specifically for use with magnetic storage. MFM allowed devices to double the speed data was written to the media as the code guaranteed only one polarity change per encoded data bit. For this reason, MFM disks are typically known as "double density" while the earlier FM became known as "single density".
MFM is used with a data rate of 250–500 kbit/s (500–1000 kbit/s encoded) on industry-standard -inch and -inch ordinary and high-density floppy diskettes. MFM was also used in early hard disk designs, before the advent of more efficient types of RLL codes. Outside of niche applications, MFM encoding is obsolete in magnetic recording.
Magnetic storage devices, like hard drives and magnetic tape, store data not as absolute values, but in the changes in polarity. This is because a changing magnetic field will induce an electrical current in a nearby wire, and vice versa. By sending a series of changing currents to the read/write head while the media moves past it, the result will be a pattern of magnetic polarities on the media that change where the data was a "1". The exact nature of the media determines how many of these changes can occur within a given surface area, and when this is combined with the nominal speed of movement, it produces the maximum data rate for that system.
Disk drives are subject to a variety of mechanical and materials effects that cause the original pattern of data to "jitter" in time. If a long string of "0" are sent to disk, there is nothing to indicate which bit a following "1" might belong to - due to the effects of jitter it may become misplaced in time. Re-aligning the signals on the disk with individual data bits requires some sort of timing encoded to the disk along with the data.
A diverse range of suitable encodings, known generally as line codes, have been developed for this purpose. Their suitability depends on the media or transmission mechanism being used.
Frequency modulation encoding (FM) was the first widely used system to perform this operation. The drive controller includes an accurate clock running at half the selected data rate of the disk media. When data is written to the disk, the clock signal is interleaved with the data. On reading, the clock signals are used as short-term triggers to time the presence or lack of a following signal that represents the data bits.[2]
The upside to the FM approach is that it is extremely easy to implement the writing circuity and the clock recovery on reading is also relatively simple. The downside is that it uses up half of the disk surface for the clock signal, thus halving the total amount of data the disk can store. This led to new forms of encoding that were more efficient.
Modified frequency modulation encodes the clock signal and the data in a single "clock window". Unlike FM, a clock bit is only written when needed to achieve synchronization when both current and preceding data bits are not set. On average, MFM achieves double the information density of FM.[3]
The basic encoding rule for MFM is that (x, y, z, ...) encodes to (x, x NOR y, y, y NOR z, z, z NOR...). A zero bit is encoded as if preceded by a zero bit in the input stream, and if preceded by a one; a one bit is always encoded as . The number of magnetic transitions per one bit of encoded data is on average 0.75 to 1.[4]
Note that the surrounding clock bits are sometimes known, but sometimes require knowledge of the adjacent data bits. A longer example: Data: 0 0 0 1 1 0 1 1 ... FM encoded: 10101011111011111... MFM clock: ? 1 1 0 0 0 0 0 0... MFM encoded: ?0101001010001010...(The bold bits are the data bits, the others are the clock bits.)
In FM encoding, the number of 0-bits that may appear between consecutive 1-bits is either 0 or 1. In MFM encoding there is a minimum of 1 zero bit between adjacent ones (there are never two adjacent one bits), and the maximum number of zeros in a row is 3. Thus, FM is a (0,1) RLL code, while MFM is a (1,3) code.
Because the MFM system requires more accurate timing of the clock signal, it was not possible economically to build the required analog and digital components on a single integrated circuit using late 1970s technology. Instead, MFM drivers required the drive vendor to design their own clock recovery circuitry, a system known as the data separator. Data separator design was an art form of its own.[5]
Among the most widely used controllers of the era was the Western Digital FD1771 series. The original FD1771 supported FM only, but it was quickly paired with the FD1781 and FD1791 which performed MFM based on an externally provided clock signal. Implementing MFM support with these drivers required an external data separator. Rapid improvement in IC manufacturing in the late 1970s and early 1980s led to the first low-cost all-in-one MFM drivers in the early 1980s. The WD2791 was the first to directly support MFM using an internal analog phase locked loop, but it required a number of simple external components to implement a complete system. The WD1770 was the first to implement a complete MFM solution in a single chip.
See main article: Disk formatting. FM and MFM are used to indicate the position of individual bits in the original data, but the data does not in itself have any higher level of organization like "files". This is the purpose of the format of the disk. Disks are typically formatted into fixed-sized sectors which contain additional header information to link them back to files.
In the IBM formats, the start of a sector's header information and the start of the data itself are indicated with special "sync mark", a pattern of 0s and 1s that cannot appear in the data itself. This is accomplished by not encoding this data using the FM or MFM encoding, making it easy for the driver to spot it. The sync mark that is commonly used in MFM encoding is known as the "A1 sync" since the data bits form the start of the hexadecimal value A1 (10100001), but the fifth clock bit is different from the normal encoding of the A1 byte.
Data: 1 0 1 0 0 0 0 1 Clock: 0 0 0 1 1 1 0 Encoded: 100010010101001 Sync clock: 0 0 0 1 0 1 0 Sync Mark: 100010010001001 ^ Missing clock bit
MMFM, (Modified Modified Frequency Modulation), also abbreviated M²FM, or M2FM, is similar to MFM, but suppresses additional clock bits, producing a longer maximum run length (a (1,4) RLL code). In particular, a clock pulse is only inserted between a pair of adjacent 0-bits if the first bit of the pair did not have a clock pulse inserted before it. In the example below, clock bits that would have been present in MFM are noted in bold: Data: 1 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 Clock: 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 0 Encoded: 01010001001001001000010010001001001000100001
In this system, sync marks are made by inserting additional clock pulses between adjacent zero bits (following the MFM rule) where they would normally be omitted. In particular, the data bit pattern "100001" has a clock pulse inserted in the middle, where it would normally be omitted:
Data: 1 0 0 0 0 1 Normal: 0 1 0 1 0 Sync: 0 1 1 1 0