Skip to content

Instantly share code, notes, and snippets.

@ssg
Created August 25, 2011 20:10
Show Gist options
  • Save ssg/1171747 to your computer and use it in GitHub Desktop.
Save ssg/1171747 to your computer and use it in GitHub Desktop.
Homebrew floppy changeline detection routines
{ On-line directory v1.00b }
uses debris,XStr,disk,dos,crt;
procedure abort;
begin
writeln(#13#10+'SSG Operation complete');
halt;
end;
var
dirinfo:searchrec;
buf:TBootRecord;
drive:char;
s:string;
begin
if paramCount > 0 then begin
s := ParamStr(1);
drive := upcase(s[1]);
end else drive := 'A';
clrscr;
writeln('Online Disk Reader Version 1.00b - (c) 1995 SSG');
window(1,3,80,25);
repeat
if DiskExists(byte(drive)-65) then begin
ResetDisk(byte(drive)-65);
FindFirst(drive+':\*.*',archive+readonly+sysfile+hidden+directory,dirinfo);
if DosError = 18 then writeln('--- Empty disk ---') else
if DosError <> 0 then writeln(#7'BAD DISK!');
while DosError = 0 do begin
if dirinfo.attr and directory > 0 then dirinfo.name := dirinfo.name + '\';
writeln(Fix(dirinfo.name,20)+RFix(l2s(dirinfo.Size),15));
FindNext(dirinfo);
end;
if DosError = 18 then begin
writeln;
s := l2s(DiskFree(byte(drive)-64));
ConvertNumToBusiness(s);
writeln(s+' bytes free');
end;
repeat
if keypressed then abort;
until not DiskExists(byte(drive)-65);
clrscr;
end;
until keypressed;
abort;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment