Category : Files from Magazines
Archive   : PCTJ8804.ZIP
Filename : SAMPUNIT.PAS

 
Output of file : SAMPUNIT.PAS contained in archive : PCTJ8804.ZIP
{ A sample unit used by the program CRITTEST.
Copyright (c) 1988, Ben Myers }

unit sampunit;
interface
uses Crt, Dos;

function KeyWait : char;
procedure Printer_Error_Check ( Code_To_Check : word );
procedure Floppy_Error_Check ( Code_To_Check : word );

implementation
{{$D+} { Debugging option on }
{{$T+} { Generate memory map info for debugging }

{ function KeyWait : char;
Waits until a key is pressed, then passes its value back to caller.
If the returned value is zero, there is a scan code that has been
lost. This is because a function key was pressed, but Keywait is
not intended for general purpose use. }

function KeyWait;
var
Key1, Key2 : char;
begin {KeyWait}
while not KeyPressed do; { Wait for keystroke }
Key1 := ReadKey;
if Key1 = #0 then Key2 := ReadKey;
KeyWait := Key1;
end; {KeyWait}

{ procedure Printer_Error_Check ( Code_To_Check : word );
Checks for and initiates recovery on printer. }

procedure Printer_Error_Check;
var
Keystroke : char;
begin {Printer_Error_Check}
if Code_To_Check <> 0 then
begin { Only if error code is not zero }
Write ( 'Printer error ', Code_To_Check:4,
' Y to Continue N to Stop.' );
repeat { User takes corrective action, and responds }
KeyStroke := KeyWait;
until Keystroke in [ 'Y', 'y', 'N', 'n' ];
Writeln ( ' ', Keystroke );
case Keystroke of
'N', 'n' : halt (0);
end; { case Keystroke }
end; { Only if error code is not zero }
end; {Printer_Error_Check}

{ procedure Floppy_Error_Check ( Code_To_Check : word );
Checks for and initiates recovery on floppy disk. }

procedure Floppy_Error_Check ( Code_To_Check : word );
var
Keystroke : char;
begin {Floppy_Error_Check}
if Code_To_Check <> 0 then
begin { Only if error code is not zero }
Write ( 'Floppy error ', Code_To_Check:4,
' Y to Continue N to Stop.' );
repeat { User takes corrective action, and responds }
Keystroke := KeyWait;
until Keystroke in [ 'Y', 'y', 'N', 'n' ];
Writeln ( ' ', Keystroke );
case Keystroke of
'N', 'n' : halt (0);
end; { case Keystroke }
end; { Only if error code is not zero }
end; {Floppy_Error_Check}
end. {of unit samptest}


  3 Responses to “Category : Files from Magazines
Archive   : PCTJ8804.ZIP
Filename : SAMPUNIT.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/