{@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
The purchaser of these procedures and functions may include them in COMPILED
programs freely, but may not sell or give away the source text.

    NOTE that programs that replace the keyboard interrupt had
    better not CRASH before they put back the OLD interrupt.  If
    they do, you will have to turn off your PC and turn it on
    again to do anything.

}
{$I newint9.lib}
var
  ThatKey : byte;
begin
  WriteLn('When you press a key, the regular keyboard interrupt will be');
  WriteLn('replaced.  The new interrupt responds only to keys pressed and');
  WriteLn('keys released--no typematic, no shifts.  The output is a scan');
  WriteLn('code.  Scan code for release is the regular code + 128.');
  WriteLn('Try some keys.  Press <ctrl-Break> to restore things.');
  WriteLn('    NOTE: <ctrl><break> is actually disabled by this new');
  WriteLn('    interrupt--it has to watch for it specially.');
  repeat until keypressed;
  SetUpInt;
  NewInt;
  repeat
    ThatKey := WatchKeys;
    Write(ThatKey:5);
    if ThatKey < 128 then
      begin
        sound(ThatKey*20 + 500);
        WriteLn('   pressed');
      end
    else
      begin
        nosound;
        WriteLn('   released');
      end;
  until (OlderByte = 29) and (OldByte = 70);
  NoSound;
  OldInt;
end.

