;;xxxxxxxx DIRREP.DOC v.2.1 04/16/85 DBACK.COM v.2.1 DREST.COM v.2.1 Update: Now allows you to set maximum drive for your system; allows 2-byte number of tracks before directory. The files in this library, DBACK.COM and DREST.COM make up a repair kit for disk directories. I don't know if it has happened to you (yet), but fooling around with assembly language and related subjects has led more than once to my spoiling my disk directory. If you have only floppies to worry about, it's not so bad, but a 10MB disk holds a lot of files!! The first time this happened I was a rank beginner without a proper set of utilities or even a real knowledge of what a CPM file directory looked like; the only solution I could find was to reformat the entire hard disk! That may be a little better than buying a new disk drive, but hardly ideal. The last time (I won't say how this happened), I was an experienced CPM programmer. I knew that the garbage that appeared when I typed DIR came from a misdirected write that had put an allocation block into the directory (=block #0) instead of elsewhere. This time I made use of my trusty RDWRT utility (now SRW) to enter an E5 at the beginning of each spoiled entry to simulate erasure. This cleaned up my directory just fine, and it was a few notches more satisfactory than formatting the disk, but one sad fact remained: the files were gone. On my hard disk, an allocation block is 4K, or 32 128-byte sectors. At 4 files/sector, I had lost 128 files. Without their addresses in the directory, there was no way of locating them short of stepping through the entire disk block by block. The purpose of this little library is to avoid such experiences in the future by copying the disk directory into a file that can be stored on a separate disk and restored if need be to its original place. DBACK [X]>Y will create a file called DIRFL.DRX on drive Y containing the entire disk directory for drive X (omit if current drive). DREST [d] will test the disk directory of drive d for "bad sectors," not the BDOS variety, but sectors that don't contain what a directory should. It then asks you if you want to restore the directory from the file you had previously made with DBACK (which can be on a different drive). To be on the safe side, you might answer N the first time and take a look at your directory tracks with a disk utility like SRW. If you type 'Y', your directory will be restored from the file. Simple, no? Since loss of a directory puts programmers in a state of panic, I have made the program very simple; it doesn't let you screw up by putting the wrong part of the file at the wrong place, but restores the whole thing. The only thing to watch out for is that the DIRFL file is identified only by the drive letter: DIRFL.DRA contains the directory for drive A, etc. This means that if you have a floppy disk system you have to remember which disk was in which drive. The way to use this program is to back up your directory just before you engage in a dangerous programming task. But in answer to those who will claim that you can't know in advance when the tragedy will occur, I answer that a partially restored directory is better than no directory at all. If you have written to the disk since the backup, you'll just lose some recent material. But even if you have erased a file and its blocks have been reallocated, you can always erase it again. You'll still be saving all the files that remained unchanged since your backup. For a hard disk, that can be quite a few. Technical notes: -- The directory test divides sectors into G=good, B=bad and E=erased. Since the program tests each sector twice, it returns an E for directory sectors half full or less (<=2 entries). I have left this in since it doesn't seem worthwhile creating a new category; what you're really interested in are the sectors marked 'B'! -- These programs come configured for a three-drive system. If you have more than a,b,c, change the byte at 102H from 3 to the number of drives on your system. -- Another supposition is that the number of sectors/track is a one-byte number. (In fact, in order for the directory display to work, you'd better have no more sectors per track than columns on your screen!) If this isn't true for your system, I'd be glad to rewrite the relevant parts of the program. Just DON'T USE IT AS IS: if you've just lost your directory you have troubles enough. -- Since it is now easy to change the maximum drive number, I have not included the source code in this version of the library Eric Gans French Dep't UCLA Los Angeles, CA 90024