BIOS

Starting from the very beginning.. your machine has some code, usually located on Flash ROM, called the BIOS. When booting, the BIOS first checks your system's hardware in what's called a POST test. Usually if it finds problems it will respond with some beep code like "short short long" that you can look up in the documentation for your motherboard. It could mean something like video display problem or keyboard missing, etc. Next, the BIOS loads and executes some code located in the Master Boot Record called the Boot Loader.