I would definitely agree with iansjack: writing a driver is the way to go.
Early on, writing an
IDE driver may be easier just to get the ability to read disks especially in emulators like QEMU, but I'd actually recommend writing an
AHCI driver instead.
It isn't terribly hard (compared to something like USB controllers) and works with pretty much any computer since 2010.
Plus, AFAIK the spec is completely free from Intel.
If you're using QEMU you can add an AHCI controller and a disk like so:
Code: Select all
(qemu command) -device ahci,id=ahci -drive file=DISK_IMAGE.img,id=disk,if=none,format=raw -device ide-hd,drive=disk,bus=ahci.0
thedude3253 wrote:Do you jump back and forth between real and protected mode to use INT 13h?
The only thing I ever use real mode/BIOS interrupts for at all anymore is VESA/VBE resolution switches. Switching is slow, especially for disk reads/writes which ideally should be somewhat asynchronous from the OS's perspective (but synchronous from the program's perspective). The only reason I have to do this for VESA/VBE is because I don't feel like writing a driver for tons of graphics cards and I really want the user of my OS to be able to switch resolutions without rebooting their computer.
Good luck!