How to find the physical address of interrupts in interrupt vector table?

6.5k views Asked by At

How do i calculate the physical address of any given interrupt (INT22H or INT15H for instance) in the interrupt vector table for 8086 microprocessor?

1

There are 1 answers

0
Sep Roland On BEST ANSWER

...calculate the physical address of any given interrupt (INT22H or INT15H for instance) in the interrupt vector table...

  • Physical address where the int 15h instruction finds the far pointer that it should call.
    This is an offset within the Interrupt Vector Table, and so gives a physical address aka linear address from the list {0,4,8,12, ... , 1016,1020}.
    Since each vector is 4 bytes long, all it takes is multiplying the interrupt number by 4.

    mov  ax,0415h                  ;AL=Interrupt number, AH=4
    mul  ah                        ; -> Product in AX
    cwd                            ;(*) -> Result in DX:AX=[0,1023]
    

    (*) I like all my linear addresses expressed as DX:AX. That's why I used the seemingly unnecessary cwd instruction.

  • Physical address where int 15h ultimately gets handled.
    This can be anywhere in the 1MB memory. (On there's no memory beyond 1MB).
    Each 4 byte vector consists of an offset word followed by a segment word. The order is important.
    The linear address is calculated from multiplying the segment value by 16 and adding the offset value.

    mov  ax,16
    mul  word ptr [0015h * 4 + 2]  ;Segment in high word -> Product in DX:AX
    add  ax, [0015h * 4]           ;Offset in low word
    adc  dx, 0                     ; -> Result in DX:AX=[0,1048575]