home *** CD-ROM | disk | FTP | other *** search
- Program Critical_Error_Handler;
- Type
- RegisterSet=Record Case Integer Of
- 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Integer);
- 2: (AL,AH,BL,BH,CL,CH,DL,DH : Byte);
- End;
- Var
- Setup : RegisterSet;
- IntAX,IntBX,IntCX,IntDX,IntBP,IntSI,IntDI,IntDS,IntES,
- IntFlags : Integer;
- Interupt_Registers : RegisterSet Absolute IntAX;
- {Interupt_Registers must be Global so that they will be in the data segment
- and can be accessed by any interupt handler or user procedure.
- Local variables are in the stack segment which is not preserved.
- Becuase they are global, however, it will be extra dangerous for one interupt
- handler to call another. To ensure that that will work,it may be necessary
- to declare a second global register set.}
-
- Procedure Interupt_Handler;
- Const Interupt_Number = $41;
-
- Procedure User_Procedure;
- Const Interupt_Counter : Integer = 0;
- Begin
- Interupt_counter := Interupt_counter + 1;
- WriteLn('Interupt ',Interupt_Number,' successfully handled ',
- Interupt_Counter,' times in Turbo Pascal');
- With Interupt_Registers Do Begin
- WriteLn('Registers are:');
- WriteLn('AX = ',AX,': BX = ',BX,': CX = ',CX);
- WriteLn('DX = ',DX,': SI = ',SI,': DI = ',DI);
- WriteLn('Enter Values for AX, BX, and DI registers...');
- Read(AX,BX,DI); WriteLn; End;
- End;
-
- (*$ISIH.INC*)
-
- Begin
- Interupt_Handler; {initialize interupt}
- Setup.DX := $400; {reserved 16K memory for resident program}
- Setup.AH := $31; {DOS Function to terminate resident}
- MsDos(Setup);
- End.