mov dx, seg InterruptHandler
mov ds, dx
mov dx, offset InterruptHandler ;ds:dx points to new handler
mov al, InterruptNumber ;interrupt vector
mov ah, 25h ;Set Interrupt Vector
int 21h
Set Interrupt Vector (Function 25h) replaces the vector-table entry with the address of the specified interrupt handler.
InterruptHandler
Specifies the address of the new interrupt handler.
InterruptNumber
Specifies the number of the interrupt (00h-0FFh) that is to cause the specified handler to be called.
This function has no return value.
Programs should never set an interrupt vector directly in memory. Programs should use this function to replace an interrupt vector.
When a program installs a new interrupt handler, it should use Get Interrupt Vector (Function 35h) to retrieve the address of the original interrupt handler and restore this original address before terminating.
Function 35h Get Interrupt Vector