{ Questa unit trasforma il tasto pausa in una P.  Usarla Š facilissimo:
  basta includere la unit nel programma e... dimenticarla! }


Unit Pause2P;   { by Pino Navato }

interface

  { This unit doesn't export anything! }


implementation
uses Dos;

var KbdIntVec   : Procedure;
    KbdFlags    : byte absolute $0040:$0018;
    OldExitProc : pointer;


procedure ExitHandler; far;
   begin
      ExitProc := OldExitProc;
      SetIntVec($9, Addr(KbdIntVec))   { Restore old vector }
   end;


procedure NewInt9; interrupt;
begin
   inline ($9C);   { PUSHF -- Push flags }
   KbdIntVec;      { Call old ISR using saved vector }
   if KbdFlags and 8 = 8 then             { IF pause flag is high THEN... }
      begin
         KbdFlags := KbdFlags and 247;    { Clear pause flag }
         asm                              { Put a 'P' in kdb buffer }
            MOV CX,1950h
            MOV AH,5
            INT 16h
         end
      end
end;


begin  { Initialization }
   GetIntVec($9, @KbdIntVec);
   SetIntVec($9, Addr(NewInt9));   { Insert ISR into keyboard chain }
   OldExitProc := ExitProc;
   ExitProc := @ExitHandler
end.
