Added interrupt handler
This commit is contained in:
parent
fa15c6f6d9
commit
14fcc32d79
26
hello.asm
26
hello.asm
@ -2,28 +2,12 @@ mov ax, 3000h
|
||||
mov ds, ax
|
||||
|
||||
push hello_world_str
|
||||
call print
|
||||
|
||||
;jmp $
|
||||
mov ah, 01h
|
||||
int 22h
|
||||
|
||||
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
|
||||
|
||||
buffer:
|
||||
times 32 db 0
|
31
kernel.asm
31
kernel.asm
@ -1,9 +1,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 ds, ax
|
||||
|
||||
pop ax
|
||||
mov byte [bootdisk], al
|
||||
|
||||
; Set up kernel specifics
|
||||
|
||||
; Root Directory Entries will be at 2000h:2000h
|
||||
@ -365,3 +372,27 @@ decode_filename_final:
|
||||
|
||||
_decode_buffer:
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user