home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug043.arc
/
RTW.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
3KB
|
93 lines
{Program to recover crashed Wordstar/Turbo files}
{CRS 25-9-85}
const
{Wordstar Constants}
wc_file = $846d; {Address of base of crashed file}
wo_fname = $34b9; {String containing the old filename}
{Turbo Constants}
tc_file = $8118; {Address of base of crashed file}
to_fname = $4500; {String containing the old filename}
var
x,r_type : char;
wend_mkr : integer absolute $37bc; {Worstar end of file address}
tend_mkr : integer absolute $4528; {Turbo end of file address}
i,j,end_mkr,c_file,o_fname : integer;
o_file : text;
fname : string[16];
procedure getfn(num,base : integer);
var
i : integer;
begin
i := 0;
while (i <= num) and (mem[to_fname+i+base] <> $20) do begin
fname := fname + chr(mem[to_fname+i+base]);
i := i + 1;
end;
end;
begin
writeln('Program to Recover Crashed Wordstar/Turbo Files');
writeln('CRS 25-September-85');
writeln;
write('Turbo or Wordstar file to restore (T or W) ?');
repeat read(kbd,r_type) until (upcase(r_type) = 'T') or (upcase(r_type) = 'W');
r_type := upcase(r_type);
writeln(r_type);
writeln;
if r_type = 'T' then begin
end_mkr := tend_mkr-1;
c_file := tc_file;
fname := '';
getfn(8,0);
fname := fname + '.';
getfn(3,8);
end else begin
end_mkr := wend_mkr;
c_file := wc_file;
i := 0;
fname := '';
while (mem[wo_fname+i] <> 0) do begin
fname := fname + chr(mem[wo_fname+i]);
i := i + 1;
end;
end;
if end_mkr = c_file then begin
writeln('The file you are attempting to restore is either of zero');
writeln('length or is an unchanged image of an existing file.');
end else begin
writeln('Calculated length of restorable image is ',end_mkr-c_file,' bytes');
writeln;
writeln('Old name of file is ',fname);
write('Use this name (Y or N)? ');
repeat
read(kbd,x);
until (upcase(x) = 'Y') or (upcase(x) = 'N');
x := upcase(x);
writeln(x);
writeln;
if upcase(x) = 'N' then begin
write('Enter new name ? ');
readln(fname);
end;
assign(o_file,fname);
rewrite(o_file);
for i := c_file to end_mkr-1 do write(o_file,chr(mem[i]));
close(o_file);
writeln('File closed.');
end;
end.
ä M0$ <> "L" ë 890f ä A1 = 0 ë ü A1 = 360p ü A1 = A1 - A2z ä M0$ = "R" ë ü A1 = A1 + A2ä