home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / diskutil / ff32bin / fastflop.doc < prev    next >
Text File  |  1993-08-05  |  11KB  |  224 lines

  1.                 FASTFLOP:  Speeds floppy disk I/O
  2.  
  3.                  Copyright 1989 by Robert Fischer
  4.                   
  5.  
  6. FastFlop is a program which speeds up reads and writes to 
  7. your floppy disks.  Unlike Twister, it works with normal-format disks. 
  8. FastFlop does not speed up formatting or the few
  9. programs (mostly games) which read and write large quantities of data
  10. directly with Floprd() and Flopwr().
  11.  
  12. To install FastFlop, run FASTFLOP.PRG first in the AUTO folder.  A
  13. sign-on message should come on.  The program may tell you that you
  14. have an unsupported version of the ROMs, in which case you will have
  15. to get a new version of FastFlop.  Contact me or read, comprehend and
  16. act on the file REBUILD.DOC if your ROMS are different.  FastFlop
  17. currently works on the following ROMs:
  18.  
  19. TOS version  | Date
  20. -------------+-----------
  21.     1.0      | 11-20-85
  22.     1.2      |  4-22-87
  23.     1.4      |  8- 8-88
  24.     1.4      |  4- 6-89
  25.  
  26. If your disks are Twisted and you plan to use FastFlop, reformat the
  27. disks so they are untwisted.  For reasons explained below, Twister
  28. plus FastFlop is slower than TOS 1.0 alone.  Note that TOS 1.2 and
  29. above automatically twist disks when formatting from the desktop, so
  30. some other format program must be used if you have a later version of
  31. the ROMs.  The accompanying program called FORMAT.PRG is one such
  32. possible program. 
  33.  
  34. I (Robert Fischer) MAKE NO WARRANTIES, EXPRESSED OR IMPLIED, ABOUT
  35. FASTFLOP, AND I AM NOT LIABLE FOR ANY DAMAGE RESULTING DIRECTLY OR
  36. INDIRECTLY FROM ITS USE OR MISUSE. 
  37.  
  38. The rest of this document is technical and need not be read.
  39.  
  40.  
  41.  
  42. Here's how FastFlop works:
  43.  
  44. Let's say that TOS (without FastFlop) needs to read many sequential
  45. tracks starting at track 1 on a disk.  Let's also say the drive just
  46. finished reading track 0.  It first positions the head on
  47. track 1 (taking 2 ms, or .002 seconds) and waits 30 ms (.03 sec) for
  48. the drive head to settle down, since moving the drive head makes it
  49. vibrate.  Since about 10 sectors fit on a track and the disk spins at
  50. 300 rpm, or 5 rev. per seconds, then .03 seconds is the time it takes
  51. for about 1.5 sectors to pass across the disk head.  Since the read
  52. request starts at sector 1 and assuming that the drive head was on
  53. sector 1 before it waited the 30 ms, the controller has to wait about
  54. 80% of a track before it can read anything.  So, after waiting not
  55. only 30 ms, but also another 170 ms then reads track 0 and seeks to
  56. track 1.  Clearly, this gives about 50% efficiency.  For every two
  57. times the disk turns around, data is only read on one revolution.
  58.  
  59. FastFlop tries to start reading the track at the place the drive head
  60. is currently positioned.  It may read track 0 starting at sector 1 and
  61. seek the head just as before.  Now the drive head is on sector 3, so
  62. it starts reading at sector 3 and reads sectors 1-2 when those two sectors
  63. come around again.  It starts reading the next track at sector 5, and
  64. so on.
  65.  
  66. There is one problem with the approach above -- as was stated, when
  67. the drive head seeks from track to track, it must wait thirty
  68. milliseconds or the drive head to settle before it can read or write.
  69. It seems natural that if the head is already on that track and does no
  70. seeking, that it shouldn't have to wait when you use floprd() or
  71. flopwr().  Unfortunately, BIOS was programmed so that every floprd()
  72. or flopwr() call waits that 30ms for the drive head to settle down,
  73. even if the drive head is already on the track which is being read.
  74. FastFlop reads most tracks in two blocks and the Atari BIOS prevents
  75. doing this with any efficiency.  So, I had to write FastFlop so that
  76. it copies the BIOS floppy driver from your ROMs (floprd(), flopwr(),
  77. and a few support routines) and then makes the following little patch
  78. to it:
  79.         cmp     dcurtrack(a1), d7   ; already on correct track?
  80.         bne     gotover             ; (no), wait the 30 ms
  81.         move.w  #$10, d6            ; (yes) use "seek w/o verify"
  82.  
  83. (The "verify" referred to here is the "verify" command in the Atari
  84. Hardware manual which causes the disk drive to wait 30 ms.)
  85.  
  86. All memory locations about where the floppy disk driver is, or where
  87. to make the patch are, of course, undocumented.  Be careful that many
  88. different ROMs of the same TOS version number may have their magic
  89. locations in different places.  I am hoping that there are no two
  90. different ROMs with the same date and version number.  FastFlop has a
  91. table of the locations for many of the ROM versions (listed above).
  92. The technical file INSTALL.DOC tries to tell an experienced programmer
  93. how to make FastFlop work on his brand new TOS 1.6 (or whatever). 
  94.  
  95. I really do not know everything about how the floppy drive works, or
  96. about the safety of this approach.  What I do know is that FastFlop
  97. _does_ wait 30 ms for the drive head to settle down when it actually
  98. seeks.  Possibly (but this is unlikely), the drive head must settle
  99. down even when it doesn't move tracks.  What I _do_ know is that I've
  100. used FastFlop since March, 1987 and have had NO problems with it.
  101.  
  102.  
  103.  
  104.  
  105. FastFlop and DCFormat
  106.  
  107. There's a handy Public Domain disk formatter from Double-Click
  108. Software, called DCFORMAT.  In addition to formatting disks faster
  109. than I know how to format them, it gives you the option of a "fast"
  110. format, making normal TOS read and write disks at approximately twice
  111. the speed of TOS 1.0 disks, and faster than FastFlop could ever be.
  112.  
  113. DCFormat does this by writing erroneous sectors at the end of each
  114. track, causing the disk head to immediately skip to the next track and
  115. start reading without waiting 30 ms to settle down.  I personally
  116. believe that the slight time advantages of this approach does not
  117. justify the risk of losing data, but other people may prefer DCFormat. 
  118.  
  119. When presented with a DCFormatted disk, FastFlop will read it at the
  120. same speed as it will read a regular disk, PLUS it will circumvent the
  121. not waiting 30 ms.  To explain why, assume that the drive just read a
  122. track on a DCFormatted disk.  It encounters the error at the end of
  123. the track and skips to the next immediately, ready to start reading at
  124. sector 1, which is right under the drive head.  FastFlop, allowing
  125. time for the drive head to settle down, will tell the drive to start
  126. reading at sector 3.  Thus, in spite of the error on this disk which
  127. allows fast reading, FastFlop will still wait the 30 ms, reading
  128. DCFormatted disks exactly the same as it would regular disks. 
  129.  
  130.  
  131.  
  132.  
  133. FastFlop and Twister
  134.  
  135. As stated above, Twisted disks are slower with FastFlop than normal
  136. disks.  To understand this, one must understand how Twister works.
  137. Very simply, Twister is like FastFlop in hardware.  FastFlop reads the
  138. tracks starting at whatever sector it believes will be the most
  139. efficient, and Twister simply formats the disks so that sector 1 (the
  140. one read first by normal TOS) will be under the drive head when it is
  141. ready to start reading a track.  So, when reading a Twisted disk,
  142. FastFlop may start reading at sector 3 on a disk where sector 3 is
  143. at the same position as sector 5 on the previous track.  Because of
  144. this, FastFlop wastes time on a Twisted disk.  It's as if Twister and
  145. FastFlop are both "twisting", resulting in an "over-twist".
  146.  
  147. Maybe some clever programmer could figure out how to tell a Twisted
  148. disk and read it efficiently.  The problem is telling a Twisted disk
  149. when reading the boot sector in Getbpb(), or something.  I've seen
  150. CHKFMT.PRG, which can tell a twisted disk after inspecting over one
  151. track's worth of data!  If I could tell easily, I could simply turn
  152. off most of FastFlop when working with a Twisted disk, speeding up the
  153. Twisted disk to FastFlop speeds where Twisted disks don't work that
  154. fast. 
  155.  
  156. According to the above simple analysis of reading a single-sided disk,
  157. Twister and FastFlop should be the same speed.  Writing is a different
  158. story, because TOS verifies what it just wrote.  This is _NOT_ the
  159. same verify that was talked about above, but the flag at location
  160. 0x444 of your Atari.  (Some people like to turn this feature off
  161. because disks will write faster, but others feel that turning it off
  162. is like playing Russian Roulette...  I always leave it on.)
  163.  
  164. The real speed comes with FastFlop when the disk drive must do many
  165. operations on one track before moving the head.  For example, writing one
  166. track on a double-sided disk takes four operations on the same track!
  167. (Write side 0, Read side 0, Write side 1, Read side 1).  Because
  168. Twister only speeds things up when seeking from one track to another or
  169. changing from reading or writing on one side of the disk to the other,
  170. it starts to really slow down compared to FastFlop when doing
  171. operations other than reading a single-sided disk. 
  172.  
  173.  
  174.  
  175.  
  176. Timings and Comparisons
  177.  
  178. Following are some real-time results from running the accompanying
  179. DISKTEST.C, which I ran on my 1040ST with TOS 1.4 in ROM.  It requires
  180. a double-sided drive.  With the accompanying DSPEED.C, I clocked my
  181. drive at exactly 300 RPM.  For each run, DISKTEST turns on the drive
  182. and sets the disk head on the first track to read or write.  Then, it
  183. reads or writes 20 tracks of data 10 times over, recording the time
  184. used and computing the average time per track in milliseconds. 
  185.  
  186. The disks for the "Twister" run were formatted with the TOS 1.4
  187. desktop, _not_ with the original Twister by Dave Small.  The last two
  188. timings show how FastFlop interacts with Twisted and DCFormatted
  189. disks. 
  190.  
  191.                   / Single Side \ / Double Side \ 
  192.                  |  Read | Write |  Read | Write |
  193. -----------------+-------+-------+-------+-------|
  194. TOS 1.0          |  400  |  805  |  805  | 1595  |
  195. Twister          |  265  |  665  |  495  | 1300  |
  196. DCFormat         |  205  |  415  |  410  |  820  |
  197. FastFlop         |  250  |  505  |  480  | 1010  |
  198. -----------------+-------+-------+-------+-------|
  199. Fflop + DCFormat |  240  |  510  |  480  | 1015  |
  200. Fflop + Twister  |  470  |  870  |  860  | 1635  |
  201. -----------------+-------+-------+-------+-------+
  202.  
  203. As was explained above and can be seen from the table, FastFlop plus
  204. Twister is a very slow combination, even slower than TOS 1.0 alone.
  205. It surprised me that it's THAT slow, but that's what my tests show... 
  206.  
  207. If you use DCFormat's fast format option and you don't personally
  208. believe that it's a bad idea, then continue using it and forget
  209. FastFlop.  As the tables show, FastFlop + DCFormat works the same
  210. speed as FastFlop, and slower than DCFormat. 
  211.  
  212. If you were using DCFormat and are not sure if it's safe, you don't
  213. have to reformat your disks.  DCFormatted disks are "safe" to use with
  214. FastFlop, meaning that FastFlop forces the drive head to settle down
  215. for 30 ms before reading, even on DCFormatted disks, which try to
  216. circumvent this necessary step. 
  217.  
  218. FastFlop by:
  219.     Robert Fischer
  220.     80 Killdeer Road
  221.     Hamden, CT   06517
  222.     (203) 288-9599
  223.     E-mail: fischer-robert@cs.yale.edu
  224.