23 lines
373 B
NASM
23 lines
373 B
NASM
; Register a interrupt handler
|
|
; in: sp:bp+0 interrupt number
|
|
; +2 handler offset
|
|
; out: sp:bp+4
|
|
intr_register:
|
|
; use data stack
|
|
xchg sp, bp
|
|
; ES := 0
|
|
xor ax, ax
|
|
mov es, ax
|
|
; DI := intnum * 4
|
|
pop di
|
|
sal di, 1
|
|
sal di, 1
|
|
; copy offset from arguments
|
|
pop ax
|
|
stosw
|
|
; copy our segment
|
|
mov ax, cs
|
|
stosw
|
|
; use code stack
|
|
xchg sp, bp
|
|
ret |