热情软件屋

 

如何判断所使用的硬盘是IDE硬盘还是SCSI硬盘


编号:QA004706
建立日期: 2003年8月2日 最后修改日期:2003年8月2日
所属类别:

monitor_yhr:
    操作系统:DOS
    编程工具:汇编语言
    问题:在DOS环境下,使用汇编语言,如何判断所使用的硬盘是IDE硬盘还是SCSI硬盘?
    说明:计算机上只有一个硬盘,但类型不确定

回答:

    这个问题就是我提出的。我查找了许多关于中断的书籍,都没有提到这方面的问题。最近才在一个电子版的中断说明书中找到答案,这个说明书是英文的,非常详细的列出了几乎所有中断以及各种参数设置中断13h扩展功能,入口AH=48h,返回的参数当中有关于硬盘参数的详细说明。
    现将英文说明摘录如下:
    
    INT 13 - IBM/MS INT 13 Extensions - GET DRIVE PARAMETERS
     AH = 48h
     DL = drive (80h-FFh)
     DS:SI -> buffer for drive parameters (see #00273)
    Return: CF clear if successful
     AH = 00h
     DS:SI buffer filled
     CF set on error
     AH = error code
    BUGS: several different Compaq BIOSes incorrectly report high-numbered
     drives (such as 90h, B0h, D0h, and F0h) as present, giving them the
     same geometry as drive 80h; as a workaround, scan through disk
     numbers, stopping as soon as the number of valid drives encountered
     equals the value in 0040h:0075h
     Dell machines using PhoenixBIOS 4.0 Release 6.0 fail to correctly
     handle this function if the flag word at DS:[SI+2] is not 0000h
     on entry
    SeeAlso: AH=08h,AH=41h,AH=49h,MEM 0040h:0075h
    
    Format of IBM/MS INT 13 Extensions drive parameters:
    Offset Size Description (Table 00273)
     00h WORD (call) size of buffer
     (001Ah for v1.x, 001Eh for v2.x, 42h for v3.0)
     (ret) size of returned data
     02h WORD information flags (see #00274)
     04h DWORD number of physical cylinders on drive
     08h DWORD number of physical heads on drive
     0Ch DWORD number of physical sectors per track
     10h QWORD total number of sectors on drive
     18h WORD bytes per sector
    ---v2.0+ ---
     1Ah DWORD -> EDD configuration parameters (see #00278)
     FFFFh:FFFFh if not available
    ---v3.0 ---
     1Eh WORD signature BEDDh to indicate presence of Device Path info
     20h BYTE length of Device Path information, including signature and this
     byte (24h for v3.0)
     21h 3 BYTEs reserved (0)
     24h 4 BYTEs ASCIZ name of host bus ("ISA" or "PCI")
     28h 8 BYTEs ASCIZ name of interface type
     "ATA"
     "ATAPI"
     "SCSI"
     "USB"
     "1394" IEEE 1394 (FireWire)
     "FIBRE" Fibre Channel
     30h 8 BYTEs Interface Path (see #00275)
     38h 8 BYTEs Device Path (see #00276)
     40h BYTE reserved (0)
     41h BYTE checksum of bytes 1Eh-40h (two's complement of sum, which makes
     the 8-bit sum of bytes 1Eh-41h equal 00h)
    Note: if the size is less than 30 on call, the final DWORD will not be
     returned by a v2.x implementation; similarly for the Device Path info
    SeeAlso: #00277,#03196
    
    Bitfields for IBM/MS INT 13 Extensions information flags:
    Bit(s) Description (Table 00274)
     0 DMA boundary errors handled transparently
     1 cylinder/head/sectors-per-track information is valid
     2 removable drive
     3 write with verify supported
     4 drive has change-line support (required if drive >= 80h is removable)
     5 drive can be locked (required if drive >= 80h is removable)
     6 CHS information set to maximum supported values, not current media
     15-7 reserved (0)
    Note: bits 4-6 are only valid if bit 2 is set
    SeeAlso: #00273
    
    Format of EDD v3.0 Interface Path:
    Offset Size Description (Table 00275)
    ---ISA---
     00h WORD 16-bit base address
     02h 6 BYTEs reserved (0)
    ---PCI---
     00h BYTE PCI bus number
     01h BYTE PCI device number
     02h BYTE PCI function number
     03h 5 BYTEs reserved (0)
    SeeAlso: #00273,#00276
    
    Format of EDD v3.0 Device Path:
    Offset Size Description (Table 00276)
    ---ATA---
     00h BYTE flag: 00h = master, 01h = slave
     01h 7 BYTEs reserved (0)
    ---ATAPI---
     00h BYTE flag: 00h = master, 01h = slave
     01h BYTE logical unit number
     02h 6 BYTEs reserved (0)
    ---SCSI---
     00h BYTE logical unit number
     01h 7 BYTEs reserved (0)
    ---USB---
     00h BYTE to be determined
     01h 7 BYTEs reserved (0)
    ---IEEE1394---
     00h QWORD 64-bit FireWire General Unique Identifier (GUID)
    ---FibreChannel---
     00h QWORD Word Wide Number (WWN)
    SeeAlso: #00273,#00275
    
    Format of Phoenix Enhanced Disk Drive Spec translated drive parameter table:
    Offset Size Description (Table 00277)
     00h WORD number of cylinders
     02h BYTE number of heads
     03h BYTE A0h (signature indicating translated table)
     04h BYTE number of physical sectors per track
     05h WORD starting write precompensation cylinder number
     07h BYTE reserved
     08h BYTE control byte (see #03198 at INT 41"DISK 0")
     09h WORD number of physical cylinders
     0Bh BYTE number of physical heads
     0Ch WORD cylinder number of landing zone
     0Eh BYTE number of logical sectors per track
     0Fh BYTE checksum
    Program: the Phoenix Enhanced Disk Drive Specification is an addition to the
     IBM/MS INT 13 extensions
    SeeAlso: #00278,#03196
    
    Format of Phoenix Enhanced Disk Drive Spec Fixed Disk Parameter Table:
    Offset Size Description (Table 00278)
     00h WORD physical I/O port base address
     02h WORD disk-drive control port address
     04h BYTE drive flags (see #00279)
     05h BYTE proprietary information
     bits 7-4 reserved (0)
     bits 3-0: Phoenix proprietary (used by BIOS)
     06h BYTE IRQ for drive (bits 3-0; bits 7-4 reserved and must be 0)
     07h BYTE sector count for multi-sector transfers
     08h BYTE DMA control
     bits 7-4: DMA type (0-2) as per ATA-2 specification
     bits 3-0: DMA channel
     09h BYTE programmed I/O control
     bits 7-4: reserved (0)
     bits 3-0: PIO type (1-4) as per ATA-2 specification
     0Ah WORD drive options (see #00280)
     0Ch 2 BYTEs reserved (0)
     0Eh BYTE extension revision level (high nybble=major, low nybble=minor)
     (currently 10h for v1.0 and 11h for v1.1-3.0)
     0Fh BYTE 2's complement checksum of bytes 00h-0Eh
     8-bit sum of all bytes 00h-0Fh should equal 00h
    Note: this structure is also called the Device Paramter Table Extension
     (DPTE)
    SeeAlso: #00277
    
    Bitfields for Phoenix Enhanced Disk Drive Spec drive flags:
    Bit(s) Description (Table 00279)
     7 reserved (1)
     6 LBA enabled
     5 reserved (1)
     4 drive is slave
     3-0 reserved (0)
    SeeAlso: #00278,#00280
    
    Bitfields for Phoenix Enhanced Disk Drive Spec drive options:
    Bit(s) Description (Table 00280)
     0 fast PIO enabled
     1 fast DMA access enabled
     2 block PIO (multi-sector transfers) enabled
     3 CHS translation enabled
     4 LBA translation enabled
     5 removable media
     6 ATAPI device (CD-ROM)
     7 32-bit transfer mode
    ---v1.1+ ---
     8 ATAPI device uses DRQ to signal readiness for packet command
     (must be 0 if bit 6 is 0)
     10-9 translation type (must be 00 if bit 3 is 0)
     00 Phoenix bit-shifting translation
     01 LBA-assisted translation
     10 reserved
     11 proprietary translation
    ---v3.0---
     11 Ultra DMA access enabled
     15-12 reserved (0)

此问题由monitor_yhr回答。

附加关键字:编程, 源程序, programming, source code, 其他语言, asm, vba, vbscript, 磁盘、文件和目录, disk, file, fat, directory, folder

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio