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.
So is there a better way to check BIOS available Physical Drives without seeing these errors?
Check available physical drives using BIOS int 13H
Re: Check available physical drives using BIOS int 13H
Hi,
Cheers,
Brendan
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.EvolSoft wrote:So is there a better way to check BIOS available Physical Drives without seeing these errors?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- TightCoderEx
- Member
- Posts: 90
- Joined: Sun Jan 13, 2013 6:24 pm
- Location: Grande Prairie AB
Re: Check available physical drives using BIOS int 13H
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.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Check available physical drives using BIOS int 13H
To detect floppy drives, simply do this:
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.
Code: Select all
mov ah, 8
mov dl, 0 ; or 1 for the second floppy drive
int 0x13
jc NoFloppy
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.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Check available physical drives using BIOS int 13H
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