Question

First of all, had a hard time figuring out a title, and it's a bit ambiguous, but oh well.

Alright, so I have a mixed c++ & asm bootloader program. I can copy it onto my mbr and run it. The only problem I'm having is the fact that the mbr is very small. I'm assuming the purpose of it is to only call external code written somewhere else on the drive. My problem is, I'm not sure how to access that. I mean I can put the data on there, I just have no clue how to programmaticaly access that data, since in essence the drive is not going to have a "file system", just arbitrary code.

I've searched the net but tutorials on real low level development seems scarce.

I'm even up for a c++ library if any exists.

Was it helpful?

Solution

The BIOS sets up several interrupt handlers before running the code in the MBR. One of these can be used to do things like read/write sectors directly from the hard drive without a OS, device driver, or file system.

That's interrupt 19 (13H as its more commonly known).

You'll need to use that to read the code, then just jmp into it.

OTHER TIPS

Good old BIOS calls, for PC. If your board is not PC - you need info from the board manufacturer on how to access the IDE/SATA controller.

Without knowing the platform, it's hard to give anything but the most generic overview.

Initial boot code generally asks the system firmware to copy additional blocks from disk to memory, and then can call code contained there. On a PC system, that would mean a BIOS call.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top