Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Initialize timer interrupt handler
- ;push ax
- ;push dx
- mov ah, 35h
- mov al, TIMER_INT
- int 21h ; Now we have an address of this interrupt handler in bx
- ; since IVT starts at 0x00, bx, an offset, has a definitive address to 1CH handler
- cli
- mov word ptr [TIMER_INT_ADDR], bx ; move address of 1Ch to TIMER_INT_ADDR | Point the 1Ch IP to the TIMER_INT_ADDR.
- mov ax, es
- mov word ptr TIMER_INT_ADDR[2], ax ; move code segment of the 1Ch int to the addr+2bytes (each entry in IVT is 2 words wide)
- mov ax, seg handle_timer ; new code segment for the interrupt
- mov ds, ax
- mov dx, offset handle_timer
- mov ah, 25h
- mov al, TIMER_INT
- int 21h
- sti ; Ok now we set new address of the 1Ch interrupt handler. Effectively,
- ; it should be DS(handle_timer):DX(offset of handle_timer), so whenever
- ; 1CH is called, it goes to handle_timer
- handle_timer:
- cli
- inc [timer_count]
- sti
- iret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement