Hi. I am trying to change an interrupt vector in assembly language to point to a new routine but can't quite figure out how to do it. I am trying to replace it as such:


  mov ah,0x0
  int 0x16


  mov ax,0x0
  mov es,ax
  mov di,Vector*4

  push cs
  pop ax
  mov ax,InterruptRoutine


Vector dw 80

This is just an example, I'm actually attempting to change interrupt vector 0x1c, the timer. I am writing this as standalone code as i am attempting to write a mini-os, and this code will run at system boot so i cant use dos to do this for me. is this the correct way of doing this? If so, why isn't the timer firing under my new code? I have no clue what is going on here. And is this the right way to find the segment for the routine or is there a better way?

You are indexing into the IVT when interrupts are enabled,
and the timer tick INT 8 calls INT 1c, and INT 8 is called
by external hardware.
This means the interrupt is being called while your changing
its interrupt vector.
Try disabling interrupts with a CLI instruction,
if under DOS use AH=25h SetIvt.

xor ax, ax
mov es, ax
mov word [es:70], handler ; offset of handler
mov [es:72], cs         ; seg of handler