title: How can I build a small operating system on an old desktop computer?
body: <p>This might be in vain, as I know writing an operating system is unbearably complicated (especially by oneself).</p>
  
  <ul>
  <li><p>I don't expect to build the next linux, or windows.</p></li>
  <li><p>I know it will be horrible, and buggy, and won't work, but that's fine.</p></li>
  </ul>
  
  <p>I want to write everything myself, in <em>Assembly</em>, <em>C</em>, and (some) <em>C++</em>.</p>
  
  <p>This is a future project, as I'm busy with some other things at the moment and don't have the time immediately, but I figured I would ask it now, so maybe I could get lots of answers to this, and it could build up and be a useful resource for this kind of approach (everything else I have seen involved building off of minix, using an existing bootloader, building it in a virtual booting program thing, etc).</p>
  
  <p>I want to set up one of my older desktops with a monitor, keyboard and mouse, and start working on a <em>blank</em> hard drive.</p>
  
  <p>I want to learn how to write my own bootloader (I've found lots of resources about this, but for completeness, please still add some good ones), my own USB driver (if that's necessary), a CD driver (if that's necessary), etc. Everything, from the ground up.</p>
  
  <ul>
  <li><p>How do I put the code onto the computer? Is it best to do it with a floppy disk? Can most computers do it from a USB stick?</p></li>
  <li><p>What drivers do I need, and can you suggest any references to building those?</p></li>
  <li><p>After the booting sequence--then what? How do I get into protected mode etc.</p></li>
  <li><p>How do I manage memory without the help of an operating system? Do I just use whatever addresses I want? No initialization necessary?</p></li>
  <li><p>What will I undoubtedly run into that will confuse me?</p></li>
  <li><p>How can I make it either a command line O/S, and a graphical one?</p></li>
  <li><p>What is a graphical O/S built on? Like, how would I do something like, a command line, with a font, and a picture at the top?</p></li>
  <li><p>Where can I read about setting up a multitasking environment? (ie., having two graphical-like command lines running side-by-side).</p></li>
  <li><p>How would I set up a sort of windowing system? How do I display graphics on the screen once simple multitasking is set up?</p></li>
  </ul>
  
  <p>Believe me, I understand that this is a <em>very</em> complicated project, and I probably will never get around to completing it or writing anything on it of any use.</p>
  
  <p>There are lots of other pieces to this I haven't mentioned, if you think of any, feel free to add those too.</p>
  
  <p>Please put one "topic" per answer--for example, USB drivers, and then maybe a list of resources, things to look out for, etc.</p>
  
  <p>Also, please don't suggest building off of another O/S or pre-existing code. I know I will <em>read</em> a lot of pre-existing code (such as the linux kernel, or example resources, existing drivers, etc) but ultimately I want to do all the writing myself. I know I <em>should</em> build off of something else, and there are lots of other questions on SO about that that I can read if I change my mind and go that route. But this one is all about doing the whole thing from scratch.</p>
  
  <p>Any suggestions on how to get it graphical? Different video modes and how to work with them, etc?</p>