Try to read the code of a small, basic open-source OS, such as MikeOS.
Alternatively, I suggest the following steps (should be fun!):
- Write a virtual machine. Define all your processor instructions so that you know your system inside and out. Interface it with SDL for keyboard, mouse, screen, audio access. Keep it simple so that you can fit everything in your head at once. It doesn't need to be a state-of-the-art virtual machine, just one that can emulate the function of a 'real' computer.
- Write an assembler for your virtual machine's processor. Remember that this assembler need not be a program written in the virtual machine's language, but anything that can convert your assembly language to machine code.
- Define an executable format, and write a simple linker.
- You've got all the parts to write your operating system now! Write it in the assembly language, assemble it ... etc .. you don't need such a complicated bootloading process, just get your machine to run your OS first.
The above steps may seem kinda stupid for writing a simple OS, but hey, it's damn fun.