Remove command line parsing from bootloader
This commit is contained in:
parent
e94059c625
commit
705cd5c725
2
Makefile
2
Makefile
@ -32,7 +32,7 @@ debug.rom: debug/*.asm lib/*.asm
|
||||
nasm -s -o $@ -I lib -I debug debug/main.asm && scripts/fix-rom.sh $@
|
||||
|
||||
boot/%.bs: boot/%.asm
|
||||
nasm -s -DFLOPPY=$(FLOPPY) -DCMDLINE='"KERNEL.COM"' -o $@ $<
|
||||
nasm -s -DFLOPPY=$(FLOPPY) -o $@ $<
|
||||
|
||||
programs/%.com: programs/%.asm
|
||||
nasm -s -I lib -o $@ $<
|
||||
|
55
boot/fat.asm
55
boot/fat.asm
@ -5,7 +5,6 @@
|
||||
%define psp (prog - 0x100)
|
||||
%define prog 0x07C00
|
||||
|
||||
%define filename (psp + 0x5C + 1)
|
||||
%define arguments (psp + 0x81)
|
||||
|
||||
org self
|
||||
@ -104,8 +103,6 @@ main:
|
||||
; clusters start after rootdir
|
||||
mov [cluster_offset], ax
|
||||
|
||||
call parse_cmdline
|
||||
|
||||
call load_file
|
||||
mov bp, 0x3332
|
||||
jc error
|
||||
@ -258,56 +255,8 @@ error:
|
||||
int 0x16
|
||||
int 0x19
|
||||
|
||||
parse_cmdline:
|
||||
mov si, cmdline
|
||||
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
|
||||
filename:
|
||||
db "KERNEL COM"
|
||||
|
||||
times (0x1FE - ($-$$)) db 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user