当前位置: 技术问答>linux和unix
扩展磁盘中等Int 13h
来源: 互联网 发布时间:2014-10-20
本文导语: 大家好,我想在DOS下获得硬盘的参数,但老版本的Int 13H不支持8.4G以上的硬盘, 请问那位知道扩展Int13H的定义,或者那本书上有介绍。谢谢!|Get Drive Parameters Entry: AH - 48h DL - Drive number ...
大家好,我想在DOS下获得硬盘的参数,但老版本的Int 13H不支持8.4G以上的硬盘,
请问那位知道扩展Int13H的定义,或者那本书上有介绍。谢谢!
|
Get Drive Parameters Entry: AH - 48h DL - Drive number DS:SI - address of result buffer. Exit: carry clear AH - 0 DS:SI - result buffer carry set AH - error code Return physical device characteristics. This function is mandatory regardless of the interface subset which is supported. Bit Description 0 DMA boundary errors are handled transparently 1 The geometry supplied in bytes 8-12 is valid 2 Device is removable 3 Device supports write with verify 4 Device has change line support (bit 2 must be set) 5 Device is lockable (bit 2 must be set). 6 Device geometry is set to maximum, no media is present (bit 2 must be set). This bit is turned off when media is present in a removable media device. 7-15 Reserved, must be 0 Result Buffer Offset Type Description 0 Word Buffer Size, must be 26 or greater. The caller sets this value to the maximum buffer size. If the length of this buffer is less than 30, this functions does not return the pointer to the Enhanced Disk Drive structure (EDD). If the Buffer Size is 30 or greater on entry, it is set to exactly 30 on exit. If the Buffer Size is between 26 and 29, it is set to exactly 26 on exit. If the Buffer Size is less than 26 on entry an error is returned. 2 Word Information Flags In the following table, a 1 bit indicates that the feature is available, a 0 bit indicates the feature is not available and will operate in a manner consistent with the conventional Int 13h interface. 4 Double Word Number of physical cylinders. This is 1 greater than the maximum cylinder number. Use Int 13h Fn 08h to find the logical number of cylinders. 8 Double Word Number of physical heads. This is 1 greater than the maximum head number. Use Int 13h Fn 08h to find the logical number of heads. 12 Double Word Number of physical sectors per track. This number is the same as the maximum sector number because sector addresses are 1 based. Use Int 13h Fn 08h to find the logical number of sectors per track. 16 Quad Word Number of physical sectors. This is 1 greater than the maximum sector number. 24 Word Number of bytes in a sector. 26 Double Word Pointer to Enhanced Disk Drive (EDD) configuration parameters. This field is only present if Int 13h, Fn 41h, CX register bit 2 is enabled. This field points to a temporary buffer which the BIOS may re-use on subsequent Int 13h calls. A value of FFFFh:FFFFh in this field means that the pointer is invalid.
|
#include #include #include #include struct HARDISK { unsigned cyln; unsigned head; unsigned sect; unsigned cache; unsigned char s[21]; unsigned char v[9]; unsigned char t[40]; }; HARDISK hdinfor() { unsigned int i,j; unsigned char p; HARDISK xhdd; i=0;j=0;p=0; while (p!=0x40) {j++;if (j==0xffff) break; p=inportb(0x1f7); p&=0xc0; } outportb(0x3f6,0); for(i=0;i8); xhdd.v[i*2+1]=(unsigned char)j; } for (i=0;i>8); xhdd.t[i*2+1]=(unsigned char)j; } for(i=0;i
|
Get Drive Parameters Entry: AH - 48h DL - Drive number DS:SI - address of result buffer. Exit: carry clear AH - 0 DS:SI - result buffer carry set AH - error code Return physical device characteristics. This function is mandatory regardless of the interface subset which is supported. Bit Description 0 DMA boundary errors are handled transparently 1 The geometry supplied in bytes 8-12 is valid 2 Device is removable 3 Device supports write with verify 4 Device has change line support (bit 2 must be set) 5 Device is lockable (bit 2 must be set). 6 Device geometry is set to maximum, no media is present (bit 2 must be set). This bit is turned off when media is present in a removable media device. 7-15 Reserved, must be 0 Result Buffer Offset Type Description 0 Word Buffer Size, must be 26 or greater. The caller sets this value to the maximum buffer size. If the length of this buffer is less than 30, this functions does not return the pointer to the Enhanced Disk Drive structure (EDD). If the Buffer Size is 30 or greater on entry, it is set to exactly 30 on exit. If the Buffer Size is between 26 and 29, it is set to exactly 26 on exit. If the Buffer Size is less than 26 on entry an error is returned. 2 Word Information Flags In the following table, a 1 bit indicates that the feature is available, a 0 bit indicates the feature is not available and will operate in a manner consistent with the conventional Int 13h interface. 4 Double Word Number of physical cylinders. This is 1 greater than the maximum cylinder number. Use Int 13h Fn 08h to find the logical number of cylinders. 8 Double Word Number of physical heads. This is 1 greater than the maximum head number. Use Int 13h Fn 08h to find the logical number of heads. 12 Double Word Number of physical sectors per track. This number is the same as the maximum sector number because sector addresses are 1 based. Use Int 13h Fn 08h to find the logical number of sectors per track. 16 Quad Word Number of physical sectors. This is 1 greater than the maximum sector number. 24 Word Number of bytes in a sector. 26 Double Word Pointer to Enhanced Disk Drive (EDD) configuration parameters. This field is only present if Int 13h, Fn 41h, CX register bit 2 is enabled. This field points to a temporary buffer which the BIOS may re-use on subsequent Int 13h calls. A value of FFFFh:FFFFh in this field means that the pointer is invalid.
|
#include #include #include #include struct HARDISK { unsigned cyln; unsigned head; unsigned sect; unsigned cache; unsigned char s[21]; unsigned char v[9]; unsigned char t[40]; }; HARDISK hdinfor() { unsigned int i,j; unsigned char p; HARDISK xhdd; i=0;j=0;p=0; while (p!=0x40) {j++;if (j==0xffff) break; p=inportb(0x1f7); p&=0xc0; } outportb(0x3f6,0); for(i=0;i8); xhdd.v[i*2+1]=(unsigned char)j; } for (i=0;i>8); xhdd.t[i*2+1]=(unsigned char)j; } for(i=0;i