-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCLD.pp
More file actions
executable file
·86 lines (75 loc) · 1.81 KB
/
CLD.pp
File metadata and controls
executable file
·86 lines (75 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Program CLD;
uses pdisk32,crt;
var emptysector:ponesector;
procedure clear(drv:byte);
var i,total:longint;
dp:tdrvparams;
percent,oldpercent:word;
begin
writeln;
write('Please wait'+#13);
if drv in floppies then dp:=floppy[drv] else dp:=harddisk[drv];
total:=drivesize(dp)-1;
oldpercent:=0;
percent:=0;
for i:=0 to total do
begin
writesectorLBA(drv,i,emptysector);
percent:=round((i / total)*100);
if percent>oldpercent then
begin
write(#13+'Erasing drive ',percent,'% '+#13);
oldpercent:=percent;
end;
end;
end;
procedure main;
var i:word;
drv:byte;
begin
new(emptysector);
for i:=0 to 511 do emptysector^[i]:=0;
getdrvparams;
writeln;
writeln('Disk Eraser by Colin C. Davis');
writeln;
writeln('WARNING: This program will erase a disk. You cannot recover the data');
writeln('on the erased disk once you have run the program. Be careful with it.');
writeln;
write('Fixed disks: ');
for i:=drive_1 to drive_4 do
if driveExists(i) then write(i-127,' ',drivesz(i),' mb ');
writeln;
if drivesize(floppy[drive_A]) > 0 then
begin
write('Floppy ');
write('A: ',drivesize(floppy[drive_a]) div 2,' kb ');
if drivesize(floppy[drive_b]) > 0 then
write('B: ',drivesize(floppy[drive_b]),' kb ');
writeln;
end;
write('Clear drive (1-4,A,B), any other key to abort: ');
repeat until keypressed;
case readkey of
'1':drv:=drive_1;
'2':drv:=drive_2;
'3':drv:=drive_3;
'4':drv:=drive_4;
'a','A':drv:=drive_a;
'B','b':drv:=drive_b;
else halt;
end;
writeln;
write('Are you sure ? (y/n):');
repeat until keypressed;
if upcase(readkey) <>'Y' then halt;
clear(drv);
writeln;
writeln('Done');
dispose(emptysector);
end;
begin
InitDOSmemBuffer;
main;
RemoveDOSmemBuffer;
end.