Added interrupt handler

This commit is contained in:
Xnoe 2021-08-29 21:50:27 +01:00
parent fa15c6f6d9
commit 14fcc32d79
Signed by: xnoe
GPG Key ID: 45AC398F44F0DAFE
2 changed files with 37 additions and 22 deletions

View File

@ -2,28 +2,12 @@ mov ax, 3000h
mov ds, ax mov ds, ax
push hello_world_str push hello_world_str
call print mov ah, 01h
int 22h
;jmp $
retf retf
; print(str)
print:
push bp
mov bp, sp
mov si, [bp + 4]
mov ah, 0eh
mov cx, 1
mov bh, 0
print_loop:
lodsb
cmp al, 0
je print_exit
int 10h
jmp print_loop
print_exit:
pop bp
ret 2
hello_world_str db "Hello, World!", 13, 10, 13, 10, 0 hello_world_str db "Hello, World!", 13, 10, 13, 10, 0
buffer:
times 32 db 0

View File

@ -1,9 +1,16 @@
[BITS 16] [BITS 16]
; Update the IVT with our interrupt handler
mov bx, 0
mov ds, bx
mov word [ds:136], ihdlr
mov word [ds:138], cs
mov ax, 2000h mov ax, 2000h
mov ds, ax mov ds, ax
pop ax pop ax
mov byte [bootdisk], al mov byte [bootdisk], al
; Set up kernel specifics ; Set up kernel specifics
; Root Directory Entries will be at 2000h:2000h ; Root Directory Entries will be at 2000h:2000h
@ -365,3 +372,27 @@ decode_filename_final:
_decode_buffer: _decode_buffer:
times 11 db 0 times 11 db 0
ihdlr:
pop word [_ihdlr_stack0]
pop word [_ihdlr_stack1]
pop word [_ihdlr_stack2]
cmp ah, 01h
jne _ihdlr_2
call print
_ihdlr_2:
cmp ah, 02h
jne _ihdlr_3
call readline
_ihdlr_3:
push word [_ihdlr_stack2]
push word [_ihdlr_stack1]
push word [_ihdlr_stack0]
iret
_ihdlr_stack0 dw 0
_ihdlr_stack1 dw 0
_ihdlr_stack2 dw 0