Embedded C interview question - how to initialize the interrupt vector table ?

Embedded C interview question

How to initialize the interrupt vector table ?

To make the interrupts work, we must: 

  • Make sure that the Interrupt Vector Table is in the right place and that the Vector Base Register points to it. 
  • Set up each interrupt source to generate an interrupt when the proper special conditions arise. 
  • Set the Interrupt Mask Register so that the expected interrupts are not masked out. 
  • Set the Interrupt Priority Mask in the Status Register low enough the interrupt request is not inhibited 

For initialize the interrupt vector table... (W.r.t 8259 Operation) 

mov ax, 0 
mov es, ax 
mov di, 20h 
mov ax, offset int_service_0 
mov ax, cs 

The program should have a procedure int_service_0. 

mov ax, offset int_service_0 

This can move the offset of this procedure into AX 

mov ax, cs 

This moves your CS value into AX 

Hereby, we have put the offset address of int_service_0 into address 20h(i.e. 32d) and CS into address 22h. When INT 8 is called, then the offset of int_service_0 will be fetched into IP and CS will be fetched into CS. Then 8088 will go to run int_service_0.

No comments:

Post a comment