Implement some syscall handling

This commit is contained in:
Nero 2020-04-13 13:53:21 +00:00
parent 6ba3e0c071
commit 39ef1f9a3e

View File

@ -1,7 +1,7 @@
cpu 8086 cpu 8086
org 0x7C00 org 0x7C00
stack: equ 0x7C00
stack: equ 0x7C00
framsz: equ 0x300 framsz: equ 0x300
jmp init jmp init
@ -68,23 +68,43 @@ getax: push ds
pop si pop si
ret ret
sftab: dw 0, 0, 0, 0 ; 00-03 ; No such subfunction - set carry and exit
dw 0, 0, 0, 0 ; 04-07 sferr: stc
dw 0, 0, 0, 0 ; 08-0b ret
dw 0, 0, 0, 0 ; 0c-0f
dw 0, 0, 0, 0 ; 10-13
dw 0, 0, 0, 0 ; 14-17
dw 0, 0, 0, 0 ; 18-1b
dw 0, 0, 0, 0 ; 1c-1f
dw 0, 0, 0, 0 ; 20-23
dw 0, dos25, 0, 0 ; 24-27
dw 0, 0, 0, 0 ; 28-2b
dw 0, 0, 0, 0 ; 2c-2f
; DOSINT 25h: Set interrupt vector ; Subfunction table
align 2
sftab: dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, setint, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
; DOS 25h: Set interrupt vector
; IN al interrupt number ; IN al interrupt number
; ds:dx entry point ; ds:dx entry point
dos25: setint: push ax
push bx
xor ah, ah
add al, al
add al, al
mov bx, ax
mov [cs:bx], dx
mov ax, ds
mov [cs:bx+2], ds
pop bx
pop ax
ret ret
; ===== end of resident, begin of transient startup code ; ===== end of resident, begin of transient startup code
@ -96,16 +116,13 @@ init: xor ax, ax
mov ss, ax mov ss, ax
xor sp, sp xor sp, sp
mov ax, 0x2521 mov al, 0x21
mov dx, int21h mov dx, int21h
pushf call setint
push cs
call int21h
mov ax, 0x2520 mov ax, 0x2520
mov dx, int20h mov dx, int20h
pushf call setint
push cs
call int21h
main: push cs main: push cs
pop ds pop ds
@ -120,5 +137,4 @@ loop: lodsb
end: hlt end: hlt
jmp end jmp end
align 2048
msg: db "rdos kernel stub", 0x0A, 0x0D, 0 msg: db "rdos kernel stub", 0x0A, 0x0D, 0