home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / WIH.ZIP / INTCALL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-02-01  |  2.1 KB  |  54 lines

  1. Program Critical_Error_Handler;
  2. Type
  3.    RegisterSet=Record Case Integer Of
  4.                   1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Integer);
  5.                   2: (AL,AH,BL,BH,CL,CH,DL,DH         : Byte);
  6.                 End;
  7. Const
  8.     Interupt_41 = $41;
  9.     Interupt_42 = $42;
  10. Var
  11.    Interupt_Number      : Integer;
  12.    Int41,Dos_Function   : RegisterSet;
  13.    C                    : Char;
  14. Begin (* Sample Interupt Caller *)
  15.    WriteLn('This program calls interupt 65 or 66');
  16.    WriteLn('Segment registers are:  CSeg=',CSeg);
  17.    WriteLn('                        SSeg=',SSeg);
  18.    WriteLn('                        DSeg=',DSeg);
  19.    WriteLn('Do you want to examine the interupt vectors?');
  20.    Read(Kbd,C);
  21.    While C = 'y' Do With Dos_Function Do Begin
  22.       Write('Interupt to query ? ');
  23.       Read (Interupt_Number);WriteLn;
  24.       AH := $35;   {Get interupt vectors}
  25.       AL := Interupt_Number;   {for test interupt}
  26.       MsDos (Dos_Function);
  27.       WriteLn('Interupt ',AL,': segment = ',ES,':  offset = ',BX);
  28.       WriteLn('More?');
  29.       Read(kbd,C);
  30.       End;
  31.    Write('Interupt to activate ? ');
  32.    Read (Interupt_Number);
  33.    WriteLn;
  34.    While Interupt_Number in [$41,$42] do begin
  35.    WriteLn('Do you want to set registers?');
  36.    Read(Kbd,C);
  37.    If C = 'y' Then Begin
  38.        WriteLn('Enter Values for AX, BX, and DI registers...');
  39.        With Int41 do read(AX,BX,DI); WriteLn;
  40.        End;
  41.    WriteLn(' Preparing to activate Software Interupt ',Interupt_Number);
  42.    WriteLn(' --------------------------------------------------------------');
  43.    IF Interupt_Number = $41 then INTR(Interupt_41,Int41);
  44.    IF Interupt_Number = $42 then INTR(Interupt_42,Int41);
  45.    WriteLn(' --------------------------------------------------------------');
  46.    WriteLn(' Returned from interupt ',Interupt_Number);
  47.    With Int41 Do Begin
  48.           WriteLn('Registers are:');
  49.           WriteLn('AX = ',AX,': BX = ',BX,': CX = ',CX);
  50.           WriteLn('DX = ',DX,': SI = ',SI,': DI = ',DI); End;
  51.    Write('Interupt to activate ? ');
  52.    Read (Interupt_Number);
  53.    WriteLn; End;
  54. End.