next up previous contents index
Next: disable Up: Functions and Procedures Previous: get_pm_interrupt

set_pm_interrupt

   

Declaration:

Function set_pm_interrupt (vector : byte; const intaddr : tseginfo) : boolean;

Description:

Sets the address of the protected mode handler for an interrupt

Parameters:

vector:
number of protected mode interrupt to set
intaddr:
selector:offset address to the interrupt vector

Return values: True if successful, false otherwise.

Notes: The address supplied must be a valid selector:offset protected mode address.

Errors:

Check int31error variable

See also:

get_pm_interrupt, set_rm_interrupt, get_rm_interrupt

Example
Program int_pm;

uses crt, go32;

const int1c = $1c; 

var oldint1c : tseginfo;
    newint1c : tseginfo;
    int1c_counter : Longint;

{$ASMMODE DIRECT}
procedure int1c_handler; assembler;
asm
   cli
   pushw %ds
   pushw %ax
   movw %cs:INT1C_DS, %ax
   movw %ax, %ds
   incl _INT1C_COUNTER
   popw %ax
   popw %ds
   sti
   iret
INT1C_DS: .word 0
end;

var i : Longint;

begin
     newint1c.offset := @int1c_handler;
     newint1c.segment := get_cs;
     get_pm_interrupt(int1c, oldint1c);
     asm
        movw %ds, %ax
        movw %ax, INT1C_DS
     end;
     Writeln('-- Press any key to exit --');
     set_pm_interrupt(int1c, newint1c);
     while (not keypressed) do begin
           gotoxy(1, wherey); 
           write('Number of interrupts occured : ', 
                 int1c_counter);
     end;
     set_pm_interrupt(int1c, oldint1c);
end.



Michael Van Canneyt
Thu Sep 10 13:59:33 CEST 1998