Page 1 of 1
Check available physical drives using BIOS int 13H
Posted: Fri Dec 11, 2015 12:47 pm
by EvolSoft
Hi all, we've got another question about some problems with BIOS Disk I/O
Currently we wrote a simple function which converts logical drive letters (from A to Z) to the phyisical drive and then checks if it is available using BIOS int 13h function AH=04h (For A and B letters the equivalent physical drive is 00h and 01h then from letter C to letter Z the equivalent physical drive is 80H, etc...)
The function seems to work but on Bochs console there are some error logs.
- Bochs Console Errors
So is there a better way to check BIOS available Physical Drives without seeing these errors?
Re: Check available physical drives using BIOS int 13H
Posted: Fri Dec 11, 2015 1:35 pm
by Brendan
Hi,
EvolSoft wrote:So is there a better way to check BIOS available Physical Drives without seeing these errors?
Use
"int 0x13, ah = 0x08, Get Drive Parameters" to find out how many hard drives there are, and to check the validity of each (floppy and hard) drive.
Cheers,
Brendan
Re: Check available physical drives using BIOS int 13H
Posted: Fri Dec 11, 2015 1:56 pm
by TightCoderEx
The equipment word bits 7 & 6 @ 0:410H will also indicate how many floppies are installed and @ 0:475H the number of fixed disks. I haven't investigated it toughly, but I believe there is more detailed information in SMBIOS also.
Re: Check available physical drives using BIOS int 13H
Posted: Sat Dec 12, 2015 3:30 am
by BrightLight
To detect floppy drives, simply do this:
Code: Select all
mov ah, 8
mov dl, 0 ; or 1 for the second floppy drive
int 0x13
jc NoFloppy
Do the same with hard drives, replacing 0 with 0x80. Notice that Bochs' console will show errors when the drive is not present. So if you have two hard drives, numbered 0x80 and 0x81, an error will display when you try to detect 0x82.
EDIT: I just noticed that Bochs' console log messages clearly say that the last possible hard disk is 0x87. So you can access a total of 2 floppy disks and 8 hard disks through BIOS, which is
way more than enough.
Re: Check available physical drives using BIOS int 13H
Posted: Sat Dec 12, 2015 11:05 am
by EvolSoft
Thanks, we solved getting the number of hard disks from BIOS data area (0x40:0x75) and then we stopped the function loop when that number was reached