Microsoft KB Archive/39311

From BetaArchive Wiki

Use 0x80 to Access Drive C when Calling _bios_disk()


5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a 6.00ax | 1.00 MS-DOS | OS/2 | WINDOWS kbprg

The information in this article applies to:

  • The C Run-Time (CRT), included with:
    • Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, 6.0ax
    • Microsoft C for OS/2, versions 5.1, 6.0, 6.0a
    • Microsoft C/C++ for MS-DOS, version 7.0
    • *EDITOR Please do not choose this product*Microsoft Visual C++ for Windows* use 1699 1.0


The first floppy drive in a computer is identified as drive 0, with additional floppy drives numbered sequentially. However, the first fixed disk is identified as drive 0x80 (128 decimal) with additional partitions numbered sequentially. Therefore, call _bios_disk() with the drive parameter set to 0x80 to access the first fixed disk. Note that the BIOS accesses physical disks, and is not aware of the logical MS-DOS disk partitions. If you have logical drives C and D, they would both be accessed by the _bios_disk() function as drive 0x80.

The following is an example:

   Physical Drive
   --------------   --------------
         A                 0
         B                 1
         C                0x80
         D                0x81
         E                0x82
         .                 .
         .                 .
         .                 . 


The _bios_disk() function calls BIOS interrupt 13h. For more information on this interrupt Peter Norton's "Programmer's Guide to the IBM PC and PS/2" (Microsoft Press), Chapter 10, is a good reference. The reason the fixed disks start at 0x80h is that a 1 in the high order bit of the drive designator byte indicates a fixed disk.

Additional query words: kbinf

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbCRT

Last Reviewed: February 26, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.