Remove command line parsing from bootloader

This commit is contained in:
Nero 2019-09-23 20:25:39 +00:00
parent e94059c625
commit 705cd5c725
2 changed files with 3 additions and 54 deletions

View File

@ -32,7 +32,7 @@ debug.rom: debug/*.asm lib/*.asm
nasm -s -o $@ -I lib -I debug debug/main.asm && scripts/fix-rom.sh $@ nasm -s -o $@ -I lib -I debug debug/main.asm && scripts/fix-rom.sh $@
boot/%.bs: boot/%.asm boot/%.bs: boot/%.asm
nasm -s -DFLOPPY=$(FLOPPY) -DCMDLINE='"KERNEL.COM"' -o $@ $< nasm -s -DFLOPPY=$(FLOPPY) -o $@ $<
programs/%.com: programs/%.asm programs/%.com: programs/%.asm
nasm -s -I lib -o $@ $< nasm -s -I lib -o $@ $<

View File

@ -5,7 +5,6 @@
%define psp (prog - 0x100) %define psp (prog - 0x100)
%define prog 0x07C00 %define prog 0x07C00
%define filename (psp + 0x5C + 1)
%define arguments (psp + 0x81) %define arguments (psp + 0x81)
org self org self
@ -104,8 +103,6 @@ main:
; clusters start after rootdir ; clusters start after rootdir
mov [cluster_offset], ax mov [cluster_offset], ax
call parse_cmdline
call load_file call load_file
mov bp, 0x3332 mov bp, 0x3332
jc error jc error
@ -258,56 +255,8 @@ error:
int 0x16 int 0x16
int 0x19 int 0x19
parse_cmdline: filename:
mov si, cmdline db "KERNEL COM"
mov di, filename
.cleanout:
push di
mov cx, 0x0A
mov al, 0x20
rep stosb
pop di
.base_loop:
call .read
cmp al, 0x2E
je .ext_start
cmp al, 0x20
je .args_start
stosb
jmp .base_loop
.ext_start:
mov di, (filename + 8)
.ext_loop:
call .read
cmp al, 0x20
je .args_start
stosb
jmp .ext_loop
.args_start:
mov di, (psp + 0x81)
.args_loop:
lodsb
test al, al
jz .args_end
stosb
jmp .args_loop
.args_end:
mov ax, di
sub ax, (psp + 0x81)
mov [psp+0x80], al
mov al, 0x0D
stosb
ret
.read:
lodsb
test al, al
jnz .ret
pop ax
.ret:
ret
cmdline:
db CMDLINE, 0
times (0x1FE - ($-$$)) db 0 times (0x1FE - ($-$$)) db 0