kernel: wip

This commit is contained in:
Nero 2019-03-31 20:54:51 +00:00
parent 59f769d530
commit fa6e624604
2 changed files with 46 additions and 21 deletions

View File

@ -1,23 +1,15 @@
; out ds:si copy of interrupt table
ivt_backup:
push ax
push cx
push di ; backup original value
push ds
mov ax, 0x80
call malloc
push di
mov cx, 0x80
mov ax, cs
push es
xor ax, ax
mov ds, ax
mov es, ax
mov si, 0x0000
mov ds, si
rep movsb
pop si ; this was di after malloc
mov si, ax
mov di, 0x0100 ; int 0x40 address
mov cx, 0x0040 ; 0x20 interrupts * 2 words
repe movsw
pop es
pop ds
pop di ; restore original di
pop cx
pop ax
ret
; set item in interrupt vector table
@ -34,7 +26,7 @@ ivt_set:
sal bx,1
mov [es:bx], dx
mov [es:bx+2], ds
mov [es:bx+2], cs
pop ax
pop es

View File

@ -4,18 +4,51 @@ org 0x0000
_startup:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x0000
main:
mov ax, cs
xor ax, ax
mov ds, ax
mov si, ax
mov cx, ax
call heap_init
call ivt_backup
call debug_init
int 0x2E
call ivt_backup
xor ax, ax
mov ds, ax
mov es, ax
xor cx, cx
mov si, ax
.loop:
mov ax, cx
call kprint8
mov al, '='
call kputc
lodsw
xchg ax, dx
lodsw
call kprint16
mov al, ':'
call kputc
xchg ax, dx
call kprint16
mov al, ' '
call kputc
inc cx
test cx, 0x0003
jnz .loop
mov al, 0x0A
call kputc
mov al, 0x0D
call kputc
cmp cx, 0x0060
jl .loop
.halt:
hlt
jmp .halt