home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / dirrep1.lbr / DIRREP.DZC / DIRREP.DOC
Encoding:
Text File  |  1993-10-26  |  4.8 KB  |  91 lines

  1. ;;
  2.                            DIRREP.DOC
  3.                              v.2        last update 12/07/84
  4. DBACK.COM v.2
  5. DREST.COM v.2
  6.  
  7.  
  8.     The files in this library, DBACK.COM and DREST.COM make up a
  9. repair kit for disk directories.  I don't know if it has happened to you
  10. (yet), but fooling around with assembly language and related subjects has
  11. led more than once to my spoiling my disk directory.  If you have only 
  12. floppies to worry about, it's not so bad, but a 10MB disk holds a lot of
  13. files!! 
  14.     
  15.     The first time this happened I was a rank beginner without a
  16. proper set of utilities or even a real knowledge of what a CPM file
  17. directory looked like; the only solution I could find was to reformat
  18. the entire hard disk!  That may be a little better than buying a new 
  19. disk drive, but hardly ideal.
  20.  
  21.     But the last time (I won't say how this happened), I was an
  22. experienced CPM programmer.  I knew that the garbage that appeared when
  23. I typed DIR came from a misdirected write that had put an allocation
  24. block into the directory (=block #0) instead of elsewhere.  This time I
  25. made use of my trusty RDWRT utility to enter an E5 at the beginning of 
  26. each spoiled entry to simulate erasure.  This cleaned up my directory 
  27. just fine, and it was a few notches more satisfactory than formatting 
  28. the disk, but one sad fact remained: the files were gone.  On my hard 
  29. disk, an allocation block is 4K, or 32 128-byte sectors.  At 4 files/sector, 
  30. I had lost 128 files.  Without their addresses in the directory, there 
  31. was no way of locating them short of stepping through the entire disk 
  32. block by block.
  33.  
  34.     The purpose of this little library is to avoid such experiences in
  35. the future by copying the disk directory into a file that can be stored
  36. on a separate disk and restored if need be to its original place.
  37.     DBACK [X]>Y will create a file called DIRFL.DRX on drive Y 
  38. containing the entire disk directory for drive X (omit if current drive).
  39.     DREST [d] will test the disk directory of drive d for "bad
  40. sectors," not the BDOS variety, but sectors that don't contain what a
  41. directory should.  It then asks you if you want to restore the directory
  42. from the file you had previously made with DBACK (which can be on a different
  43. drive).  To be on the safe side, you might answer N the first time and 
  44. take a look at your directory tracks with a disk utility like RDWRT.  If 
  45. you type 'Y', your directory will be restored from the file.  Simple, no?
  46.  
  47.     Since loss of a directory puts programmers in a state of panic, I
  48. have made the program very simple; it doesn't let you screw up by putting
  49. the wrong part of the file at the wrong place, but restores the whole thing.
  50. The only thing to watch out for is that the DIRFL file is identified only
  51. by the drive letter: DIRFL.DRA contains the directory for drive A, etc.  This
  52. means that if you have a floppy disk system you have to remember which disk
  53. was in which drive.  The way to use this program is to back up your
  54. directory just before you engage in a dangerous programming task.  But in
  55. answer to those who will claim that you can't know in advance when the
  56. tragedy will occur, I answer that a partially restored directory is better
  57. than no directory at all.  If you have written to the disk since the backup,
  58. you'll just lose some recent material.  But even if you have erased a file
  59. and its blocks have been reallocated, you can always erase it again.  You'll
  60. still be saving all the files that remained unchanged since your backup.
  61. For a hard disk, that can be quite a few.
  62.  
  63.             Technical notes: 
  64.  
  65.         --    The directory test divides sectors into G=good,
  66. B=bad and E=erased.  Since the program tests each sector twice, it returns
  67. an E for directory sectors half full or less (<=2 entries).  I have left
  68. this in since it doesn't seem worthwhile creating a new category; what
  69. you're really interested in are the sectors marked 'B'!
  70.  
  71.         --    These programs suppose a three-drive system.  If
  72. you have more than a,b,c, change the value of DRINUM at the start of each 
  73. program and reassemble.
  74.  
  75.         --    Another supposition is that the maximum directory
  76. track & the number of sectors/track are one-byte numbers.  (In fact, in order
  77. for the directory display to work, you'd better have no more sectors per
  78. track than columns on your screen!)  If this isn't true for your system, 
  79. I'd be glad to rewrite the relevant parts of the program.   Just DON'T 
  80. USE IT AS IS: if you've just lost your directory you have troubles enough.
  81.  
  82.                               *****
  83.  
  84. I have included the source code for these; please excuse the paucity of
  85. comments... as long as they work (?)
  86.  
  87.                         Eric Gans
  88.                         French Dep't
  89.                         UCLA
  90.                         Los Angeles, CA 90024
  91.