Previous 199869 Revisions Next

r37068 Sunday 5th April, 2015 at 18:51:18 UTC by Zoƫ Blade
Tidy documentation
[docs]floppy.txt

trunk/docs/floppy.txt
r245579r245580
8383A sensor detects when the head is on track 0 and the controller is not
8484supposed to try to go past it.  In addition physical blocks prevent
8585the head from going out of the correct track range.  Some systems
86(apple 2, some c64) do not take the track 0 sensor into account and
86(Apple II, some C64) do not take the track 0 sensor into account and
8787just wham the head against the track 0 physical block, giving a
8888well-known crash noise and eventually damaging the head alignment.
8989
90Also, some systems (apple 2 and c64 again) have direct access to the
90Also, some systems (Apple II and C64 again) have direct access to the
9191phases of the head positioning motor, allowing to trick the head into
9292going between tracks, in middle or even quarter positions.  That was
9393not usable to write more tracks, since the head width did not change,
r245579r245580
9595it was used for some copy protection systems.
9696
9797The disk rotates at a fixed speed for a given track.  The most usual
98speed is 300rpm for every track, with 360rpm found for HD 5.25"
99floppies and most 8" ones, and a number of different values like 90rpm
100for the earlier floppies or 150rpm for an HD floppy in an amiga.
98speed is 300 rpm for every track, with 360 rpm found for HD 5.25"
99floppies and most 8" ones, and a number of different values like 90 rpm
100for the earlier floppies or 150 rpm for an HD floppy in an Amiga.
101101Having a fixed rotational speed for the whole disk is called Constant
102102Angular Velocity (CAV, almost everybody) or Zoned Constant Angular
103103Velocity (ZCAV, C64) depending on whether the read/write bitrate is
104constant or track-dependant.  Some systems (apple 2, mac) varies the
105rotational speed depending on the track (something like 394rpm up to
106590rpm) to end up with a Constant Linear Velocity (CLV).  The idea
104constant or track-dependant.  Some systems (Apple II, Mac) vary the
105rotational speed depending on the track (something like 394 rpm up to
106590 rpm) to end up with a Constant Linear Velocity (CLV).  The idea
107107behind ZCAV/CLV is to get more bits out of the media by keeping the
108108minimal spacing between magnetic orientation transitions close to the
109109best the support can do.  It seems that the complexity was not deemed
r245579r245580
158158  2.3 Floppy controller
159159
160160The task of the floppy controller is to turn the signals to/from the
161floppy drive into something the main cpu can digest.  The level of
161floppy drive into something the main CPU can digest.  The level of
162162support actually done by the controller is extremely variable from one
163device to the other, from pretty much nothing (apple2, c64) through
164minimal (amiga) to complete (western digital chips, upd765 family).
163device to the other, from pretty much nothing (Apple II, C64) through
164minimal (Amiga) to complete (Western Digital chips, uPD765 family).
165165Usual functions include drive selection, motor control, track seeking
166166and of course reading and writing data.  Of these only the last two
167167need to be described, the rest is obvious.
r245579r245580
170170or bytes) are encoded on the surface, and how these are grouped in
171171individually-addressable sectors.  Two standards exist for these,
172172called FM and MFM, and in addition a number of systems use their
173home-grown variants.  Moreover, some systems such as the amiga use a
174standard bit-level encoding (MFM) but an homegrown sector-level
173home-grown variants.  Moreover, some systems such as the Amiga use a
174standard bit-level encoding (MFM) but a homegrown sector-level
175175organisation.
176176
177177
178178  2.3.1 Bit-level encodings
179179  2.3.1.1 Cell organization
180180
181All floppy controllers, even the wonkiest like the apple 2 one, start
181All floppy controllers, even the wonkiest like the Apple II one, start
182182by dividing the track in equally-sized cells.  They're angular
183183sections in the middle of which a magnetic orientation inversion may
184be present.  From an hardware point of view the cells are seen as
184be present.  From a hardware point of view the cells are seen as
185185durations, which combined with the floppy rotation give the section.
186186For instance the standard MFM cell size for a 3" double-density floppy
187is 2us, which combined with the also standard 300rpm rotational speed
187is 2us, which combined with the also standard 300 rpm rotational speed
188188gives an angular size of 1/100000th of a turn.  Another way of saying
189189it is that there are 100K cells in a 3" DD track.
190190
r245579r245580
234234same surface, hence its other name of "double density".  The cell size
235235is set at slightly over half the physical limit, e.g. 2us usually.
236236The constraint means that two '1' cells must be separated by at least
237one '0' cell. Each bit is once again encoded on two cells:
237one '0' cell. Each bit is once again encoded on two cells:
238238
239239- the first cell, called the clock bit, is '1' if both the previous
240240  and current data bits are 0, '0' otherwise
r245579r245580
252252Group Coded Recording, or GCR, encodings are a class of encodings
253253where strings of bits at least nibble-size are encoded into a given
254254cell stream given by a table.  It has been used in particular by the
255apple 2, the mac and the c64, and each system has its own table, or
255Apple II, the Mac and the C64, and each system has its own table, or
256256tables.
257257
258258  2.3.1.5 Other encodings
r245579r245580
342342The crc is a cyclic redundancy check of the data bits starting with
343343the mark just after the pulse train using polynom 0x11021.
344344
345The western digital-based controllers usually get rid of everything
345The Western Digital-based controllers usually get rid of everything
346346but some 0xff before the first sector and allow a better use of space
347347as a result.
348348
r245579r245580
365365- MFM-encoded 0xfb, sector data followed by two bytes of crc
366366- A number of MFM-encoded 0x4e (usually 84, very variable)
367367
368The the track is finished with a stream of MFM-encoded 0x4e.
368The track is finished with a stream of MFM-encoded 0x4e.
369369
370370The 250KHz pulse trains are used to lock the PLL to the signal
371371correctly.  The cell pattern 4489 does not appear in normal
372372MFM-encoded data and is used for clock/data separation. 
373373
374As for FM, the western digital-based controllers usually get rid of
374As for FM, the Western Digital-based controllers usually get rid of
375375everything but some 0x4e before the first sector and allow a better
376376use of space as a result.
377377
378378  2.3.2.3 Formatting and write splices
379379
380To be usable a floppy must have the sector headers and default sector
380To be usable, a floppy must have the sector headers and default sector
381381data written on every track before using it.  The controller starts
382382writing at a given place, often the index pulse but on some systems
383383whenever the command is sent, and writes until a complete turn is
r245579r245580
417417- 3, MG_D -> Damaged zone, reads as neutral but cannot be changed by writing
418418
419419The position is in angular units of 1/200,000,000th of a turn.  It
420corresponds to one nanosecond when the drive rotates at 300rpm.
420corresponds to one nanosecond when the drive rotates at 300 rpm.
421421
422422The last cell implicit end position is of course 200,000,000.
423423
r245579r245580
523523                                     int sectdata_size)
524524
525525  Extract standard mfm or fm sectors from a regenerated
526  cell stream. Sectors must point to an array of 256 desc_xs.
526  cell stream. Sectors must point to an array of 256 desc_xs.
527527
528528  An existing sector is recognizable by having ->data non-null.
529529  Sector data is written in sectdata up to sectdata_size bytes.
r245579r245580
563563
564564  3.3.1 Control signals
565565
566Due to the way they're usually connected to cpus (e.g. directly on an
567i/o port) the controls signals work with physical instead of logical
566Due to the way they're usually connected to CPUs (e.g. directly on an
567I/O port), the control signals work with physical instead of logical
568568values.  Which means than in general 0 means active, 1 means inactive.
569569Some signals also have a callback associated called when they change.
570570


Previous 199869 Revisions Next


© 1997-2024 The MAME Team