FLOPPY DISK TECHNICAL INFO -------------------------- By Frankenstein There are quite some FD's available for our Atari 8-bit. They all support several different disk formats: Name | FDC | Formats --------------------------------------- Atari 810 | WD1771 | SD Atari 1050 | WD2793/2797 | SD/ED Atari XF551 | WD1772 | SD/ED/DD/QD SD = Single density ED = Enhanced density DD = Double density QD = Quad density Notes: 1) FDC = Floppy Drive Controller 2) The WD1772 is also used in the Atari ST computers 3) ED is also called MD (Medium density) or '1050 Double density' (SpartaDos). Confusing.... During the years people made exotic expansion boards for the 1050 drive. Some of these make it possible to program the FDC. Known FD expansions are: Duplicator 1050, Turbo 1050, Speedy 1050, Happy 1050, I.S. Plate 1050, Supermax 1050. They're all able to at least read/write SD, ED and DD disks. Let's now take a look at the mentioned disk formats: Density SD ED DD QD --------------------------------------- FDC mode FM MFM MFM MFM Disk sides 1 1 1 2 Number of tracks 40 40 40 40 Sectors per track 18 26 18 18 Bytes per sector 128 128 256 256 --------------------------------------- Disk space (kB) 90 130 180 360 Most drives (including all Atari 8-bit drives) use the so called soft sectored disks. This means that a track can be seen as just one long data stream. With help of markers the FDC knows where to find the right sector data in this stream. In general a track looks like this: General track structure: Marker | Index mark \ Start of Gap #1 | Post index mark / track Gap #2 | Pre address mark \ Marker | Address mark | First Data | Sector header | Sector Gap #3 | Post address mark | Marker | Data address mark | Data | Sector data | Gap #4 | Post data mark / The first sector is followed by the rest of the sectors which all have the same structure as the first sector. Note that the first sector doesn't have to be numbered as sector #1. To find the right sector on a track, the FDC looks at the sector header.... Sector Header -------------------------- 1 byte : Track number 1 byte : Side number 1 byte : Sector number 1 byte : Sector length ID 2 bytes : CRC value The track number ranges from 0 to 39 for all Atari 5.25 inch drives. A disk has two sides, so the side number can only be 0 or 1. The sector number ranges from 1 to 18 for SD, DD and QD, while ED sector numbers go from 1 to 26. With help of the sector length ID you can determine the sector length in bytes, by looking at the following table: ID | Length ---------------- $00 | 128 bytes $01 | 256 bytes $02 | 512 bytes $03 | 1024 bytes The CRC value is a checksum for the previous four bytes. The actual sector data is also followed by such a CRC value. I've been able to examine all standard Atari 8-bit disk formats. The following tables are not taken from technical documents. They were found with help of a track analyser program. Atari 1050/XF551 - Single density ===================================== 1 x $FC Index mark 16 x $00 Post index mark ------------------------------------- 18 times ----------------------------------- | 6 x $00 Pre address mark | 1 x $FE Address mark | 1 x $xx Track number (0-39) | 1 x $00 Side number | 1 x $xx Sector number (1-18) | 1 x $00 Sector length | 2 x $xx CRC value | 17 x $00 Post address mark | 1 x $FB Data address mark | 128 x $xx --sector data-- | 2 x $xx CRC value | 14 x $00 Post data mark ===================================== Atari 1050/XF551 - Enhanced density ===================================== 1 x $FC Index mark 50 x $4E Post index mark ------------------------------------- 26 times ----------------------------------- | 12 x $00 Pre address mark | 3 x $A1 Sync. | 1 x $FE Address mark | 1 x $xx Track number (0-39) | 1 x $00 Side number | 1 x $xx Sector number (1-18) | 1 x $00 Sector length | 2 x $xx CRC value | 22 x $4E Post address mark | 12 x $00 | 3 x $A1 Sync. | 1 x $FB Data address mark | 128 x $xx --sector data-- | 2 x $xx CRC value | 18 x $00 Post data mark | 32 x $4E ===================================== Atari 1050/XF551 - Double density ===================================== 1 x $FC Index mark 50 x $4E Post index mark ------------------------------------- 18 times ----------------------------------- | 12 x $00 Pre address mark | 3 x $A1 Sync. | 1 x $FE Address mark | 1 x $xx Track number (0-39) | 1 x $00 Side number | 1 x $xx Sector number (1-18) | 1 x $01 Sector length | 2 x $xx CRC value | 22 x $4E Post address mark | 12 x $00 | 3 x $A1 Sync. | 1 x $FB Data address mark | 256 x $xx --sector data-- | 2 x $xx CRC value | 18 x $00 Post data mark | 32 x $4E ===================================== I guess that the specific XF551 QD format is DD on both sides. I don't understand why I could only look at side one of the QD disk. Side two just seem to be garbage on my 1050 FD, while the XF551 FD could use both sides without problems. IBM - 40 tracks ===================================== 1 x $FC Index mark 50 x $4E Post index mark ------------------------------------- 9 times ----------------------------------- | 12 x $00 Pre address mark | 3 x $A1 Sync. | 1 x $FE Address mark | 1 x $xx Track number (0-39) | 1 x $xx Side number (0/1) | 1 x $xx Sector number (1-9) | 1 x $02 Sector length | 2 x $xx CRC value | 22 x $4E Post address mark | 12 x $00 | 3 x $A1 Sync. | 1 x $FB Data address mark | 512 x $xx --sector data-- | 2 x $xx CRC value | 80 x $4E Post data mark ===================================== Some FDC commands ----------------- FDC Command $F5: This puts three bytes $A1 on disk and starts CRC (Checksum) generator (MFM mode only). FDC Command $F6: Just writes one byte $C1 (MFM mode only). FDC Command $F7: Writes the two CRC bytes on disk (FM and MFM mode). Sector data ----------- On all Atari disk formats the sector data is stored inverted. The software in the floppy O.S. takes care of this by using 'EOR #%11111111'. This is only true for sector data! Gap bytes, marks etc. are normally stored, so you don't have to invert those. Sector data on IBM disks is not inverted at all. Sector interleave ----------------- An FDC needs a little time to send sectordata to a buffer. During this time the disk keeps spinning at about 300 rpm. So, when a sector is recieved, the FDC has to wait for the next sector to pass by. To avoid the waiting the disk has to be interleaved. By sector interleaving sectors are placed on the disk in the most efficient order. E.g. if it takes less than half a rotation to send data to the buffer, it's wise to use an interleave factor which is equal to the total sectors on the track divided by two. When the sectors are positioned in a normal sequence (0, 1, 2 etc) the interleave factor is 1. The interleave factor can be defined as the amount of sectors between two successive sector numbers plus one. For SD and ED the interleave factor is in fact half of the total amount of sectors on the track: SD - 1050/XF551: 18 sectors per track Interleave factor: 9 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26. ED - 1050/XF551: 26 sectors per track Interleave factor 13 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26. I discovered two different interleave factors for DD (the interleave factor is sometimes revered to as 'sector skew'). The first one is 'fast' for 1050 read/write operations and the second makes things faster for the XF551 FD. DD - 1050: 18 sectors per track Interleave factor 15 6, 12, 18, 5, 11, 17, 4, 10, 16, 3, 9, 15, 2, 8, 14, 1, 7, 13. DD - XF551: 18 sectors per track Interleave factor 9 1, 3, 5, 7, 9, 11, 13, 15, 17, 2, 4, 6, 8, 10, 12, 14, 16, 18. IBM disks doesn't need sector interleaving on FD's. Eh well, in such case the interleave factor is just 1. 1, 2, 3, 4, 5, 6, 7, 8, 9. Custom sector interleaving -------------------------- There are two ways to increase the disk load speed with help of custom sector interleaving; 1) Hardware interleaving: With special hardware (like happy or speedy) we can format a disk, using the most efficient sector interleave. 2) Software interleaving: By loading the sectors in the order which corresponds to the most efficient sector interleave. Since we're dealing with lots of different floppy drives, there's no such thing as 'the ideal sector interleave'. Therefore it's not recommended to use hardware interleaving. A disk with a fast-load interleave for the XF-551 drive will load extremely slow on a 1050 drive. However, software interleaving can be useful. When we're going to use this we have to keep in mind that a normal formatted disk already has a certain sector interleave. It would be possible to make a program which can determine the best read/write interleave by measuring the time between the reading or writing of two sectors on the same track. We also have to keep in mind that the sio (serial I/O) routines in the operating system are too slow for small interleave factors. E.g. the XF-551 drive is able to load using a sector interleave of 7, but this is only possible if the baud rate is adjusted Sector shifting --------------- Moving the read/write-head to the logical following track takes a small amount of time. Sector shifting can be helpful to make the 'change track' a little faster. For example, if the last sector from a track is read, the head moves to the next track. While the head moves, the disk keeps rotating and skips, let's say 25% of the total sectors. Wouldn't it be nice if the first sector of the next track was positioned right on the place where the head is after moving? An example explains a lot: track 0: 1, 2, 3, 4, 5, 6, 7, 8, 9 track 1: 4, 5, 6, 7, 8, 9, 1, 2, 3 track 2: 7, 8, 9, 1, 2, 3, 4, 5, 6 etc.... After a little experimenting I discovered that the XF-551 moves faster from track to track compared to a 1050 drive. Try to measure the time between sector 26 (the last sector on track 0) and a sector from the next track (track 1) of a normal ED disk. Finally.... ----------- This article is finished. I hope there aren't too much mistakes. If there's anything which make you scratch your forehead, let me know. I'm very interested in knowing more about different FD's. I've heard a lot about the INDUS GT, but I never got my hands on one. Someone out there who can tell us something about this drive? If there are any Polish Atarians reading this, I would like to know more about all those fantastic FD's you have in Poland (like TOMS Multi drive, CA-2001 and LDW 2000). Just write something about it. Freddy