add ax, dx ; senctor number, into the master Table.
mov var_file_id, ax
call dumpax
mov WORD [DAPACK.db_addr_offset], lsfs_loading_buffer
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x1 ; Read to sectors, that is what the space is for the buffer in svim
@ -146,10 +157,9 @@ lsfs_write_file:
mov ah, 0x42 ; READ
mov dl, [global_disk_identifier]
int 0x13
pop bx
; Save the buffer addr
mov bx, var_file_buffer
mov WORD [DAPACK.db_addr_offset], bx
mov bx, [lsfs_loading_buffer + 288] ; this is the first data pointer
mov WORD [DAPACK.lba_addr_dw_low], bx
@ -157,10 +167,25 @@ lsfs_write_file:
mov WORD [DAPACK.blkcnt], 0x4 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [DAPACK.db_addr_segment], 0x50
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x43 ; READ
mov ah, 0x43 ; WRITE
mov dl, [global_disk_identifier]
int 0x13
mov ax, var_file_id
mov bx, var_file_size
mov [lsfs_loading_buffer + 264], bx
mov WORD [DAPACK.db_addr_offset], lsfs_loading_buffer
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x1 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [DAPACK.db_addr_segment], 0x50
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x43 ; WRITE
mov dl, [global_disk_identifier]
int 0x13
mov sp, bp
pop bp
popa
ret
@ -248,7 +273,7 @@ lsfs_create_file:
mov [.new_file_data_pointer], bx
mov ax, [lsfs_loading_buffer + 508]
mov [.to_write_fileindex], ax
mov [.to_write_fileindex_16_bit_part], ax
add DWORD [lsfs_loading_buffer + 510], 4 ; First save the data pointer, and then add 4 sectors to get the next free sectors.
add DWORD [lsfs_loading_buffer + 508], 1 ; Increment since we are creating a new file.
@ -272,7 +297,7 @@ lsfs_create_file:
mov bx, ds
mov es, bx
mov ax, [.to_write_fileindex] ; The number of files in the system
mov ax, [.to_write_fileindex_16_bit_part] ; The number of files in the system
add ax, LSFS_magic_start_sector ; The Master Record is at LSFS_magic_start_sector, plus the file index, then we have the sector where the file information has to be placed.
mov WORD [DAPACK.lba_addr_dw_low], ax
@ -291,12 +316,17 @@ lsfs_create_file:
.new_filename_buffer times 256 db 0
;.file_id:
.to_write_fileindex dw 2
.to_write_fileindex_16_bit_part dw 0
.to_write_fileindex dw 0, 0, 0
;.file_size
.new_file_size dw 4
.new_file_size dw 0, 0, 0
.new_file_size_16_bit_part dw 0
.ext_file_data dw 0, 0, 0, 0
.control_bits dw 0, 0, 0, 0
;.file_data_pointers
.new_file_data_pointer dw 0
times 250 db 0
times 222 db 0
lsfs_list_files_command:
; This function takes the adress of the first sector of the disk