Change interrupt in 16-bit mode

I am trying to modify an interrupt table to abort a keyboard interrupt. My ultimate goal is to write my new interrupt routine, copy myself to RAM and make a real-mode interrupt table for me.

I found a random code example on the Internet, but there is no explanation on how to get the address of the original interrupt. They just have variables in place and how to put themselves in memory.

So my question is: how do I determine or print on the screen a table of interruptions of real mode?

AND / OR, if someone has some good code examples for this to disable certain keys or the beep on certain keys, I would really appreciate it.

Thanks!

+3
source share
2 answers

In 16-bit real mode, the interrupt table starts at address 0, with 256 bytes. Each of the 256 interrupt vectors receives a 4-byte address (segment + offset) in this table.

http://en.wikipedia.org/wiki/Interrupt_descriptor_table contains more detailed information.

+4
source

If your program is running under DOS, you can (and probably should) use the API provided by DOS:

  MOV  AH,35H    ; function 35H is Get Vector
  MOV  Al,9      ; slot in IDT for keyboard interrupt
  INT  21H       ; call DOS, contents of old vector in ES:BX (save them somewhere)
   .
   .
  MOV  AH,25H    ; function 25H is Set Vector
  MOV  AL,9
  PUSH CS        ; the new vector is passed in DS:DX, so copy CS to DS
  POP  DS        :  (assuming your new handler is in the same seg as other code)
  MOV  DX,NewHandler
  INT 21H
+2
source

Source: https://habr.com/ru/post/1720926/


All Articles