I was writing boot loader and stuck with a 545 byte file, which I have no idea how to load. If it is a 512 byte file stored in the 2nd sector, it can be easily loaded onto the memory. But this seems to be a little weird to me.
How do I do this?
I was writing boot loader and stuck with a 545 byte file, which I have no idea how to load. If it is a 512 byte file stored in the 2nd sector, it can be easily loaded onto the memory. But this seems to be a little weird to me.
How do I do this?
Regarding your deleted question, How do I embedded C and Assembly in 16 bit?:
Creating a "bootloader" that invokes a simple "kernel" isn't necessarily difficult ... but it's not something you can answer in a one-line question, either.
The first question is - Q: What is your target platform?
It sounds like - A: An Intel x86 CPU loaded from a FAT (or FAT32) boot media.
The second question = Q: What is your "development workstation"? Are you compiling/assembling your code and creating your boot image on Windows? On Linux? "Something else"? Let's assume "linux". For many reasons, that's a "good choice".
As others pointed out, this C program is not a good choice for your "kernel":
main.c =>
#include<stdio.h>
int main(int argc, char *argv[]) {
printf("Hello world!!!");
return 0;
}
You'd need to link in a C runtime library ("CRTL") in order to get "printf()".
You also need to invoke crt0.obj beforehand in order to get "main()".
Even if you did so, the CRTL and crt0.obj you chose might not be compatible with 16-bit real mode.
And even if you covered 1), 2) and 3), you'd still need an OS (e.g. DOS, Linux or Windows) in order to actually perform the "printf()".
SUGGESTION:
Try working through this tutorial (there are many similar examples on the web):