diff --git a/Makefile b/Makefile index 708b11c..4f754bb 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/kernel/config.asm b/kernel/config.asm new file mode 100644 index 0000000..5be6029 --- /dev/null +++ b/kernel/config.asm @@ -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 diff --git a/kernel/main.asm b/kernel/main.asm index e7d476c..873c448 100644 --- a/kernel/main.asm +++ b/kernel/main.asm @@ -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: diff --git a/kernel/rconfig.sys b/kernel/rconfig.sys new file mode 100644 index 0000000..eab075f --- /dev/null +++ b/kernel/rconfig.sys @@ -0,0 +1 @@ +DRIVES=4