WIP for config.sys parsing

This commit is contained in:
Nero 2019-09-25 20:45:50 +00:00
parent 80a7b03ddc
commit 2c2720323c
4 changed files with 56 additions and 1 deletions

View File

@ -1,7 +1,7 @@
FLOPPY = 360
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard programs/*.asm))
DISTFILES = rdos.sys $(PROGRAMS)
DISTFILES = rdos.sys kernel/rconfig.sys $(PROGRAMS)
ROMS =
QEMU_ARCH = $(shell uname -m)

51
kernel/config.asm Normal file
View File

@ -0,0 +1,51 @@
config_tokens:
.buffers:
db 8, "BUFFERS="
.drives:
db 7, "DRIVES="
.files:
db 6, "FILES="
.none:
db 0
; IN SI offset of needle
; DI offset to haystack table
; OUT DI found offset in table
; ZF zero flag set if match
config_search_token:
push bp
push cx
.loop:
cmp BYTE [di], 0
je .fail
push si
push di
mov bp, di
xor ch, ch
mov cl, [di]
inc di
add bp, cx
inc bp
repe cmpsb
pop di
pop si
je .end
mov di, bp
jmp .loop
.fail:
stc
.end:
pop cx
pop cx
ret
config_parse_int:
ret
; IN BX offset to config data
config_first_run:
mov si, bx
mov di, config_tokens
call config_search_token
int3
ret

View File

@ -38,6 +38,8 @@ init:
mov ds, ax
mov es, ax
call config_first_run
mov di, kernel_end
call drive_setup
@ -56,5 +58,6 @@ init:
hlt
jmp .halt
%include "config.asm"
kernel_end:

1
kernel/rconfig.sys Normal file
View File

@ -0,0 +1 @@
DRIVES=4