Data Structure

The fundamental data structure is the disk address packet, which is based on an absolute sector number. It is up to the INT 13h implementation to convert this to physical parameters appropriate to the media.

disk_addr_pkt   struc
    packet_size     db     16       ; size of packet in bytes
    reserved        db      0       ; reserved, must be 0
    block_count     dw      ?       ; number of blocks to transfer
    buffer_addr     dd      ?       ; address of transfer buffer
    block_num       dq      ?       ; starting absolute block number
disk_addr_pkt   ends
 

Packet size is included in the structure to provide for future modifications. It contains the size of the address packet in bytes, including the size byte. For this version, it must always be set to 16. If packet size is not at least 16, then the request is rejected with (AH)=01h and CF=1. Packet sizes greater than 16 are not rejected by this version. The caller is responsible for understanding the level of support of any specific implementation before invoking an Int 13h extension.

Block count is, on input, the number of blocks to be transferred, and on output, the number of blocks actually transferred. A block count of 0 means 0 blocks will be transferred.

The buffer address is the 32-bit (segment:offset) address of the buffer to transfer data to or from.

Block number refers to the absolute block from the beginning of the disk, regardless of partitions. The first block is numbered 0. In general, it is assumed that block numbering goes in order of all blocks on a track, interleaved as appropriate, followed by all blocks on the following tracks in that cylinder in head order, followed by the first block on the first track of the next cylinder. This ordering is not intended to exclude remapping of bad tracks or blocks to other disk regions, or to prevent other optimizations based on location of consecutively numbered blocks.