Cylinders | Heads | Sectors | Total sectors | Megabytes (assuming 512 bytes/sector) | |
---|---|---|---|---|---|
Limits of ATA hardware interface | 65536 | 16 | 255 | ~228 | 130560 (127.5 Gbytes) |
Limits of INT 13h AH=02h/03h | 1024 | 256 | 63 | ~224 | 8064 (7.8 Gbytes) |
Combined limits | 1024 | 16 | 63 | ~220 | 504 |
Code for sector-level disk I/O under different OSes.
Get number of drives known to the BIOS:
unsigned num_hds, num_fds; num_hds = peekb(0x40, 0x75); /* byte at linear address 0x475 */ num_fds = peekw(0x40, 0x10); /* 16-bit word at linear address 0x410 */ if(num_fds & 0x0001) num_fds = ((num_fds / 64) & 3) + 1; else num_fds = 0;
Detect ATA drives without using the BIOS
floppy: Spec sheets for controller chips (e.g. Intel 8272, 82077), registers, commands, error recovery, INT 13h BIOS calls, other...? ATA: Registers, commands, error recovery, CHS vs. LBA, CHS translation for drives >512M, INT 13h BIOS calls, partitions, other...? ATAPI: ATAPI packet layout, commands, error recovery, audio vs. data CDs, other...? SCSI ??