delorie.com/djgpp/doc/libc/libc_71.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

biosdisk

Syntax

 
#include <bios.h>

int biosdisk(int cmd, int drive, int head, int track,
	     int sector, int nsects, void *buffer);

Description

This function interfaces with the BIOS disk service (interrupt 0x13). Please refer to a BIOS reference manual for detailed information about the parameters of this call. The function assumes a sector size of 512 bytes.

The following functions of Int 13h are currently supported:

0 - reset disk subsystem
1 - get status of last operation (see _bios_disk, for possible values)
2 - read one or more sectors
3 - write one or more sectors
5 - format a track
6 - format a cylinder and set bad sector flag
7 - format drive from specified cylinder
8 - get drive parameters
9 - initialize drive parameters
10 - read long sectors
11 - write long sectors
12 - seek to cylinder
13 - alternate fixed disk reset
14 - read sector buffer
15 - write sector buffer
16 - test for drive ready
17 - recalibrate drive
18 - controller RAM diagnostic
19 - controller drive diagnostic
20 - controller internal diagnostic
21 - get DASD type
22 - read disk change line status
23 - set DASD type (pass DASD code in nsects)
24 - set media type for format

The first request with more sectors than will fit in the transfer buffer will cause a DOS buffer to be allocated. This buffer is automatically freed when your application exits. Requests for more sectors than 18 sectors (9K) will fail.

Function 8 returns values in buffer as follows:

byte 0 = sectors per track (bits 0..5), top two bits of cylinder (in bits 6..7)
byte 1 = cylinders (bits 0..7)
byte 2 = number of drives
byte 3 = number of heads

Return Value

The value of AH returned by the BIOS. See _bios_disk, for a detailed list of possible status and error codes.

Portability

ANSI/ISO C No
POSIX No

Example

 
char buffer[512];
if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
  error("disk");


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004