From d5ba0f3e309fd19064d28ff57b9883ec56dfcdca Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Tue, 10 Sep 2019 21:50:58 +0000 Subject: [PATCH] Remove intr function not in line with int 21h If we have them, use them for setting up ourselves --- kernel/intr.asm | 56 ------------------------------------------------- kernel/main.asm | 19 ++++++++++------- 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/kernel/intr.asm b/kernel/intr.asm index 21419c2..bca094e 100644 --- a/kernel/intr.asm +++ b/kernel/intr.asm @@ -28,59 +28,3 @@ isr_intr_register: pop es iret - -; Register a interrupt handler -; in: AL interrupt number -; ES:DI far ptr to routine/data -intr_register: - ; 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 - xor ax, ax - mov es, ax - - ; store offset - pop ax - stosw - - ; store segment - pop ax - stosw - - pop di - 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 - - ; DS = 0 - xor ax, ax - mov ds, ax - - ; load segment and offset in one go - lds si, [si] - - pop ax - ret diff --git a/kernel/main.asm b/kernel/main.asm index d48c4ff..8572ec3 100644 --- a/kernel/main.asm +++ b/kernel/main.asm @@ -7,10 +7,12 @@ isr_dos_main: je isr_getc_echo cmp ah, 0x02 je isr_putc + cmp ah, 0x25 + je isr_intr_register jmp isr_invalid -%include "chario.asm" %include "intr.asm" +%include "chario.asm" %include "cache.asm" @@ -32,14 +34,15 @@ isr_return: iret init: - push cs - pop es - mov di, isr_dos_main - mov ax, 0x21 - call intr_register + mov ax, cs + mov ds, ax + mov es, ax - mov di, kernel_end - call cache_init + mov dx, isr_dos_main + mov ax, 0x2521 + pushf + push cs + call isr_dos_main int3