This is quite complex. The command INT 02 causes the CPU to retrieve the contents of RAM location 02. After saving the return address onto the stack, the instruction pointer IP is set to this address.
The interrupt code is then executed. When complete the IRET command causes the return from the interrupt. The CPU instruction pointer IP is set to the address that was saved onto the stack earlier.
Trapping an Interrupt
If you wan to trap interrupt 02, change the address stored at address 02 to point to code that you have written. Your code will then handle the interrupt. When complete, your code can use IRET to return from the interrupt or it can jump to the address that was originally in address 02. This causes the original interrupt code to be executed as well. In this way, you can replace or modify the behaviour of an interrupt.
Share with your friends: |