home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST0701.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-11-17  |  1.1 KB  |  43 lines

  1. Unit IntXX;
  2.  
  3. INTERFACE
  4.  
  5. Uses
  6.   DOS;
  7.  
  8. IMPLEMENTATION
  9.  
  10. Var
  11.   OldExitProc,
  12.   SaveIntXX : pointer;
  13.  
  14. Procedure JmpOldISR(OldISR: Pointer);
  15. { An inline macro procedure. The code for this will be inserted at the }
  16. { point that it is called. The purpose of this macro is to jump to the }
  17. { Interrupt Service Routine at the address passed in.                  }
  18.   Inline($5B/$58/$87/$5E/$0E/$87/$46/$10/$89/
  19.          $EC/$5D/$07/$1F/$5F/$5E/$5A/$59/$CB);
  20.  
  21. {$F+}
  22. Procedure ISR( Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:word ); Interrupt;
  23. { This interrupt procedure is the new ISR for Interrupt XX. }
  24. Begin
  25.   JmpOldISR( SaveIntXX );
  26. End;
  27.  
  28. Procedure IntXXExitProc;
  29. { This procedure will be called upon exit of the program. Its purpose }
  30. { is to restore the interrupt that was stolen at startup.             }
  31. Begin
  32.   ExitProc := OldExitProc;
  33.   SetIntVec( <XX>, SaveIntXX );  { Restore the old ISR }
  34. end;
  35. {$F-}
  36.  
  37. Begin
  38.   OldExitProc := ExitProc;       { Set up exit procedure }
  39.   ExitProc := @IntXXExitProc;    { " }
  40.   GetIntVec( <XX>, SaveIntXX );  { Save old ISR value }
  41.   SetIntVec( <XX>, @Key_ISR );   { Set up new ISR }
  42. end.
  43.