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.
Hello,
I'm developing a OS using Assembly, but it's one of those bootloader OSes, and I'm needing more than just 512 bytes(the boot sector) to use, then I want to remove the boot part of my OS, and use Grub to load it. Here is how my code is right now(it's very big, then I've suppressed it):
Booting 'MyOS'
root (fd0)
Filesystem type is fat, using whole disk
kernel /boot/kernel.bin
Error 7: Loading below 1MB is not supported
Press any key to continue...
If main is a function inside of your bootloader (loaded at 0x7c00) its not going to work. Grub only supports loading to 1MB or above. Also, as mentioned above, Grub and the MultiBoot standard says that the system must be running in protected mode on entry: It wont work if you are trying to boot using real mode code.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Many have written a 32bit loader that loads a 64bit kernel and switches to long mode to execute it. You could do a similar thing. i.e, Write a 32bit loader that loads your kernel, switches to real mode and executes it.
i.e.
Grub loads 32bit loader
Loader loads kernel below 1M
Loader switches to real mode
Loader jumps to rmode kernel
If a trainstation is where trains stop, what is a workstation ?
If you are just looking for boot code (boot sector) to boot your OS in real mode, just search Google. There are tons of them. Dont copy and paste however; some might have licensing restrictions and you wont learn anything that way.
If you are looking for a larger boot loader (Like the one that you tried using, Grub) then I personally dont know of any, sorry.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}