For IBM PC/PCjr
For IBM PC/PCjr
Virtually every computer user has suffered the consequences of deleting an important file by accident. This convenient utility can recover such a file as long as it hasn't been overwritten by other disk operations.
Regardless of experience and interest level, nearly every computer user has suffered the same unpleasant feeling: After pressing Enter, you realize that you just accidentally deleted an important disk file. In the case of commercial software, such accidents can be costly as well as embarrassing. "Disk Fix" makes it possible to recover accidentally deleted files. Type in and save the program; then run it to create a machine language file named DISKFIX.COM. (Don't use that name for the BASIC program that creates the file.) The filemaker program also creates a backup copy of the file with the name DISKFIX.BKP (to use this file, change the extension BKP to .COM).
DISKFIX.COM is a machine language program that runs from the DOS prompt; you needn't be a machine language expert to use this program, however. To recover the lost data, go to the DOS command level (A> or B>). If you are currently in BASIC, the SYSTEM command takes you to the DOS command level. Insert the disk that contains Disk Fix; then type DISKFIX and press Enter. The drive lights for an instant as the computer loads Disk Fix into memory. When the light goes out, insert the disk that contains the file you want to recover. Press any key to begin the recovery process. The drive will light for a second time, then stop.
At this point, the lost file has been recovered. If you perform DIR from the DOS prompt, the filename should appear in the directory, with a dollar sign ($) where the first character of the filename previously appeared. (The dollar sign replaces a marker which DOS placed there when deleting the file.) Now that the file is restored, you can rename it and perform any other operation you wish. Since it searches for all deleted files, Disk Fix also works in cases where you have deleted a group of related files with a wild-card command.
It's important that you understand which files Disk Fix cannot recover. If you accidentally delete a file, Disk Fix can restore it only if you act before you write any additional files to the same disk. As long as no new files have been written to that disk, all the information in the deleted file is still intact and can be restored. If you save a new program on the disk, however, it may write over the deleted file's data, destroying it forever.
Disk Fix does not harm any other files on the disk. However, if you have deleted a file with a name like FFILE.BAS and the disk still contains the file $FILE.BAS, Disk Fix cannot work correctly. Since the recovered program is renamed from FFILE.BAS to $FILE.BAS, the disk now contains two programs of the same name. For this reason, you should avoid the practice of beginning filenames with a dollar sign.
This program takes advantage of the fact that deleting a file doesn't erase its data from disk. Instead, DOS changes the first character of the filename to a marker which indicates the file is deleted. As a result, DOS skips over the file whenever it searches the disk, making it impossible to use the file in a normal way. Disk Fix simply searches the disk's FAT (File Allocation Table) and replaces all deletion markers with dollar signs. The effect is to restore all previously deleted files.
For instructions on entering this program, please refer to "COMPUTE!'s Guide to Typing In Programs" in this issue of COMPUTE!.
MN 10 CLEAR ,50000!
HM 20 CLS
OI 30 READ AE:IF A$="BF" THEN 50
AE 40 PRINT CHRS(7):PRINT "THE F
IRST NUMBER IS BF,NOT ";A$
LF 50 FOR X=1 TO 19
DO 60 FOR Y=1 TO 10
LL 70 READ A$
A6 80 NEXT Y
CA 90 READ A$:G=G+VAL("&h"+A$)
6N 100 NEXT X
BL 110 IF HEX$(G)="4D1C" THEN RE
KO 120 PRINT CHR$(7):PRINT "ERRO
R:CHECK END NUMBERS" :END
NI 130 G=0
QO 140 READ A$
IF 150 FOR X=1 TO 19
PH 160 FOR Y=1 TO 10
AE 170 READ A$
NC 180 G=G+VAL("&h"+A$)
IJ 190 NEXT Y
PH 200 READ A$
KM 210 IF G<>VAL("&H"+A$) THEN 2
NH 220 G=0
BE 230 NEXT X
FB 240 GOTO 260
NC 250 PRINT CHR$(7):PRINT "ERRO
R:CHECK DATA STATEMENTS I
BN 260 READ A$:IF A$<>"13" THEN
JJ 270 READ A$:IF A$<>"C3" THEN
280 PRINT "CONGRATULATIONS!!
DATA IS OKAY!!(WHEW!)"
MD 290 RESTORE
FL 300 XX=50000!
CA 310 READ A$:POKE XX,VAL("&h"+
IB 320 FOR X=1 TO 19
PD 330 FOR Y=1 TO 10
MP 340 XX=XX+1
AC 350 READ A$
BF 360 POKE XX,VAL("&h"+A$)
HH 370 NEXT Y
DE 380 READ A$:NEXT X
KM 390 READ A$:XX=XX+1:POKE XX,V
JL 400 READ A$:XX=XX+1:POKE XX,V
AD 410 OPEN "DISKFIX.COM" AS #1
QN 420 OPEN "DISKFIX.BKP" AS #2
LC 430 FIELD #1,1 AS A$
QI 440 FIELD #2,1 AS AA$
GH 450 FOR Q=0 TO XX-50000!:LSET
AA$-A$:PUT #2:PUT #1:NEXT
FM 460 CLOSE:END
JS 470 DATA BF
EM 480 DATA B4,0,CD,16,B8,0,17,8
LK 490 DATA 0,17,8E,C0,B9,3,0,51
DN 500 DATA 4,B2,0,B6,0,B5,0,B1,
KI 510 DATA 4,B4,2,CD,13,59,EB,9
NF 520 DATA FC,0,74,7,B4,0,CD,13
OD 530 DATA C3,B9,3,0,51,BB,0,8,
DE 540 DATA B6,1,B5,0,B1,1,B0,3,
NF 550 DATA CD,13,59,E8,6D,0,80,
QK 560 DATA 7,B4,0,CD,13,E2,DF,C
GL 570 DATA 20,BB,0,4,80,3F,E5,7
FL 580 DATA C3,1,E2,F6,EB,5,C6,7
KF 590 DATA F4,B9,3,0,51,BB,0,4,
LB 600 DATA B6,0,B5,0,B1,6,B0,4,
HK 610 DATA CD,13,59,EB,31,0,80,
HC 620 DATA 7,B4,0,CD,13,E2,DF,C
FD 630 DATA 0,51,BB,0,8,B2,0,B6,
PL 640 DATA 0,B1,1,B0,3,B4,3,CD,
MH 650 DATA E8,C,0,80,FC,0,74,6,
KC 660 DATA CD,13,E2,DF,C3,B4,1,
GO 670 DATA 13,C3