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
|
mov ds, ax
|
||||||
|
|
||||||
push hello_world_str
|
push hello_world_str
|
||||||
call print
|
mov ah, 01h
|
||||||
|
int 22h
|
||||||
;jmp $
|
|
||||||
|
|
||||||
retf
|
retf
|
||||||
|
|
||||||
; print(str)
|
hello_world_str db "Hello, World!", 13, 10, 13, 10, 0
|
||||||
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
|
33
kernel.asm
33
kernel.asm
@ -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
|
||||||
@ -364,4 +371,28 @@ decode_filename_final:
|
|||||||
ret 2
|
ret 2
|
||||||
|
|
||||||
_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
|
Loading…
x
Reference in New Issue
Block a user