home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / A / EDIR.ZIP / EDIR.DOC < prev    next >
Text File  |  1990-11-24  |  35KB  |  720 lines

  1.  
  2.               EDIR V1.0 FOR CP/M 2.2 COMPUTERS
  3.  
  4.         FILE UNERASER AND ERASED DIRECTORY ACCESSER 
  5.  
  6.     INCLUDING ASSORTED FILE RECOVERY PALS AND TECHNIQUES
  7.  
  8.                        As of 12/14/87
  9.  
  10.              Copyright 1987 by Robert Greenlee 
  11.  
  12.                        P.O. Box 23286
  13.                 San Diego, California 92123 
  14.               Telephone: (619) 268-0112 Voice
  15.               Telephone: (619) 569-8613 Modem
  16.  
  17.               ** Frequented Bulletin Boards **
  18.                    SABALINE: 619-692-1961 
  19.                    ZNODE #9: 619-270-3148 
  20.  
  21. Please tell me what kind of CP/M or MSDOS computer/printer you have so that I 
  22. can add your name to my mailing list. 
  23.  
  24.                     ====================
  25.  
  26. Version 1.0 downloaded 12/14/87 for BBS Distribution.  Next version to include 
  27. EDIR machine code routines for Turbo Pascal, dBASE, and BASIC.  
  28.  
  29.                     ====================
  30.  
  31.                    EDIR LIBRARY CONTENTS
  32.  
  33. This EDIR software library should contain at least the 
  34. following files:
  35.  
  36. EDIR.ASM.......Source.
  37. EDIR.DOC.......What you're reading now.
  38. EDIR.COM.......Erased directory accessing program.  Unerases 
  39.                files and more.
  40. NO-WRITE.ASM...Source.
  41. NO-WRITE.COM...Lost file recovery aid.  Allows saving data 
  42.                contained in the free space of a disk into 
  43.                files.  A useful worm but be careful!
  44. NO-STOP.ASM....Source.
  45. NO-STOP.COM....Stops CP/M from waiting for a keypress after 
  46.                every "Bdos Err On B: Bad Sector" message.
  47. NO-ERRS.ASM....Source.
  48. NO-ERRS.COM....Stops CP/M (BIOS READ) from detecting bad 
  49.                sectors.  Useful to enable some COPY programs 
  50.                to copy disks containing bad sectors so that 
  51.                file recovery can be attempted with the copy.
  52.                (Probably won't work with Kaypro COPY.COM).
  53.  
  54. If you're missing any of the programs then you should still be able to create 
  55. stripped down but working versions by using DDT as shown below.  The stripped 
  56. down versions don't have sign-on messages. 
  57.  
  58.                     ====================
  59.  
  60.                      TABLE OF CONTENTS
  61.  
  62.          1. The EDIR Philosophy and How to Use EDIR.
  63.          2. Unerasing Pitfalls - Duplicate Filenames. 
  64.          3. User Areas - Do you even use them?
  65.          4. PIP Tip (Just PIPed over a precious file?) 
  66.          5. EDIR System Requirements. 
  67.          6. Creating EDIR.COM with DDT.COM.
  68.          7. About unerasing with ERA *.* under EDIR 
  69.          8. First-Aid for Corrupted Files.
  70.         9a. Recovering Lost Files using NO-WRITE (lost files 
  71.             are files which are no longer even listed in the 
  72.             erased file directory).
  73.         9b. Recovering Lost Files - One Final Tip.
  74.         10. Determining the file sizes of any
  75.             erased files before unerasing them.
  76.         11. Getting Around BDOS Bad Sectors (Using NO-STOP).
  77.         12. Getting Around BIOS Bad Sectors (Using NO-ERRS).
  78.         13. Original Intent - Unerasing by Telephone.
  79.  
  80.                     ====================
  81.  
  82.           THE EDIR PHILOSOPHY AND HOW TO USE EDIR
  83.  
  84. Physically CP/M 2.2 has just one file directory per disk.  But CP/M can divide 
  85. its one physical directory into many logical file directories.  CP/M lets you 
  86. easily switch between the many logical file directories with its USERn 
  87. command.  The USERn command can switch between 16 logical file directories 
  88. which are called User Areas 0 through 15.  For example to log into User Area 6 
  89. you would use the CP/M command:  A>USER 6 <cr>.  
  90.  
  91. When CP/M first erases a file it only changes one byte of data in the physical 
  92. file directory.  At first glance the change CP/M makes to a file in order to 
  93. erase it just puts the file into User Area #227.  But actually erased files go 
  94. into a logical erased file directory. 
  95.  
  96. This logical erased file directory coexists with the currently active user 
  97. area.  It coexists because whenever a disk write operation is made any 
  98. directory entries and disk data space required by the write operation are 
  99. first taken out of the logical erased file directory before any virgin 
  100. directory entries or disk space is consumed.  So once a file is placed into 
  101. the erased file directory CP/M no longer protects that files data or directory 
  102. entries from being reused by subsequent disk write operations.  
  103.  
  104. To access the forbidden erased file directory, the place where all erased 
  105. files go and where they start to fade away, I've come up with a small program 
  106. called EDIR, which is short for Erased DIRectory.  What EDIR does is to trick 
  107. CP/M into actually entering into the erased file directory. Running EDIR, like 
  108. so: 
  109.  
  110.      A>EDIR <cr>
  111.  
  112. takes you into the erased file directory just as you might change from one 
  113. drive to another drive or from one user area to another user area.  Once 
  114. inside the erased file directory you can use CP/M's DIR, REN, TYPE, and ERA 
  115. commands to manipulate the erased files therein.  
  116.  
  117. The ERA command will unERAse files back into the currently selected user area.  
  118. The REN command is handy for renaming any duplicate files before unerasing 
  119. them.  (Try not to unerase a file into a user area which already contains a 
  120. file of the same name.)  
  121.  
  122. Since the erased file directory is a real directory you can run the programs 
  123. in it.  Doing so isn't recommended because many programs just won't work right 
  124. when run from there.  However certain programs like STAT and PIP can be of use 
  125. when run from the erased file directory.  An example of using PIP from there 
  126. is presented below in the section ABOUT ERASING WITH ERA *.*.  An example 
  127. using STAT is presented below in the section DETERMINING THE FILE SIZES OF 
  128. ERASED FILES. 
  129.  
  130. On most computers EDIR can maintain its influence over CP/M only until the 
  131. next Warm Boot.  So typing Control-C usually gets CP/M back to normal again 
  132. and takes you out of the erased file directory.  Some computers may require a 
  133. cold boot or system reset to override EDIR and exit from the erased file 
  134. directory.  
  135.  
  136. The files in the erased file directory of a disk are very fragile and can be 
  137. disturbed anytime data is written onto the disk.  The disturbance caused to 
  138. the erased file directory can range from the permanent loss of the names of 
  139. files in that directory and/or the overwriting of file data belonging to one 
  140. or more files in that directory (the latter is almost a certainty). 
  141.  
  142. Only immediately after erasing a file is it a sure thing that you'll be able 
  143. to find that file in the erased file directory and be sure of the integrity of 
  144. the unerased file.  But if after erasing a file you use a program which writes 
  145. to the disk then you may not even find the name of the file you erased in the 
  146. erased file directory and even if the name of the erased file is listed in the 
  147. directory the file might not be totally intact when unerased. 
  148.  
  149. The CP/M DIRectory command under EDIR will only show the names of erased files 
  150. which can probably be completely unerased.  So if an erased file has had one 
  151. or more of its directory entries reclaimed by a subsequent disk write 
  152. operation then the DIR command would no longer display that files name.  
  153. However if some of a files directory entries are still left in the directory 
  154. and you suspect that's so, then the ERA command could still be used to unerase 
  155. the remaining directory entries, just as would be the case when using 
  156. UNERA.COM or MAKE.COM. 
  157.  
  158. However there's a problem with unerasing incomplete files (files not shown by 
  159. DIR under EDIR which are missing at least one of their directory entries - 
  160. which usually means at the very least their first directory entry).  When you 
  161. do so by using ERA under EDIR with a file name not shown by DIR under EDIR (or 
  162. with programs like UNERA, UNERA+ and MAKE) you end up with a file that's an 
  163. abomination to CP/M.  CP/M won't show the recovered file using DIR, you can't 
  164. TYPE it, you can't PIP it, DISK.COM can't see it, SWEEP.COM can't open it, but 
  165. the file will show up in the directory listing displayed by the typical D.COM 
  166. sorted directory program.  Yuck. 
  167.  
  168. Now there are solutions to the abominable file problem but I haven't had time 
  169. to think up something simple yet (if you don't need simple then use DU).  So 
  170. what I suggest you do for now is to use the procedure presented in RECOVERING 
  171. LOST FILES and don't bother with trying to first recover an incomplete piece 
  172. of a file.  If it doesn't show up using DIR under EDIR then it's a LOST FILE 
  173. so use the procedure outlined in RECOVERING LOST FILES below. 
  174.  
  175.                     ====================
  176.  
  177.                           PITFALLS
  178.  
  179. There are two closely related pitfalls to avoid when unerasing files in the 
  180. erased file directory.  First you should know that in the erased file 
  181. directory more than one file can have the same name.  Second you shouldn't 
  182. unerase a file which has a name already being used by an unerased file.  This 
  183. is the first obstacle which most UNERA programs can't jump over.  You see most 
  184. UNERA programs will unerase all files having the same filename leaving you 
  185. with duplicate filenames in the disk directory. 
  186.  
  187. So before unerasing files which have the same name you should use the rename 
  188. command REN to give them different filenames.  If you do wind up with 
  189. duplicate filenames in the unerased file directory one solution would be to 
  190. erase the duplicates and rename them in the erased file directory before 
  191. unerasing them again. 
  192.  
  193. The problem with having duplicate filenames in the unerased file directory is 
  194. that you only have access to one of the duplicate files.  Unfortunately the 
  195. REName and ERAse commands effect all files having the same name in the 
  196. unerased file directory.  But fortunately when you're logged into the erased 
  197. file directory the REName and ERAse commands only effect the first of the 
  198. duplicate files so that you can rename files which have the same filenames 
  199. before unerasing them. 
  200.  
  201. Another more subtle mind trap awaiting you concerns the many directory 
  202. programs called D.COM, SD.COM, etc.  Most of these programs tell you how many 
  203. files there are on a disk and how many empty directory entries remain.  When 
  204. getting ready to unerase some files don't outsmart yourself by trying to 
  205. calculate the number of files and empty directory entries which SHOULD exist 
  206. once the files have been unerased.  
  207.  
  208. Such calculations often comes out wrong.  The number of empty directory 
  209. entries is different from the number of files the disk will hold.  That's 
  210. because a large file can take up more than one directory entry.  So more than 
  211. one directory entry might be consumed by you're unerasing a single file.  
  212. Anyway it's hard to see any benefit in calculating how many empty directory 
  213. entries you should end up with.  Why bother? 
  214.  
  215.                     ====================
  216.  
  217.                USER AREAS - DO YOU USE THEM?
  218.  
  219. Most hard disk users take advantage of CP/M's ability to place files into 
  220. different user areas on the hard disk.  Because erased files don't belong to 
  221. any of the valid CP/M user areas the erased file directory doesn't change when 
  222. you switch user areas.  However whenever you unerase a file it goes into the 
  223. currently logged user area.  
  224.  
  225.                     ====================
  226.  
  227.                           PIP TIP
  228.  
  229. It can be useful to know that when PIP.COM (and many other programs and 
  230. utilities) copies a file onto a disk it first copies to a temporary file and 
  231. only when and if the copy is entirely successful is any file having the same 
  232. name erased and the temporary file renamed.  What that means is that if you 
  233. mistakenly copy over a good file using PIP you can recover that good file if 
  234. you don't copy anything else onto the disk prior to recovering it. 
  235.  
  236.                     ====================
  237.  
  238.                   EDIR SYSTEM REQUIREMENTS
  239.  
  240. EDIR only works under genuine CP/M 2.2 Basic Disk Operating System (the BDOS).  
  241. If you've replaced the CP/M 2.2 Console Command Processor (the CCP) with ZCPR 
  242. that's ok as long as you haven't also replaced the BDOS part of CP/M.  EDIR 
  243. won't work with ZRDOS.  EDIR runs with 8080, 8085, and Z80 CPU's. 
  244.  
  245. EDIR works by changing a few locations in the BDOS of CP/M and then returns 
  246. control back to the CCP part of CP/M.  At that point you're logged into the 
  247. fragile erased file directory, a directory which is both imaginary and real, a 
  248. directory which could only exist in the outermost reaches of The Twilight 
  249. Zone.  
  250.  
  251.                     ====================
  252.  
  253.              CREATING EDIR.COM WITH DDT.COM
  254.  
  255. Here's how to use DDT to create a working version of EDIR 
  256. and save it to disk as a program named EDIR.COM.
  257.  
  258. A>DDT
  259. DDT VERS 2.2
  260. -F100,200,1A
  261. -S100
  262. 0100 1A 2A     ,---> 011F 1A 32     ,---> 013E 1A 41                          
  263. 0101 1A 01     |     0120 1A 3F     |     013F 1A 00               
  264. 0102 1A 00     |     0121 1A 01     |     0140 1A 32               
  265. 0103 1A 25     |     0122 1A 2E     |     0141 1A AF        
  266. 0104 1A 25     |     0123 1A 59     |     0142 1A 00        
  267. 0105 1A 2E     |     0124 1A 11     |     0143 1A 3E        
  268. 0106 1A 7F     |     0125 1A 3B     |     0144 1A C8        
  269. 0107 1A 3E     |     0126 1A 01     |     0145 1A 01        
  270. 0108 1A 22     |     0127 1A 06     |     0146 1A 3E        
  271. 0109 1A BE     |     0128 1A 11     |     0147 1A C9        
  272. 010A 1A C2     |     0129 1A CD     |     0148 1A 32        
  273. 010B 1A 00     |     012A 1A 32     |     0149 1A 2A        
  274. 010C 1A 00     |     012B 1A 01     |     014A 1A 00        
  275. 010D 1A 7C     |     012C 1A F1     |     014B 1A C9        
  276. 010E 1A 32     |     012D 1A 67     |     014C 1A 0F        
  277. 010F 1A 56     |     012E 1A 2E     |     014D 1A 00        
  278. 0110 1A 01     |     012F 1A 48     |     014E 1A 19        
  279. 0111 1A D6     |     0130 1A 06     |     014F 1A 7E        
  280. 0112 1A 04     |     0131 1A 0D     |     0150 1A 3D        
  281. 0113 1A 32     |     0132 1A 1A     |     0151 1A E8        
  282. 0114 1A 4A     |     0133 1A 77     |     0152 1A FE        
  283. 0115 1A 01     |     0134 1A 13     |     0153 1A E4        
  284. 0116 1A 3D     |     0135 1A 23     |     0154 1A C2        
  285. 0117 1A 32     |     0136 1A 05     |     0155 1A 64        
  286. 0118 1A 42     |     0137 1A C2     |     0156 1A 00        
  287. 0119 1A 01     |     0138 1A 32     |     0157 1A F1        
  288. 011A 1A D6     |     0139 1A 01     |     0158 1A C9        
  289. 011B 1A 02     |     013A 1A C9     |     0159 1A .         
  290. 011C 1A F5     |     013B 1A 36     |     -^C            
  291. 011D 1A D6     |     013C 1A E5     |     A>SAVE 1 EDIR.COM 
  292. 011E 1A 02 >---'     013D 1A 3A >---'                     
  293.  
  294. At this point the file EDIR.COM should now exist in your 
  295. disk directory.  Here's how the EDIR programs code should 
  296. look when displayed by DDT:
  297.  
  298. A>DDT EDIR.COM
  299. DDT VERS 2.2
  300. NEXT  PC
  301. 0200 0100
  302. -D100,15F
  303.  
  304. 0100 2A 01 00 25 25 2E 7F 3E 22 BE C2 00 00 7C 32 56
  305. 0110 01 D6 04 32 4A 01 3D 32 42 01 D6 02 F5 D6 02 32
  306. 0120 3F 01 2E 59 11 3B 01 06 11 CD 32 01 F1 67 2E 48
  307. 0130 06 0D 1A 77 13 23 05 C2 32 01 C9 36 E5 3A 41 00
  308. 0140 32 AF 00 3E C8 01 3E C9 32 2A 00 C9 0F 00 19 7E
  309. 0150 3D E8 FE E4 C2 64 00 F1 C9 1A 1A 1A 1A 1A 1A 1A
  310.  
  311.                     ====================
  312.  
  313.                 ABOUT UNERASING WITH ERA *.*
  314.  
  315. For me there is only really scary thing to do with EDIR and that is to unerase 
  316. all the files at once by using ERA *.*.  That's when EDIR performs its 
  317. toughest trick which is to stop unerasing when it reaches the point in the 
  318. directory where no file has gone before.  
  319.  
  320. For you technical users the way EDIR makes the BDOS detect that point is by 
  321. checking to see if the sixteenth position in the file control block is the 
  322. byte value E5h.  That works only because most computers initialize the data in 
  323. the disk directory to the value E5h when formatting a disk.  Most computers 
  324. do. 
  325.  
  326. But a few computers do not write the value E5h into every location of the disk 
  327. directory when formatting a new disk, and so using ERA *.* to unerase all the 
  328. files on such disks would even turn directory entries which had never before 
  329. been used into unerased files.  That of course would leave you fresh out of 
  330. directory space.  
  331.  
  332. Here's what I do when there are both many unerased files on a disk and many 
  333. erased files are going to be unerased.  First I use EDIR to rename any 
  334. duplicates among the erased files and then I put a write protect sticker on 
  335. that disk.  Then I prepare an empty disk onto which I then transfer the erased 
  336. files using PIP.COM before unerasing them. 
  337.  
  338. To use PIP.COM to copy the erased files I place EDIR.COM and PIP.COM onto an 
  339. otherwise blank disk, erase PIP.COM, run EDIR.COM, and then with the disk 
  340. containing the erased files in drive B I run the erased PIP.COM program on the 
  341. A drive to transfer all the erased files from drive B onto the empty disk in 
  342. drive A like so: 
  343.  
  344.      A>PIP A:=B:*.*[OV] 
  345.  
  346. The files which PIP copies end up still being erased files on the disk in the 
  347. A drive.  Then I take the original disk out of drive B and put it aside.  
  348. Next, still logged onto drive A, I run EDIR again (because PIP caused a Warm 
  349. Boot when it finished copying which on my computer kicks EDIR out) and use ERA 
  350. *.* to unerase the files on drive A.  At that time I can use ERA *.* with more 
  351. confidence since I don't have to worry about conflicts with already existing 
  352. unerased files (because there are none) and besides the original disk will 
  353. still be intact should something go wrong with the ERA *.* operation.   
  354.  
  355. Another potential problem that might come up when using ambiguous file names 
  356. is that files which are missing directory entries might get unerased.  Such 
  357. files would not be displayed by DIR under EDIR and once unerased they are 
  358. untouchable. 
  359.  
  360.                     ====================
  361.  
  362.                FIRST-AID FOR CORRUPTED FILES 
  363.  
  364.       MODIFYING PIP.COM TO FILTER THE END-OF-FILE CODE
  365.  
  366. In certain instances the well equipped file uneraser (you and me) needs to 
  367. have a program which can filter the CP/M End-of-File marker Control-Z out of 
  368. an unerased file.  Here's one scenario of when you might need it: 
  369.  
  370.      You have a very large text file which you've 
  371.      accidentally erased.  After you erased the file 
  372.      you copied a small file (or files) onto the same 
  373.      disk.  Now when you run EDIR the large file shows 
  374.      up in the erased file directory so you unERAse it 
  375.      and then exit EDIR.  You check the size of the 
  376.      large file in the unerased file directory and the 
  377.      size seems ok.  You feel lucky because you were 
  378.      afraid that copying the smaller file onto the disk 
  379.      might have deleted the name of the big file from 
  380.      the erased file directory.
  381.  
  382.      Then you call up the big file you unerased using 
  383.      your word processor but there's some gibberish in 
  384.      the file which looks as if its part of the 
  385.      smaller file which was copied onto the disk after 
  386.      the big file was erased.  Where the gibberish ends 
  387.      the file seems to end but that doesn't make sense 
  388.      because the file size indicates there should be 
  389.      quite a bit more in the file.
  390.  
  391. What has probably happened in the scenario above is that when the smaller file 
  392. was copied onto the disk some of its data copied over some of the data 
  393. belonging to the big erased file.  Among the data belonging to the small file 
  394. is one or more CP/M Control-Z End-of-File Markers and your word processor (eg. 
  395. WordStar) won't go beyond the first such marker in a file.  
  396.  
  397. What you need to do is to remove all the Control-Z End-of File Markers from 
  398. the big file so that you'll be able to get at the portion of the big file 
  399. beyond the gibberish.  However you won't be able to recover the data the 
  400. gibberish covered over, that's gone forever. 
  401.  
  402. Here's a patch which can allow PIP.COM to strip all Control-Z End-of-File 
  403. Markers from a file.  The patched version of PIP is called PIPZ.  The patch 
  404. changes PIP's [F] parameter which normally removes Form Feeds so that it 
  405. filters Control-Z codes instead.  Once patched with DDT the new PIP can be 
  406. used to filter out the unwanted Control-Z codes using the following command 
  407. line: 
  408.  
  409.      A>PIPZ FILENAME=FILENAME[FO]
  410.  
  411. The letter O option tells PIP that the entire file is to be filtered so that 
  412. PIP will not also stop upon encountering the first Control-Z just as your word 
  413. processor does.  The letter F options tells the modified PIP to strip out the 
  414. Control-Z codes. 
  415.  
  416. Here's how to use DDT.COM to modify PIP.COM so that it will filter out 
  417. Control-Z's (1A Hex):  
  418.  
  419. A>DDT PIP.COM 
  420. DDT VERS 2.2
  421. NEXT  PC
  422. 2100 0100
  423. -FE54,E54,1A
  424. -FE64,E64,1A
  425. -^C
  426. A>SAVE 32 PIPZ.COM
  427.  
  428. (Above patch to PIP created by Nil R. Olson, N7BCV).
  429.  
  430.                     ====================
  431.  
  432.                    RECOVERING LOST FILES 
  433.  
  434. Lost files are files which where unerased but no longer appear in the erased 
  435. file directory.  That can happen because whenever a disk is written to the 
  436. files in the erased file directory are usually overwritten.  However even 
  437. after the name of an erased file disappears from the erased file directory the 
  438. data that file contained may be still be wholly or partially intact somewhere 
  439. on the disk. 
  440.  
  441. For example here's a typical scenario:
  442.      
  443.      The latest version of your unpublished novel, all 
  444.      150K of it, was on drive B when you mistakenly 
  445.      erased it and then copied some small 4K files 
  446.      onto the disk.  The file name of your novel isn't 
  447.      listed in the erased file directory but you know 
  448.      that those 4K files couldn't have overwritten very 
  449.      much of your 150K novel.  
  450.  
  451.      You're desperate to retrieve as much of your novel 
  452.      as possible.  Even if 8K or so of the novel is 
  453.      permanently gone and sections of it are out of 
  454.      place it would be much easier to repair the damage 
  455.      than to start all over.  After all every paragraph 
  456.      is precious!
  457.  
  458. The first thing to do, if you can do it, is to put a write protect sticker on 
  459. the disk with your novel on it and then make a disk image copy of that disk.  
  460. All of your attempts at recovering your novel should be made using the copy of 
  461. your novel disk and not the original, if possible.  The reason for using the 
  462. copy in the following procedure is so that if you make a mistake your novel 
  463. won't be lost forever.  
  464.  
  465. The COPY.COM program used to copy Kaypro disks makes the type of disk image 
  466. copy I'm referring to in that it copies the entire disk track-by-track and 
  467. doesn't concern itself with copying individual files the way PIP.COM does.  By 
  468. copying everything on all of the disk tracks the copy will also contain any 
  469. erased file data present on the original disk.  
  470.  
  471. Note:  Some COPY.COM programs will abort copying if a bad sector is detected.  
  472. In that case what you can do is to try running the NO-ERRS program (see below) 
  473. just before running your COPY.COM program.  The NO-ERRS program prevents the 
  474. detection of bad sectors and so it may fool your COPY.COM program into copying 
  475. the entire disk.  This only works with some COPY.COM programs, probably not 
  476. with the Kaypro version.  
  477.  
  478. Now that you've made a disk image copy of the disk containing your erased 
  479. novel, and have put the original in a safe place with a write protect sticker 
  480. on it, what you're going to do next is to create some 32K files on the copy 
  481. without writing any data onto the disk.  In other words you want the 32K files 
  482. to claim the data already on the disk, hopefully 32K chunks of your erased 
  483. novel, so that you can then transfer those files off of the disk and begin 
  484. reconstructing your novel from whatever you find in those files. 
  485.  
  486. Here's how to create the 32K files which claim data already on the disk.  On 
  487. another disk create this tiny program which I call NO-WRITE.COM using DDT.COM 
  488. like so: 
  489.  
  490. A>DDT
  491. DDT VERS 2.2
  492. -F100,200,1A
  493. -S100
  494. 0100 1A 3A    ,--> 0109 1A C1    ,--> 0112 1A C0                      
  495. 0101 1A 02    |    010A 1A BE    |    0113 1A 36                      
  496. 0102 1A 00    |    010B 1A C2    |    0114 1A 01           
  497. 0103 1A D6    |    010C 1A 00    |    0115 1A C9           
  498. 0104 1A 04    |    010D 1A 00    |    0116 1A .            
  499. 0105 1A 67    |    010E 1A 2C    |    -^C                  
  500. 0106 1A 2E    |    010F 1A 36    |    A>SAVE 1 NO-WRITE.COM
  501. 0107 1A A1    |    0110 1A 01    |       
  502. 0108 1A 3E >--'    0111 1A 2E >--'       
  503.  
  504. At this point the file NO-WRITE.COM should exist on the A drive.  Now to start 
  505. creating the 32K files which will claim data already on the disk instead of 
  506. writing their own data onto the disk put the copy of the disk containing your 
  507. erased novel in drive B and log onto drive B.  Now use the commands shown 
  508. below to create the files.  
  509.  
  510. Note:  If a Warm Boot occurs immediately after you run NO-WRITE then NO-WRITE 
  511. did not install itself because it didn't see the authentic CP/M 2.2 BDOS which 
  512. is required in order for NO-WRITE to work.  
  513.  
  514. B>A:NO-WRITE       
  515. B>SAVE 128 FILE1   
  516. B>SAVE 128 FILE2
  517. B>SAVE 128 FILE3
  518. B>SAVE 128 FILE4  
  519. B>SAVE 128 FILE5  
  520. B>SAVE 128 FILE6   Keep creating more files until you get
  521. B>SAVE 128 FILE7   the NO SPACE message shown below.      
  522. NO SPACE
  523.  
  524. Notice the NO SPACE message which was displayed by CP/M after the last SAVE 
  525. command.  That message means that when CP/M was creating FILE7 it ran out of 
  526. disk space and so FILE7 may not be a 32K file.  You must execute the commands 
  527. shown above one after another exactly as shown without Warm Booting between 
  528. commands.  If you Warm Boot even once between any of the commands then the 
  529. SAVE commands after the Warm Boot will actually write data onto the disk which 
  530. will destroy 32K chunks of your erased novel! 
  531.  
  532. Now reset your computer in order to get the NO-WRITE program out of the 
  533. computers memory.  Typing Control-C would also probably remove the NO-WRITE 
  534. program from memory but reset your system anyway just to be sure.  
  535.  
  536. Ok so now you have a bunch of 32K chunks of your novel.  The first thing you 
  537. should do now is to filter each of those chunks using the PIPZ program 
  538. discussed in the section above called "FIRST-AID FOR CORRUPTED FILES."  After 
  539. that it's up to you and your word processor.  
  540.  
  541. When you're looking at the recovered 32K chunks using your word processor, 
  542. let's assume WordStar, you may see lots of very long strings of the lower-case 
  543. letter e.  Those represent empty sectors on the disk which have not been 
  544. filled with file data even once since the disk was originally formatted.  
  545. Because each empty logical sector has 128 e's in it if you do a global replace 
  546. of the e's to get rid of them you should use a string of e's the length of 
  547. which is an even divisor of 128, such as a string of 8 or 16 e's. 
  548.  
  549.  
  550.            RECOVERING LOST FILES - ONE FINAL TIP
  551.  
  552. In the scenario outlined above two small 4K files where copied onto the disk 
  553. after the 150K novel was erased.  If either or both of the 4K files overwrote 
  554. some of the novel there is a chance that some of the novel might still be left 
  555. in areas of the disk claimed by, but not used by, the two 4K files.  The 
  556. reason this can be is related to the minimum file size on individual 
  557. computers.  On the Kaypro 2, Kaypro 4, and Kaypro 10 the maximum remaining 
  558. tidbit of your novel which might remain intact in the disk data space claimed 
  559. by each of 4K files would be 128 bytes less than 1K, 2K, or 4K respectively. 
  560.  
  561. To try and recover such tidbits, assuming they exist, you can start by erasing 
  562. just those two 4K files.  At that point, since the disk would already be 
  563. completely filled with files because of your previous use of the WRITE-NO/SAVE 
  564. procedure, the only free space on the disk should be that which was made 
  565. available by your erasure of the two 4K files.  
  566.  
  567. Now repeat the NO-WRITE/SAVE procedure using a different filename in the SAVE 
  568. command.  That will produce a file containing all the data in the disk areas 
  569. previously claimed by the two 4K files.  Finally run the resulting file 
  570. through PIPZ and you'll be ready to check it for novel data using your word 
  571. processor. 
  572.  
  573.                     ====================
  574.  
  575.          DETERMINING THE FILE SIZES OF ERASED FILES
  576.  
  577. To see the file sizes of the erased files on drive B place a copy of STAT.COM 
  578. on drive A and then erase it.  Once EDIR is run you can then run the erased 
  579. STAT.COM to list the file sizes of the erased files on drive B like so: 
  580.  
  581. If logged onto drive B use the command  B>A:STAT *.*
  582. If logged onto drive A use the command  A>STAT B:*.* 
  583.  
  584.                     ====================
  585.  
  586.               GETTING AROUND BDOS BAD SECTORS
  587.  
  588. If you have a damaged floppy diskette in drive B and CP/M reads a bad sector 
  589. from the disk then CP/M will make the announcement "BDOS Err on B: Bad Sector" 
  590. and suspend operations until you tell it what to do.  If you type a Control-C 
  591. at that point CP/M will cause a Warm Boot.  If you type anything other than a 
  592. Control-C then CP/M will disregard that the data read from the bad sector is 
  593. probably corrupted and continue operations as if the bad sector had not even 
  594. been detected.  
  595.  
  596. Note:  Each bad sector CP/M reports might mean anywhere from 128 to 1024 or 
  597. more bytes of possibly corrupted data, depending on the physical disk sector 
  598. size used in your particular computer. 
  599.  
  600. When a damaged diskette has a great many bad sectors and you're trying to 
  601. transfer the damaged files then you might not like having to stay by the 
  602. computer in order to type a key each time the bad sector message is displayed.  
  603. So here's a small program which will prevent CP/M from waiting for a keypress.  
  604. You can create this program, which I call NO-STOP.COM, by using DDT.COM like 
  605. so: 
  606.  
  607. A>DDT
  608. DDT VERS 2.2
  609. -F100,200,1A
  610. -S100
  611. 0100 1A 3A    ,--> 0107 1A F7    ,--> 010E 1A 2C          
  612. 0101 1A 02    |    0108 1A 3E    |    010F 1A 36          
  613. 0102 1A 00    |    0109 1A C1    |    0110 1A C3          
  614. 0103 1A D6    |    010A 1A BE    |    0111 1A C9          
  615. 0104 1A 0E    |    010B 1A C2    |    0112 1A .           
  616. 0105 1A 67    |    010C 1A 00    |    -^C                 
  617. 0106 1A 2E >--'    010D 1A 00 >--'    A>SAVE 1 NO-STOP.COM
  618.  
  619. The file NO-STOP.COM should now exist on the A drive.  The NO-STOP program, 
  620. like EDIR and NO-WRITE, will only stay in operation on most computers until a 
  621. Warm Boot comes along at which time it gets kicked out of the computers RAM 
  622. memory.  
  623.  
  624. So here's exactly what I'd do to copy files from a damaged diskette using 
  625. PIP.COM.  First I'd put a diskette containing only the two files PIP.COM and 
  626. NO-STOP.COM into drive A.  Next I'd put the damaged diskette into drive B.  
  627. I'd turn on the printer and type Control-P so that I'd have a printed record 
  628. of the file transfer.  Then I'd run NO-STOP and PIP to copy all the files from 
  629. drive B to drive A like so: 
  630.  
  631.      A>NO-STOP
  632.      A>PIP A:=B:*.*[OV] 
  633.  
  634. Once PIP started copying the files I'd leave the room and come back later 
  635. after all the files had been copied.  At that point the listing on the printer 
  636. might look like this: 
  637.  
  638.      A>NO-STOP
  639.      
  640.      A>PIP A:=B:*.*[OV]
  641.  
  642.      COPYING -
  643.      FILENAME1
  644.      FILENAME2
  645.      FILENAME3
  646.      Bdos Err On B: Bad Sector
  647.      FILENAME4
  648.      FILENAME5
  649.      Bdos Err On B: Bad Sector
  650.      Bdos Err On B: Bad Sector
  651.      FILENAME6
  652.      FILENAME7
  653.  
  654. Of course in a real listing the FILENAME's would be the actual names of files.  
  655. From the printed listing above I could tell that FILENAME3 had one bad sector 
  656. and FILENAME5 had two bad sectors.  
  657.  
  658.                     ====================
  659.  
  660.               GETTING AROUND BIOS BAD SECTORS 
  661.  
  662. Sometimes you may want to prevent CP/M from even detecting bad sectors.  For 
  663. example many COPY.COM programs which copy disks track-by-track instead of 
  664. file-by-file bypass the BDOS entirely go straight to the CP/M BIOS.  Many of 
  665. these COPY programs will abort copying if even one bad sector is detected.  So 
  666. here's a small program which will prevent CP/M from detecting bad sectors.  
  667. You can create this program, which I have named NO-ERRS.COM, by using DDT.COM 
  668. like so: 
  669.  
  670. A>DDT
  671. DDT VERS 2.2
  672. -F100,200,1A
  673. -S100                                             
  674. 0100 1A 3A    ,--> 010C 1A 1A    ,--> 0118 1A 23           
  675. 0101 1A 02    |    010D 1A 77    |    0119 1A 36          
  676. 0102 1A 00    |    010E 1A 3E    |    011A 1A AF          
  677. 0103 1A 57    |    010F 1A 54    |    011B 1A 23          
  678. 0104 1A 1E    |    0110 1A 12    |    011C 1A 36          
  679. 0105 1A 28    |    0111 1A 23    |    011D 1A C9          
  680. 0106 1A 21    |    0112 1A 13    |    011E 1A C9          
  681. 0107 1A 54    |    0113 1A 1A    |    011F 1A .           
  682. 0108 1A 00    |    0114 1A 77    |    -^C                 
  683. 0109 1A 36    |    0115 1A 3E    |    A>SAVE 1 NO-ERRS.COM
  684. 010A 1A CD    |    0116 1A 00    |             
  685. 010B 1A 23 >--'    0117 1A 12 >--'   
  686.  
  687. At this point the file NO-ERRS.COM should be present in your disk directory.  
  688. The NO-ERRS program differs from EDIR, NO-WRITE and NO-STOP in that NO-ERRS 
  689. will survive Warm Boot's.  Therefore you must reset your computer in order to 
  690. stop it from preventing the detection of bad disk sectors. 
  691.  
  692. If you make use of the NO-ERRS program in order to allow a COPY.COM type 
  693. program to copy a disk with bad sectors then the resulting copy will not have 
  694. any bad sectors.  However the bad data in the bad sectors will probably end up 
  695. in the corresponding good sectors on the copy.  That means that on the copy 
  696. there will be no way to tell which sectors have the bad data in them unless 
  697. you can visually examine the data.  Visual examination can be practical 
  698. however, especially when the data is text from a novel for example. 
  699.  
  700.                     ====================
  701.  
  702.           ORIGINAL INTENT - UNERASING BY TELEPHONE 
  703.  
  704. I began writing EDIR because of a few people who called me asking if there's 
  705. any way to unerase files without having an UNERA utility which they didn't 
  706. have (but had just ordered).  When a precious file has been erased it can be 
  707. very hard to wait for an UNERA program to arrive by mail.  Especially hard if 
  708. you have a hard disk since you don't dare write anything onto the hard disk 
  709. until you first unerase the file(s). 
  710.  
  711. The EDIR program and its assorted pals are small enough to be created using 
  712. DDT.COM in a few minutes.  The small program size allows reading the codes 
  713. over the phone to someone entering them into DDT.  Once EDIR is created then 
  714. recovery of erased files is even easier than using UNERA programs such as 
  715. UNERA.COM or MAKE.COM. 
  716.  
  717.                     ====================
  718.  
  719.  
  720.