2019-05-02 22:14:31 +02:00
|
|
|
; Register a interrupt handler
|
2019-09-01 15:48:28 +02:00
|
|
|
; in: AL interrupt number
|
|
|
|
; ES:DI far ptr to routine/data
|
2019-05-02 22:14:31 +02:00
|
|
|
intr_register:
|
2019-09-01 15:48:28 +02:00
|
|
|
; backup original values
|
|
|
|
push ax
|
|
|
|
push es
|
|
|
|
push di
|
|
|
|
|
|
|
|
; pop as ax later
|
|
|
|
push es
|
|
|
|
push di
|
|
|
|
|
|
|
|
; DI = AL * 4
|
|
|
|
mov ah, 4
|
|
|
|
mul ah
|
|
|
|
mov di, ax
|
|
|
|
|
|
|
|
; ES = 0
|
2019-03-31 22:54:51 +02:00
|
|
|
xor ax, ax
|
2019-05-02 22:14:31 +02:00
|
|
|
mov es, ax
|
2019-09-01 15:48:28 +02:00
|
|
|
|
|
|
|
; store offset
|
2019-05-02 22:14:31 +02:00
|
|
|
pop ax
|
|
|
|
stosw
|
2019-09-01 15:48:28 +02:00
|
|
|
|
|
|
|
; store segment
|
|
|
|
pop ax
|
2019-05-02 22:14:31 +02:00
|
|
|
stosw
|
2019-09-01 15:48:28 +02:00
|
|
|
|
|
|
|
pop di
|
|
|
|
pop es
|
|
|
|
pop ax
|
|
|
|
ret
|
2019-09-01 16:05:40 +02:00
|
|
|
|
|
|
|
; Get address for a interrupt vector
|
|
|
|
; in AL interrupt number
|
|
|
|
; out DS:SI far ptr to routine/data
|
|
|
|
intr_load:
|
|
|
|
push ax
|
|
|
|
|
|
|
|
; SI = AL * 4
|
|
|
|
mov ah, 4
|
|
|
|
mul ah
|
|
|
|
mov si, ax
|
|
|
|
|
|
|
|
; ES = 0
|
|
|
|
xor ax, ax
|
|
|
|
mov ds, ax
|
|
|
|
|
|
|
|
; load offset
|
|
|
|
lodsw
|
|
|
|
mov si, ax
|
|
|
|
|
|
|
|
; load segment
|
|
|
|
lodsw
|
|
|
|
mov ds, ax
|
|
|
|
|
|
|
|
pop ax
|
|
|
|
ret
|