From de90b9cfd17b7a2e52aec22b4c0fffeb165e371f Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Sun, 1 Sep 2019 14:05:40 +0000 Subject: [PATCH] Routine for loading far ptr from IVT --- kernel/intr.asm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/kernel/intr.asm b/kernel/intr.asm index e08b764..2dbfa60 100644 --- a/kernel/intr.asm +++ b/kernel/intr.asm @@ -32,3 +32,29 @@ intr_register: pop es pop ax ret + +; 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