[comp.sys.apple] recovering lost programs under DOS 3.3

leigh@unibase.UUCP (Leigh Calnek) (06/22/88)

trying to make it so my students could not copy it, I added a "new" 
statement at the end of the program.  I then proceded to test the 
program, and sure enough, it worked, the program was cleared from 
memory.  Then, without thinking, I saved it!  You guessed it, I 
overwrote the existing program with the null program.  Looking at 
the directory of the disk, I note that it still occupies 44 blocks, 
however if I try to load it I get what I saved, nothing.  

The above scenario was described to me by a friend who knows better 
but did it anyway.  If he were working with MSDOS I would know what 
I could do however I am not very familiar with Appledos.  Does 
anyone know of a utility for DOS 3.3 that will let you work at the 
byte level on an apple diskette and fiddle with the binary data in 
the file?  Is it possible to recover all but the first block of the 
lost program, or is it gone for all times?  Any suggestions would be 
appreciated.

 
------------------------
uunet!mcl!unibase!leigh
Leigh Calnek                 Co-ordinator, Education Technology
3002 Harding St.             Saskatchewan Education
Regina, Sask. Canada         2220 College Ave.
S4V 0Y4                      Regina, Saskatchewan, Canada
phone: home (306)789-9007    S4P 3V7
       bus. (306)787-9448

 

22149853@WSUVM1.BITNET (Duane Wessels) (06/27/88)

First of all, you need a DOS 3.3 sector editor.  The DOS 3.3 VTOC
(Volume Table of Contents) is on track $11 and starts at sector $0F.
Start there with the sector editor and look for the filename.  Continue
looking at sectors $0E, $0D, $0C, etc...  When you find the filename,
look at the three bytes preceeding the first byte of the filename.  The
first of these three is the track number of that files Track/Sector List.
The next byte is the sector of that files Track/Sector list.

Now, look at the Track/Sector list at the track and sector found above.
I don't know what this will look like.  Hopefully when the 'empty file'
was saved, DOS didn't clear this list.  If it did, you will have to go
through all the sectors on the disk, looking for the Basic file.  If you
have a sector editor that will scan the disk for text strings, you can
scan it for something that was inside the quotes of a PRINT statement.

It may be that DOS wrote "00" over the first pairs of the Track/Sector
list and left the rest intact.  The first Track/Sector pair where the
file is stored at is at $0C and $0D (12th & 13th bytes) of the Track/
Sector List.  The next pair is at $0E and $0F, etc...

IF you do manage to recover the data, it still may not show up when
you LOAD it.  I think Applesoft files are essentially saved as binary
files, but always start at $801 (??).  Since the first couple of
sectors of the file may have been erased, it would load '00's starting
at $801.  When you LIST a file, it looks at certain memory locations
for the place of the next line.  If it finds '00's, it may just stop
listing.

I hope this isn't more confusing than helpful.  If you can, look at
Appendix C of "The DOS Manual."

Good luck!

+---------------------------------------------------------------------+
| Duane Wessels    Bitnet: 22149853@WSUVM1                            |
|                                                                     |
| "...my parents forgot to pay the gravity bill."  -- Calvin          |
+---------------------------------------------------------------------+
Acknowledge-To: <22149853@WSUVM1>