Hi all,
How can we get the BIOS drive (int 13h drive) where the system was booted from in real mode?
For example if we boot the system from the first floppy unit it should be 0x00 and if we boot the system from the first hard drive it should be 0x80.
Thanks in advance
How to get the boot drive?
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
Re: How to get the boot drive?
I was going to just link you to the wiki and tell you to find the answer yourself, but it is a bit buried.
The solution you need is outlined here: http://wiki.osdev.org/System_Initializa ... ronment.22
Specifically, when the BIOS hands control to your boot sector, the drive number you were booted from is in dl. NOTE: If you did not receive control for the BIOS and instead got control from a bootloader (like GRUB) dl may or may not contain the correct value. You should check the documentation for whatever bootloader you are using in this case.
- Monk
The solution you need is outlined here: http://wiki.osdev.org/System_Initializa ... ronment.22
Specifically, when the BIOS hands control to your boot sector, the drive number you were booted from is in dl. NOTE: If you did not receive control for the BIOS and instead got control from a bootloader (like GRUB) dl may or may not contain the correct value. You should check the documentation for whatever bootloader you are using in this case.
- Monk