Add basic 21h functions

This commit is contained in:
Nero 2019-09-05 22:24:39 +00:00
parent b1e9b75693
commit 4fa383bb2e
2 changed files with 44 additions and 11 deletions

18
kernel/chario.asm Normal file
View File

@ -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

View File

@ -52,16 +52,6 @@ optrom_init:
retf retf
putc:
push bx
push cx
mov ah, 0x0e
mov bx, 0x0000
int 0x10
pop cx
pop bx
ret
announce: announce:
push ds push ds
push cs push cs
@ -87,16 +77,41 @@ start:
call drvtab_create 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 cli
.halt: .halt:
hlt hlt
jmp .halt 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 "intr.asm"
%include "drvtab.asm" %include "drvtab.asm"
%include "chario.asm"
%include "printf.inc" %include "printf.inc"
%include "print.asm" %include "print.asm"