OSD Home

Assembly-language disk functions using the BIOS

For information on using BIOS disk functions, see INT 13h in Ralf Brown's interrupt list: http://www.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html

C-language disk functions using the BIOS

With both DJGPP (32-bit code) and Turbo C (16-bit code), you may use int86() to access BIOS INT 13h. As with text output, 32-bit code requires a V86 mode monitor (VMM) to call 16-bit BIOS routines.

PC floppy drives

xxx - to do

ATA (IDE) hard drives

The '500-megabyte limit':
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

xxx - more

ATAPI (IDE) CD-ROM drives

xxx - to do

Code snippets

Direct probing of floppy disk sectors-per-track value: see bootstrap code snippets

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

Links

TO DO

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 ??

REPORT BUGS OR ERRORS IN THIS DOCUMENT