In fact it is not that daunting a task. Really, an operating system is the code that takes over from the boot loader. As others here have hinted at, you won't get much success on conventional machines that you buy in a computer store. On the other hand, that is pretty much what you do with embedded systems. Look at Arduino or Raspberry Pi and research ARM architectures. Google is your friend and will help you with this.
Here is a
link[
^] where some students wrote an operating system for a Raspberry Pi that is a 2 player chess game. They wrote an ARM7 assembler in C, then wrote the chess program/operating system in ARM7 assembly. The code is 15000 lines and they did it in 2 weeks.