How to use INT 13h to load from HDD instead of floppy?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

How to use INT 13h to load from HDD instead of floppy?

Post by AwfulMint »

I can't find good docs about this so I resolved to ask here, dudes, how to load from HDD? From floppy we use that CHS model and for HDD? And even for flash medias (SSD)?
OS Development is awesome!

|AetherOS Project|
deleted8917
Member
Member
Posts: 119
Joined: Wed Dec 12, 2018 12:16 pm

Re: How to use INT 13h to load from HDD instead of floppy?

Post by deleted8917 »

AwfulMint wrote:I can't find good docs about this so I resolved to ask here, dudes, how to load from HDD? From floppy we use that CHS model and for HDD? And even for flash medias (SSD)?
Do you mean load your kernel from HDD? Anyways, maybe you can use int 13h DL=80h for reading the HDD.
DL = 00h First floppy drive (A:)
DL = 01h Second floppy drive (B:)
DL = 80h First HDD
DL = 81h Second HDD
DL = E0h CD/DVD
DL = FFh Last HDD supported by the BIOS
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: How to use INT 13h to load from HDD instead of floppy?

Post by BenLunt »

As hextakatt states, the DL register specifies which drive you are booting from. However, you do not hard code this at all. This is given at POST. i.e.: at the time your code receives control the DL register is already set to the value of the media it is booting from.

However, to read from a hard drive, especially one larger than 500meg, you will need to use LBA addressing instead of CHS addressing.

To do so, you can use the MS Extension services which allow up to 64-bits of LBA addressing (though it may not actually support all 64-bits).

Search for the services where AH starts with 4xh, i.e.: AH = 42h is the read service. You will need to check for the support of these services as well.

Ben
- http://www.fysnet.net/osdesign_book_series.htm
Post Reply