home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / murutil / alert.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-09-28  |  1.3 KB  |  73 lines

  1. PROGRAM ALERT;
  2.  
  3. {  This Turbo Pascal V4.0 program sounds an alert tone until a key is
  4.    pressed or until fifteen minutes have passed.
  5.  
  6.    Program by Harry M. Murphy,  1 March 1986.
  7.  
  8.    Updated for Turbo Pascal Version 4.0 on 23 November 1987. }
  9.  
  10. USES
  11.       CRT;
  12.  
  13. CONST
  14.       DUR = 50;
  15.       HI  = 1056;
  16.       LO  = 528;
  17.       MAX = 15;
  18.       SP  = '     ';
  19.  
  20. VAR
  21.     CH : CHAR;
  22.     I  : BYTE;
  23.     M  : BYTE;
  24.     N  : BYTE;
  25.  
  26. { -------------------------------- }
  27.  
  28. PROCEDURE PAUSE(N : INTEGER);
  29.  
  30. VAR
  31.     I : INTEGER;
  32.  
  33. BEGIN
  34.   I := N;
  35.   REPEAT
  36.     DELAY(100);
  37.     I := I-1
  38.   UNTIL KEYPRESSED OR (I=0)
  39. END { Procedure PAUSE };
  40.  
  41. { -------------------------------- }
  42.  
  43. BEGIN { Program ALERT }
  44.   TEXTCOLOR(30);
  45.   TEXTBACKGROUND(0);
  46.   WRITE(SP,'PRESS ANY KEY TO STOP THIS ALERT.',SP,#13);
  47.   NORMVIDEO;
  48.   M := MAX;
  49.   REPEAT
  50.     N := 5;
  51.     REPEAT
  52.       FOR I:=1 TO 10 DO
  53.         BEGIN
  54.           SOUND(LO);
  55.           DELAY(DUR);
  56.           SOUND(HI);
  57.           DELAY(DUR)
  58.         END;
  59.       NOSOUND;
  60.       PAUSE(10);
  61.       N := N-1
  62.     UNTIL KEYPRESSED OR (N=0);
  63.     PAUSE (500);
  64.     M := M-1
  65.   UNTIL KEYPRESSED OR (M=0);
  66.   WHILE KEYPRESSED DO CH := READKEY;
  67.   CLREOL;
  68.   WRITELN(SP,'ALERT cancelled.');
  69.   SOUND(LO);
  70.   DELAY(100);
  71.   NOSOUND
  72. END.
  73.