diff --git a/kernel/chario.asm b/kernel/chario.asm new file mode 100644 index 0000000..8993cd1 --- /dev/null +++ b/kernel/chario.asm @@ -0,0 +1,18 @@ +putc: + pushf + push cs + call isr_putc + ret + +isr_getc: + xor ax, ax + int 0x16 + test al, al + jz isr_getc +isr_putc: + push bx + mov ah, 0x0e + mov bx, 0x0000 + int 0x10 + pop bx + iret diff --git a/kernel/main.asm b/kernel/main.asm index d5dae45..6c91443 100644 --- a/kernel/main.asm +++ b/kernel/main.asm @@ -52,16 +52,6 @@ optrom_init: retf -putc: - push bx - push cx - mov ah, 0x0e - mov bx, 0x0000 - int 0x10 - pop cx - pop bx - ret - announce: push ds push cs @@ -87,16 +77,41 @@ start: call drvtab_create - int3 + push cs + pop es + mov di, isr_dos_main + mov ax, 0x21 + call intr_register + +.loop: + mov ah, 0x01 + int 0x21 + jmp .loop cli .halt: hlt jmp .halt +isr_dos_main: + cmp ah, 0x01 + je isr_getc + cmp ah, 0x02 + je isr_putc +isr_error: + push bp + mov bp, sp + ; set carry flag + or WORD [SS:BP+6], 1 + pop bp +isr_return: + iret + %include "intr.asm" %include "drvtab.asm" +%include "chario.asm" + %include "printf.inc" %include "print.asm"