Home » CEEFAX disks » telesoftware16.adl » 03-06-89/Unerase\DO

03-06-89/Unerase\DO

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware16.adl
Filename: 03-06-89/Unerase\DO
Read OK:
File size: 0AA6 bytes
Load address: 0000
Exec address: FFFFFFFF
File contents
               UNERASE.DOC v1.1    20/6/86
Eric Gans
French Dep't UCLA
Los Angeles, CA 90024

Version 1.1
   Found a bug (thanks to Bill Cox) that couldn't find a file in the
root directory of a non-default disk.  Simplified the entry routine to
allow command line entry of the drive-path- filename.

   Since immigrating to MS-DOS, I have felt the absence of a public
domain undelete program that unlike UNDEL.COM will work on all kinds of
disks. UNERASE is meant to fill this gap.  (CP/M users can use my XRASE
program for this purpose.)

   UNERASE should work on any disk up to 20 megs, or 30 if it has fewer
than 12,800 blocks, which would be the case with a 4K block size.
(Since this is merely a question of buffer size, it would be easy to
change.) In case your deleted file is a text file, you have the option
of viewing the doubtful blocks (those after the first) before accepting
them back in the file.

Format: unerase [d:][\path\]filename
   If you just enter "unerase" you will be prompted.
   The current drive need not be entered, but you must enter the entire
path starting from the root. (You can write a:blrk instead of a:\blrk).

Notes:

   UNERASE gets its disk information from the boot sector of the disk.
It then reads the FAT into memory and finds the filename of the lost
file (its first byte has been replaced by E5 to show erasure) in the
appropriate directory, which is located on disk by following its path
from the root disk directory.  The first block of the file, if still
unused, is tentatively restored.  Since the length of the file has
remained in the directory entry, the program moves through the FAT
checking unused blocks.  If you use the verify option, these blocks will
be printed on screen for inspection (this only works for text since I
haven't implemented a hex dump for object files). If you haven't been
doing too much erasing on your disk and your lost file wasn't too
fragmented, UNERASE should do the job.

   Undeleting in DOS is less reliable than in CP/M since the FAT block
addresses (after the first, which is in the directory entry) are zeroed
out, whereas CP/M keeps them all in the file directory until the file's
entry is overwritten.

   I wonder what makes operating system writers so hard on accidental
deletions;  sophisticated MS-DOS is  even  more unforgiving than
primitive CP/M.  Why can't a reliable undelete utility be supplied with
the system (UNIX does this, doesn't it??), or at least made available to
programmers as a system call?  DOS could implement this easily enough,
for example by only zeroing out the deleted blocks in one copy of the
FAT (there are always two) until the next disk write.
00000000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 55  |               U|
00000010  4e 45 52 41 53 45 2e 44  4f 43 20 76 31 2e 31 20  |NERASE.DOC v1.1 |
00000020  20 20 20 32 30 2f 36 2f  38 36 0d 0a 45 72 69 63  |   20/6/86..Eric|
00000030  20 47 61 6e 73 0d 0a 46  72 65 6e 63 68 20 44 65  | Gans..French De|
00000040  70 27 74 20 55 43 4c 41  0d 0a 4c 6f 73 20 41 6e  |p't UCLA..Los An|
00000050  67 65 6c 65 73 2c 20 43  41 20 39 30 30 32 34 0d  |geles, CA 90024.|
00000060  0a 0d 0a 56 65 72 73 69  6f 6e 20 31 2e 31 0d 0a  |...Version 1.1..|
00000070  20 20 20 46 6f 75 6e 64  20 61 20 62 75 67 20 28  |   Found a bug (|
00000080  74 68 61 6e 6b 73 20 74  6f 20 42 69 6c 6c 20 43  |thanks to Bill C|
00000090  6f 78 29 20 74 68 61 74  20 63 6f 75 6c 64 6e 27  |ox) that couldn'|
000000a0  74 20 66 69 6e 64 20 61  20 66 69 6c 65 20 69 6e  |t find a file in|
000000b0  20 74 68 65 0d 0a 72 6f  6f 74 20 64 69 72 65 63  | the..root direc|
000000c0  74 6f 72 79 20 6f 66 20  61 20 6e 6f 6e 2d 64 65  |tory of a non-de|
000000d0  66 61 75 6c 74 20 64 69  73 6b 2e 20 20 53 69 6d  |fault disk.  Sim|
000000e0  70 6c 69 66 69 65 64 20  74 68 65 20 65 6e 74 72  |plified the entr|
000000f0  79 20 72 6f 75 74 69 6e  65 20 74 6f 0d 0a 61 6c  |y routine to..al|
00000100  6c 6f 77 20 63 6f 6d 6d  61 6e 64 20 6c 69 6e 65  |low command line|
00000110  20 65 6e 74 72 79 20 6f  66 20 74 68 65 20 64 72  | entry of the dr|
00000120  69 76 65 2d 70 61 74 68  2d 20 66 69 6c 65 6e 61  |ive-path- filena|
00000130  6d 65 2e 0d 0a 0d 0a 20  20 20 53 69 6e 63 65 20  |me.....   Since |
00000140  69 6d 6d 69 67 72 61 74  69 6e 67 20 74 6f 20 4d  |immigrating to M|
00000150  53 2d 44 4f 53 2c 20 49  20 68 61 76 65 20 66 65  |S-DOS, I have fe|
00000160  6c 74 20 74 68 65 20 61  62 73 65 6e 63 65 20 6f  |lt the absence o|
00000170  66 20 61 20 70 75 62 6c  69 63 0d 0a 64 6f 6d 61  |f a public..doma|
00000180  69 6e 20 75 6e 64 65 6c  65 74 65 20 70 72 6f 67  |in undelete prog|
00000190  72 61 6d 20 74 68 61 74  20 75 6e 6c 69 6b 65 20  |ram that unlike |
000001a0  55 4e 44 45 4c 2e 43 4f  4d 20 77 69 6c 6c 20 77  |UNDEL.COM will w|
000001b0  6f 72 6b 20 6f 6e 20 61  6c 6c 20 6b 69 6e 64 73  |ork on all kinds|
000001c0  20 6f 66 0d 0a 64 69 73  6b 73 2e 20 55 4e 45 52  | of..disks. UNER|
000001d0  41 53 45 20 69 73 20 6d  65 61 6e 74 20 74 6f 20  |ASE is meant to |
000001e0  66 69 6c 6c 20 74 68 69  73 20 67 61 70 2e 20 20  |fill this gap.  |
000001f0  28 43 50 2f 4d 20 75 73  65 72 73 20 63 61 6e 20  |(CP/M users can |
00000200  75 73 65 20 6d 79 20 58  52 41 53 45 0d 0a 70 72  |use my XRASE..pr|
00000210  6f 67 72 61 6d 20 66 6f  72 20 74 68 69 73 20 70  |ogram for this p|
00000220  75 72 70 6f 73 65 2e 29  0d 0a 0d 0a 20 20 20 55  |urpose.)....   U|
00000230  4e 45 52 41 53 45 20 73  68 6f 75 6c 64 20 77 6f  |NERASE should wo|
00000240  72 6b 20 6f 6e 20 61 6e  79 20 64 69 73 6b 20 75  |rk on any disk u|
00000250  70 20 74 6f 20 32 30 20  6d 65 67 73 2c 20 6f 72  |p to 20 megs, or|
00000260  20 33 30 20 69 66 20 69  74 20 68 61 73 20 66 65  | 30 if it has fe|
00000270  77 65 72 0d 0a 74 68 61  6e 20 31 32 2c 38 30 30  |wer..than 12,800|
00000280  20 62 6c 6f 63 6b 73 2c  20 77 68 69 63 68 20 77  | blocks, which w|
00000290  6f 75 6c 64 20 62 65 20  74 68 65 20 63 61 73 65  |ould be the case|
000002a0  20 77 69 74 68 20 61 20  34 4b 20 62 6c 6f 63 6b  | with a 4K block|
000002b0  20 73 69 7a 65 2e 0d 0a  28 53 69 6e 63 65 20 74  | size...(Since t|
000002c0  68 69 73 20 69 73 20 6d  65 72 65 6c 79 20 61 20  |his is merely a |
000002d0  71 75 65 73 74 69 6f 6e  20 6f 66 20 62 75 66 66  |question of buff|
000002e0  65 72 20 73 69 7a 65 2c  20 69 74 20 77 6f 75 6c  |er size, it woul|
000002f0  64 20 62 65 20 65 61 73  79 20 74 6f 0d 0a 63 68  |d be easy to..ch|
00000300  61 6e 67 65 2e 29 20 49  6e 20 63 61 73 65 20 79  |ange.) In case y|
00000310  6f 75 72 20 64 65 6c 65  74 65 64 20 66 69 6c 65  |our deleted file|
00000320  20 69 73 20 61 20 74 65  78 74 20 66 69 6c 65 2c  | is a text file,|
00000330  20 79 6f 75 20 68 61 76  65 20 74 68 65 20 6f 70  | you have the op|
00000340  74 69 6f 6e 0d 0a 6f 66  20 76 69 65 77 69 6e 67  |tion..of viewing|
00000350  20 74 68 65 20 64 6f 75  62 74 66 75 6c 20 62 6c  | the doubtful bl|
00000360  6f 63 6b 73 20 28 74 68  6f 73 65 20 61 66 74 65  |ocks (those afte|
00000370  72 20 74 68 65 20 66 69  72 73 74 29 20 62 65 66  |r the first) bef|
00000380  6f 72 65 20 61 63 63 65  70 74 69 6e 67 0d 0a 74  |ore accepting..t|
00000390  68 65 6d 20 62 61 63 6b  20 69 6e 20 74 68 65 20  |hem back in the |
000003a0  66 69 6c 65 2e 0d 0a 0d  0a 46 6f 72 6d 61 74 3a  |file.....Format:|
000003b0  20 75 6e 65 72 61 73 65  20 5b 64 3a 5d 5b 5c 70  | unerase [d:][\p|
000003c0  61 74 68 5c 5d 66 69 6c  65 6e 61 6d 65 0d 0a 20  |ath\]filename.. |
000003d0  20 20 49 66 20 79 6f 75  20 6a 75 73 74 20 65 6e  |  If you just en|
000003e0  74 65 72 20 22 75 6e 65  72 61 73 65 22 20 79 6f  |ter "unerase" yo|
000003f0  75 20 77 69 6c 6c 20 62  65 20 70 72 6f 6d 70 74  |u will be prompt|
00000400  65 64 2e 0d 0a 20 20 20  54 68 65 20 63 75 72 72  |ed...   The curr|
00000410  65 6e 74 20 64 72 69 76  65 20 6e 65 65 64 20 6e  |ent drive need n|
00000420  6f 74 20 62 65 20 65 6e  74 65 72 65 64 2c 20 62  |ot be entered, b|
00000430  75 74 20 79 6f 75 20 6d  75 73 74 20 65 6e 74 65  |ut you must ente|
00000440  72 20 74 68 65 20 65 6e  74 69 72 65 0d 0a 70 61  |r the entire..pa|
00000450  74 68 20 73 74 61 72 74  69 6e 67 20 66 72 6f 6d  |th starting from|
00000460  20 74 68 65 20 72 6f 6f  74 2e 20 28 59 6f 75 20  | the root. (You |
00000470  63 61 6e 20 77 72 69 74  65 20 61 3a 62 6c 72 6b  |can write a:blrk|
00000480  20 69 6e 73 74 65 61 64  20 6f 66 20 61 3a 5c 62  | instead of a:\b|
00000490  6c 72 6b 29 2e 0d 0a 0d  0a 4e 6f 74 65 73 3a 0d  |lrk).....Notes:.|
000004a0  0a 0d 0a 20 20 20 55 4e  45 52 41 53 45 20 67 65  |...   UNERASE ge|
000004b0  74 73 20 69 74 73 20 64  69 73 6b 20 69 6e 66 6f  |ts its disk info|
000004c0  72 6d 61 74 69 6f 6e 20  66 72 6f 6d 20 74 68 65  |rmation from the|
000004d0  20 62 6f 6f 74 20 73 65  63 74 6f 72 20 6f 66 20  | boot sector of |
000004e0  74 68 65 20 64 69 73 6b  2e 0d 0a 49 74 20 74 68  |the disk...It th|
000004f0  65 6e 20 72 65 61 64 73  20 74 68 65 20 46 41 54  |en reads the FAT|
00000500  20 69 6e 74 6f 20 6d 65  6d 6f 72 79 20 61 6e 64  | into memory and|
00000510  20 66 69 6e 64 73 20 74  68 65 20 66 69 6c 65 6e  | finds the filen|
00000520  61 6d 65 20 6f 66 20 74  68 65 20 6c 6f 73 74 0d  |ame of the lost.|
00000530  0a 66 69 6c 65 20 28 69  74 73 20 66 69 72 73 74  |.file (its first|
00000540  20 62 79 74 65 20 68 61  73 20 62 65 65 6e 20 72  | byte has been r|
00000550  65 70 6c 61 63 65 64 20  62 79 20 45 35 20 74 6f  |eplaced by E5 to|
00000560  20 73 68 6f 77 20 65 72  61 73 75 72 65 29 20 69  | show erasure) i|
00000570  6e 20 74 68 65 0d 0a 61  70 70 72 6f 70 72 69 61  |n the..appropria|
00000580  74 65 20 64 69 72 65 63  74 6f 72 79 2c 20 77 68  |te directory, wh|
00000590  69 63 68 20 69 73 20 6c  6f 63 61 74 65 64 20 6f  |ich is located o|
000005a0  6e 20 64 69 73 6b 20 62  79 20 66 6f 6c 6c 6f 77  |n disk by follow|
000005b0  69 6e 67 20 69 74 73 20  70 61 74 68 0d 0a 66 72  |ing its path..fr|
000005c0  6f 6d 20 74 68 65 20 72  6f 6f 74 20 64 69 73 6b  |om the root disk|
000005d0  20 64 69 72 65 63 74 6f  72 79 2e 20 20 54 68 65  | directory.  The|
000005e0  20 66 69 72 73 74 20 62  6c 6f 63 6b 20 6f 66 20  | first block of |
000005f0  74 68 65 20 66 69 6c 65  2c 20 69 66 20 73 74 69  |the file, if sti|
00000600  6c 6c 0d 0a 75 6e 75 73  65 64 2c 20 69 73 20 74  |ll..unused, is t|
00000610  65 6e 74 61 74 69 76 65  6c 79 20 72 65 73 74 6f  |entatively resto|
00000620  72 65 64 2e 20 20 53 69  6e 63 65 20 74 68 65 20  |red.  Since the |
00000630  6c 65 6e 67 74 68 20 6f  66 20 74 68 65 20 66 69  |length of the fi|
00000640  6c 65 20 68 61 73 0d 0a  72 65 6d 61 69 6e 65 64  |le has..remained|
00000650  20 69 6e 20 74 68 65 20  64 69 72 65 63 74 6f 72  | in the director|
00000660  79 20 65 6e 74 72 79 2c  20 74 68 65 20 70 72 6f  |y entry, the pro|
00000670  67 72 61 6d 20 6d 6f 76  65 73 20 74 68 72 6f 75  |gram moves throu|
00000680  67 68 20 74 68 65 20 46  41 54 0d 0a 63 68 65 63  |gh the FAT..chec|
00000690  6b 69 6e 67 20 75 6e 75  73 65 64 20 62 6c 6f 63  |king unused bloc|
000006a0  6b 73 2e 20 20 49 66 20  79 6f 75 20 75 73 65 20  |ks.  If you use |
000006b0  74 68 65 20 76 65 72 69  66 79 20 6f 70 74 69 6f  |the verify optio|
000006c0  6e 2c 20 74 68 65 73 65  20 62 6c 6f 63 6b 73 20  |n, these blocks |
000006d0  77 69 6c 6c 0d 0a 62 65  20 70 72 69 6e 74 65 64  |will..be printed|
000006e0  20 6f 6e 20 73 63 72 65  65 6e 20 66 6f 72 20 69  | on screen for i|
000006f0  6e 73 70 65 63 74 69 6f  6e 20 28 74 68 69 73 20  |nspection (this |
00000700  6f 6e 6c 79 20 77 6f 72  6b 73 20 66 6f 72 20 74  |only works for t|
00000710  65 78 74 20 73 69 6e 63  65 20 49 0d 0a 68 61 76  |ext since I..hav|
00000720  65 6e 27 74 20 69 6d 70  6c 65 6d 65 6e 74 65 64  |en't implemented|
00000730  20 61 20 68 65 78 20 64  75 6d 70 20 66 6f 72 20  | a hex dump for |
00000740  6f 62 6a 65 63 74 20 66  69 6c 65 73 29 2e 20 49  |object files). I|
00000750  66 20 79 6f 75 20 68 61  76 65 6e 27 74 20 62 65  |f you haven't be|
00000760  65 6e 0d 0a 64 6f 69 6e  67 20 74 6f 6f 20 6d 75  |en..doing too mu|
00000770  63 68 20 65 72 61 73 69  6e 67 20 6f 6e 20 79 6f  |ch erasing on yo|
00000780  75 72 20 64 69 73 6b 20  61 6e 64 20 79 6f 75 72  |ur disk and your|
00000790  20 6c 6f 73 74 20 66 69  6c 65 20 77 61 73 6e 27  | lost file wasn'|
000007a0  74 20 74 6f 6f 0d 0a 66  72 61 67 6d 65 6e 74 65  |t too..fragmente|
000007b0  64 2c 20 55 4e 45 52 41  53 45 20 73 68 6f 75 6c  |d, UNERASE shoul|
000007c0  64 20 64 6f 20 74 68 65  20 6a 6f 62 2e 0d 0a 0d  |d do the job....|
000007d0  0a 20 20 20 55 6e 64 65  6c 65 74 69 6e 67 20 69  |.   Undeleting i|
000007e0  6e 20 44 4f 53 20 69 73  20 6c 65 73 73 20 72 65  |n DOS is less re|
000007f0  6c 69 61 62 6c 65 20 74  68 61 6e 20 69 6e 20 43  |liable than in C|
00000800  50 2f 4d 20 73 69 6e 63  65 20 74 68 65 20 46 41  |P/M since the FA|
00000810  54 20 62 6c 6f 63 6b 0d  0a 61 64 64 72 65 73 73  |T block..address|
00000820  65 73 20 28 61 66 74 65  72 20 74 68 65 20 66 69  |es (after the fi|
00000830  72 73 74 2c 20 77 68 69  63 68 20 69 73 20 69 6e  |rst, which is in|
00000840  20 74 68 65 20 64 69 72  65 63 74 6f 72 79 20 65  | the directory e|
00000850  6e 74 72 79 29 20 61 72  65 20 7a 65 72 6f 65 64  |ntry) are zeroed|
00000860  0d 0a 6f 75 74 2c 20 77  68 65 72 65 61 73 20 43  |..out, whereas C|
00000870  50 2f 4d 20 6b 65 65 70  73 20 74 68 65 6d 20 61  |P/M keeps them a|
00000880  6c 6c 20 69 6e 20 74 68  65 20 66 69 6c 65 20 64  |ll in the file d|
00000890  69 72 65 63 74 6f 72 79  20 75 6e 74 69 6c 20 74  |irectory until t|
000008a0  68 65 20 66 69 6c 65 27  73 0d 0a 65 6e 74 72 79  |he file's..entry|
000008b0  20 69 73 20 6f 76 65 72  77 72 69 74 74 65 6e 2e  | is overwritten.|
000008c0  0d 0a 0d 0a 20 20 20 49  20 77 6f 6e 64 65 72 20  |....   I wonder |
000008d0  77 68 61 74 20 6d 61 6b  65 73 20 6f 70 65 72 61  |what makes opera|
000008e0  74 69 6e 67 20 73 79 73  74 65 6d 20 77 72 69 74  |ting system writ|
000008f0  65 72 73 20 73 6f 20 68  61 72 64 20 6f 6e 20 61  |ers so hard on a|
00000900  63 63 69 64 65 6e 74 61  6c 0d 0a 64 65 6c 65 74  |ccidental..delet|
00000910  69 6f 6e 73 3b 20 20 73  6f 70 68 69 73 74 69 63  |ions;  sophistic|
00000920  61 74 65 64 20 4d 53 2d  44 4f 53 20 69 73 20 20  |ated MS-DOS is  |
00000930  65 76 65 6e 20 20 6d 6f  72 65 20 75 6e 66 6f 72  |even  more unfor|
00000940  67 69 76 69 6e 67 20 74  68 61 6e 0d 0a 70 72 69  |giving than..pri|
00000950  6d 69 74 69 76 65 20 43  50 2f 4d 2e 20 20 57 68  |mitive CP/M.  Wh|
00000960  79 20 63 61 6e 27 74 20  61 20 72 65 6c 69 61 62  |y can't a reliab|
00000970  6c 65 20 75 6e 64 65 6c  65 74 65 20 75 74 69 6c  |le undelete util|
00000980  69 74 79 20 62 65 20 73  75 70 70 6c 69 65 64 20  |ity be supplied |
00000990  77 69 74 68 0d 0a 74 68  65 20 73 79 73 74 65 6d  |with..the system|
000009a0  20 28 55 4e 49 58 20 64  6f 65 73 20 74 68 69 73  | (UNIX does this|
000009b0  2c 20 64 6f 65 73 6e 27  74 20 69 74 3f 3f 29 2c  |, doesn't it??),|
000009c0  20 6f 72 20 61 74 20 6c  65 61 73 74 20 6d 61 64  | or at least mad|
000009d0  65 20 61 76 61 69 6c 61  62 6c 65 20 74 6f 0d 0a  |e available to..|
000009e0  70 72 6f 67 72 61 6d 6d  65 72 73 20 61 73 20 61  |programmers as a|
000009f0  20 73 79 73 74 65 6d 20  63 61 6c 6c 3f 20 20 44  | system call?  D|
00000a00  4f 53 20 63 6f 75 6c 64  20 69 6d 70 6c 65 6d 65  |OS could impleme|
00000a10  6e 74 20 74 68 69 73 20  65 61 73 69 6c 79 20 65  |nt this easily e|
00000a20  6e 6f 75 67 68 2c 0d 0a  66 6f 72 20 65 78 61 6d  |nough,..for exam|
00000a30  70 6c 65 20 62 79 20 6f  6e 6c 79 20 7a 65 72 6f  |ple by only zero|
00000a40  69 6e 67 20 6f 75 74 20  74 68 65 20 64 65 6c 65  |ing out the dele|
00000a50  74 65 64 20 62 6c 6f 63  6b 73 20 69 6e 20 6f 6e  |ted blocks in on|
00000a60  65 20 63 6f 70 79 20 6f  66 20 74 68 65 0d 0a 46  |e copy of the..F|
00000a70  41 54 20 28 74 68 65 72  65 20 61 72 65 20 61 6c  |AT (there are al|
00000a80  77 61 79 73 20 74 77 6f  29 20 75 6e 74 69 6c 20  |ways two) until |
00000a90  74 68 65 20 6e 65 78 74  20 64 69 73 6b 20 77 72  |the next disk wr|
00000aa0  69 74 65 2e 0d 0a                                 |ite...|
00000aa6
03-06-89/Unerase\DO.m0
03-06-89/Unerase\DO.m1
03-06-89/Unerase\DO.m2
03-06-89/Unerase\DO.m4
03-06-89/Unerase\DO.m5