home *** CD-ROM | disk | FTP | other *** search
- Program Sample_Interupt_Handler;
- (*$INEWSCRN.INC *)
- 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;
- Var
- C : Char;
- Const
- Interupt_Counter : Integer = 0;
- Begin
- Interupt_counter := Interupt_counter + 1;
- Save_Screen(Saved_Screen);
- Draw_Menu_Frame(16,6,64,16,15,7,
- ' Sample Interupt Handler ');
- WriteLn(bell);
- WriteLn('Interupt $41 successfully handled ',Interupt_Counter,
- ' times.');
- 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;
- WriteLn(' Press any key to continue');
- Read(Kbd,c);
- Restore_Screen(Saved_Screen);
- End;
-
- (*$ISIH.Inc *)
-
- (*----------------------------------------------------------------------*)
- Begin {Main Program}
- Get_Screen_Address;
- Interupt_Handler;
- Setup.DX := $800;
- Setup.Ah := $31;
- MsDos(Setup);
- End.