I have been trying to figure out how to open a file from the hard drive in assembly. I want to do this without using DOS interrupts or anything that would require an operating system, because I am trying to build a simple OS. I am fine with BIOS interrupts, of course.
Share
An OS provides two sets of capabilities that you have to emulate to access files:
how to read the parts; this calls the driver to do that actual I/O.
You might be able to invoke BIOS calls to simulate a bad device driver; normally real drivers are complex to ensure efficiency and good error recovery, which the BIOS routines simply don’t do.
But what you’ll find hard to do on you own is to emulate the “file access” library. Modern file systems store files on a disk in fairly complicated ways to minimize access times while allowing files to spread across most of the disk.
If you insist on doing this, you better read up on the file system structures for whatever filesystem (Linux? Windows?) you intend to access. Be prepared to discover those documents are incomplete and out of date with respect to the real OS.