home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / c / ZFMAT.ZIP / ZFMAT.DOC < prev    next >
Encoding:
Text File  |  1988-06-17  |  3.4 KB  |  72 lines

  1. ZFMAT: Diskette Formatting Program
  2. Copyright 1988 by Edward V.  Dong, All Rights Reserved.  
  3.  
  4. Edward V Dong's Floppy Formattor is a Turbo C program to format floppy
  5. diskettes, based on earlier work by Frank Nystrom (COPYIT.C;CIS
  6. 71631,355), Kim Kokkonen (FMAT.PAS; Compuserve 72457,2131), and Peter
  7. Norton (BOOT.ASM).  This programs formats, accurately, 360K diskettes
  8. in either standard 360K drives or 1.2M drives; and has been tested on
  9. an XT clone with a 360K drive and an AT clone with a 1.2M drive.  This
  10. has not been tested on an AT with a 360K drive, and the program assumes
  11. that 1.2M drives are used only with AT class machines.
  12.  
  13. Essentially, formatting is all performed by the BIOS, through calls to
  14. Turbo C's biosdisk() routine.  To format a disk, the tracks are first
  15. formatted, then boot record, two copies of the file allocation table
  16. (FAT), and the root directory are written to the diskette.  This
  17. program then verifies each track, again via the BIOS.  The basic
  18. formatting and verification routines are derived from Nystrom's
  19. COPYIT.C; the boot record used is a custom one, based on Norton's
  20. BOOT.ASM.  The FAT and root directory routines are rehosted versions
  21. based on Kokkonen's FMAT.PAS.
  22.  
  23. To format 360K diskettes in 1.2 megabyte drives, the DASD must be set -
  24. this is only possible for DOS 3.0 or higher and for AT class machines. 
  25. The routines here are based on Kokkonen's Turbo Pascal work, ported to
  26. Turbo C.  Through some experimentation and analysis, the only
  27. difference with running on an AT machine is to use a delay of about 0.3
  28. seconds between biosdisk calls to allow the disk heads to settle.
  29.  
  30. Quick disk reformat is here done as a rewrite of the diskette's boot
  31. sector, FAT, and root directory.  A "quick" reformat ASSUMES that the
  32. diskette has no bad sectors at all.  Depending on configuration, DOS
  33. retains a copy of the old FAT which shows the old free space, even
  34. though the directory has been cleared.  This is only true for AT's and
  35. 1.2 meg drives; as a workaround, one track is formatted, which seem to
  36. force AT floppy disk controller to recognize that the disk has been
  37. changed; and therefore DOS will read the diskette to acquire the new
  38. FAT and directory information.
  39.  
  40. This source code is placed into the public domain.  However,
  41. contributions are always welcome.  This is a modified form of the
  42. source code used in the author's ZIP program.  Written for Turbo C 1.5,
  43. it should compile under Turbo C 1.0 as well, and should be portable to
  44. other C compilers (notably MicroSoft).  The included C source is well
  45. annotated, so you should have no problem understanding it (I assume
  46. some knowledge of BIOS, DOS, and diskette organization).
  47.  
  48. Files Included
  49. --------------
  50. ZFMAT.C      Turbo C source code
  51. ZFMAT.EXE    Executable
  52.  
  53. Files Not Included
  54. ------------------
  55. FMAT.PAS     Original disk formatting code by Kim Kokkonen 
  56. BOOTREC.ASM  Peter Norton's BOOT record source code
  57.  
  58. Programming Note: Character bytes MUST BE set as unsigned. (If not,
  59. you will get some nasty 'out of range' warnings.) This was
  60. compiled using the Large Model, but is essentially independent of C
  61. memory model.
  62.  
  63.    Edward V. Dong, 12205 Alexandria Pl, Chino, CA 91710. 
  64.  
  65. Change History
  66. --------------
  67. 08 Jun 88 - Add check for type of drive (360K or 1.2Meg)
  68. 04 Jun 88 - set up logical disk sectoring -
  69. 01 Jun 88 - fix message on disk space -
  70. 18 May 88 - original issue
  71.  
  72.