rdos/lib/fcbparse.asm
2020-03-01 12:03:35 +00:00

47 lines
557 B
NASM

; Parse ASCIIZ string into FCB
; IN SI ptr to filename
; BX ptr to FCB
fcb_parse:
push di
push ax
mov di, bx
xor ax, ax
stosb
.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 .ret
stosb
jmp .base_loop
.ext_start:
mov di, bx
add di, 9
.ext_loop:
call .read
cmp al, 0x20
je .ret
stosb
jmp .ext_loop
.read:
lodsb
test al, al
jz .eret
cmp al, 0x0D
je .eret
ret
.eret:
dec si
pop ax
.ret:
pop ax
pop di
ret