rdos/kernel/fcb.asm

71 lines
849 B
NASM
Raw Normal View History

2019-09-29 14:23:39 +02:00
; Parse ASCIIZ string into FCB
; IN SI ptr to filename
; BX ptr to FCB
fcb_parse:
push di
push ax
mov di, bx
2019-09-29 23:25:29 +02:00
xor ax, ax
stosb
2019-09-29 14:23:39 +02:00
.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:
2019-09-29 23:25:29 +02:00
dec si
2019-09-29 14:23:39 +02:00
pop ax
.ret:
pop ax
pop di
ret
2019-09-29 23:25:29 +02:00
fcb_open:
cmp byte [bx], 0
jne .drivedone
mov al, default_drive
inc al
mov [bx], al
.drivedone:
push bp
sub sp, bpb_size
mov bp, sp
mov dl, [bx]
dec dl
call bpb_load
mov ax, [bp]
mov cx, [bp+2]
mov dx, [bp+4]
mov bx, [bp+6]
add sp, bpb_size
pop bp
2019-09-29 14:23:39 +02:00
ret