home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TURBOWHL.ZIP / NEWINT9.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-06-28  |  1.4 KB  |  43 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5.     NOTE that programs that replace the keyboard interrupt had
  6.     better not CRASH before they put back the OLD interrupt.  If
  7.     they do, you will have to turn off your PC and turn it on
  8.     again to do anything.
  9.  
  10. }
  11. {$I newint9.lib}
  12. var
  13.   ThatKey : byte;
  14. begin
  15.   WriteLn('When you press a key, the regular keyboard interrupt will be');
  16.   WriteLn('replaced.  The new interrupt responds only to keys pressed and');
  17.   WriteLn('keys released--no typematic, no shifts.  The output is a scan');
  18.   WriteLn('code.  Scan code for release is the regular code + 128.');
  19.   WriteLn('Try some keys.  Press <ctrl-Break> to restore things.');
  20.   WriteLn('    NOTE: <ctrl><break> is actually disabled by this new');
  21.   WriteLn('    interrupt--it has to watch for it specially.');
  22.   repeat until keypressed;
  23.   SetUpInt;
  24.   NewInt;
  25.   repeat
  26.     ThatKey := WatchKeys;
  27.     Write(ThatKey:5);
  28.     if ThatKey < 128 then
  29.       begin
  30.         sound(ThatKey*20 + 500);
  31.         WriteLn('   pressed');
  32.       end
  33.     else
  34.       begin
  35.         nosound;
  36.         WriteLn('   released');
  37.       end;
  38.   until (OlderByte = 29) and (OldByte = 70);
  39.   NoSound;
  40.   OldInt;
  41. end.
  42.  
  43.