This article was previously published under Q76677
This article has been archived. It is offered "as is" and will no longer be updated.
MS-DOS determines the number and type of floppy drives on a system usingthe ROM BIOS services, called interrupts. The MS-DOS DEBUG utility can beused to "ask" the ROM BIOS for this information directly. This is helpfulin determining why MS-DOS may not be accessing a floppy drive or drivescorrectly.
It is possible that one version of MS-DOS might access a drive and anotherversion may not. Some hardware manufacturers modify their MS-DOS to ignorethe information returned from the ROM BIOS and rely on vendor-specificinformation about the drives.
Early versions of Microsoft MS-DOS make assumptions about theexistence of one or more floppy drives that might, coincidentally, becorrect. However, in Microsoft MS-DOS versions 4.0 and later, MS-DOScorrectly relies on the information reported by the ROM BIOS.
The following procedure uses function 8 of interrupt 13 to determinedisk parameters. The number of sectors per track and tracks isreturned, which correlates between the information returned and theparameters MS-DOS uses for the FORMAT utility. On AT and PS/2 systems, adrive type code is returned as well.
If the BIOS is not returning the correct drive information on an AT orPS/2 machine, it may indicate that the drive type has not been setproperly in the CMOS setup. On any machine, it may indicate that thedrive is not properly installed, or that the drive is not supported by theROM BIOS. For information about your ROM BIOS and whether you need toupgrade, contact your machine or BIOS manufacturer.
To start the DEBUG utility, type "debug" (without the quotation marks)at the command prompt and press ENTER. If at any time you wish to exitand start over, use the Q[uit] command to exit back to MS-DOS. It isrecommended that DEBUG not be used when other programs are active or in amultitasking environment such as Microsoft Windows.
DEBUGDisplays Enter To-------- ----- --- a 100 Begin entering commands at address 100XXXX:0100 int 13 Do an interrupt 13XXXX:0102 int 20 An interrupt 20 here (insurance)XXXX:0104 ENTER Press ENTER here- rip Display and modify the IP registerIP XXXX: 0100 Begin executing at 100- rax Display and modify AX registerAX 0000: 0800 Function 8 (get drive information)- rdx Display and modify DX registerDX 0000: <drive> Enter 0 for first floppy, 1 for second, and so on- p Process
At this point, DEBUG will execute the command at 0100, interrupt 13. TheROM BIOS routine will process interrupt 13, function 8, on the drive youspecified, and return some information in the registers. DEBUG will displaysomething like this:
AX=0000 BX=0002 CX=4F0F DX=0102 SP=FFEE BP=0000 SI=0000 DI=2115DS=0E77 ES=F000 SS=0E77 CS=0E77 IP=0102 OV UP EI NG NZ NA PO NC0E77:0102 CD20 INT 20
The name of each register is displayed, along with its current value.All values are in hexadecimal. Note that each X register can also beaddressed by its "high" and "low" halves; that is, if CX=4F0F, CH=4Fand CL=0F.
The flags register is displayed differently. The status of the flagsregister is the series of two-letter codes at the end of the secondline. Note the value of the last flag on the second line. If it is CY(CarrY), the carry flag was set by the BIOS, which means the interruptfailed. In this case, AX= an error value. See page 54 of the "IBM ROMBIOS Quick Reference" guide for information about these errors. If thelast flag is NC (no carry), the carry flag was not set, whichindicates that the interrupt worked correctly.
On AT and PS/2 systems, the low byte of the BX register (BL) willcontain the drive type 01 if 360, 02 if 1.2, 03 if 720, and 04 if1.44.
The maximum value for the last track on the drive is stored in CH: 27hexadecimal (39 decimal) if there are 40 tracks maximum, or 4Fh (79d)if there are 80 tracks. The maximum sector number is stored in CL: 9h(9d), Fh (15d), 12h (18d), or 24h (36d). Finally, the maximum headnumber is stored in DH; because floppies have two heads, this is 1.(The ROM BIOS numbers heads and tracks, or cylinders, from 0, andsectors from 1.)
Finally, DL indicates the number of floppy drives. Note that the valuereturned in DL (number of drives) is the number of floppy drivesattached to the disk controller for the specified drive. Normally,there is only one controller, and thus DL=the total number offloppies. However, if floppies A and B are attached to differentcontrollers, then DL=1 will be returned for each.
So, from the previous example (values unrelated to the drive type areindicated by xx):
AX=xxxx BX=xx02 CX=4F0F DX=0102 SP=xxxx BP=xxxx SI=xxxx DI=xxxxDS=xxxx ES=xxxx SS=xxxx CS=xxxx IP=xxxx xx xx xx xx xx xx xx NCxxxx:xxxx xxxx xxx xx
NC, so no error; BL = 02, so 1.2 MB; CH=4F, or 80 tracks; CL=0F, or 15sectors per track; DH=01, or 2 heads; DL=2, two drives. All of whichindicates that there are two drives on this system, and this particularfloppy drive is 1.2 MB.
"IBM ROM BIOS Quick Reference," Ray Duncan. Microsoft Press."QUE DOS Programmer's Reference," Terry Dettman. QUE Corporation.
Microsoft MS-DOS 4.0 Standard Edition, Microsoft MS-DOS 5.0 Standard Edition, Microsoft MS-DOS 6.0 Standard Edition, Microsoft MS-DOS 6.2 Standard Edition, Microsoft MS-DOS 6.21 Standard Edition, Microsoft MS-DOS 6.22 Standard Edition