|
|
|
int disk_service_read_data_from_disk(index, file_block_size, data_buffer, data_buffer_segment)
|
|
long* index;
|
|
long file_block_size;
|
|
void* data_buffer;
|
|
int data_buffer_segment;
|
|
{
|
|
//fseek ( disk, (index * SECTOR_SIZE ), SEEK_SET ); // SEEK_SET start offset at index 0 and move 1 * SECTOR_SIZE, and write here.
|
|
//int read = fread(data_buffer, 1, (file_block_size * SECTOR_SIZE), disk);
|
|
//return read;
|
|
#asm
|
|
lsfs_load_data:
|
|
mov dl, [global_disk_identifier]
|
|
mov WORD [DAPACK.lba_addr_dw_low], ax
|
|
mov WORD [DAPACK.blkcnt], 0x01
|
|
mov WORD [DAPACK.db_addr_segment], bx
|
|
mov WORD [DAPACK.db_addr_offset], FSCI
|
|
mov si, DAPACK ; address of "disk address packet"
|
|
mov ah, 0x42 ; READ
|
|
mov dl, [global_disk_identifier]
|
|
int 0x13
|
|
|
|
DAPACK:
|
|
.dap_Size: db 0x10 ; This is always 16 bytes (0x10)
|
|
.rev_byte: db 0x0 ; reserved byte, should always be zero
|
|
.blkcnt: dw 0x0 ; int 13 resets this to # of blocks actually read/written
|
|
.db_addr_offset: dw 0x0 ; memory buffer destination address (0:7c00)
|
|
.db_addr_segment: dw 0x0 ; in memory page zero
|
|
.lba_addr_dw_low: dd 0x0 ; put the lba to read in this spot
|
|
.lba_addr_dw_high: dd 0x0 ; more storage bytes only for big lba's ( > 4 bytes )
|
|
#endasm
|
|
|
|
}
|