Previous: 4.24.2.30. SetFTime To the Table of Contents Next: 4.24.2.32. SetTime
4.24.2.30. SetFTime Table of Contents 4.24.2.32. SetTime

- 4.24.2.31. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.31. SetIntVec


4.24.2.31. SetIntVec

Targets: MS-DOS only


Dos Unit, WinDos Unit

Sets a specified interrupt vector to a specified address.

Declaration:
procedure SetIntVec(IntNo: Byte; Vector: Pointer);
procedure SetIntVec(IntNo: Byte; Vector: FarPointer);
Remarks:
Interrupts may occur while in protected mode or while in real mode.

Example:
program Timer;
uses
  Dos, Crt;
var
  Int1CSave: FarPointer;
  Time     : LongInt;
// timer handler
procedure TimerHandler(eip,eax,ecx,edx,ebx,esp,ebp,esi,edi:
                       Dword; gs,fs,es: Word); interrupt;
var
  StoreX, StoreY: Word;
begin
  Inc(time);
  Store X:= WhereX;
  Store Y:= WhereY;
  GotoXY(1,1);
  Write(time);
  GotoXY(StoreX, StoreY);
  Port[$20] := $20;
end;

// main program
begin 
  ClrScr;
  Time := 0;
  GetIntVec($1C, Int1CSave);
  SetIntVec($1C, @TimerHandler);
  Writeln;
  Writeln('Type something and press "ENTER" to exit');
  Readln;
  SetIntVec($1C, Int1CSave);
end.
See also:
GetIntVec
FarPointer


Previous: 4.24.2.30. SetFTime To the Table of Contents Next: 4.24.2.32. SetTime
4.24.2.30. SetFTime Table of Contents 4.24.2.32. SetTime

- 4.24.2.31. -