I actually have an experiment in assembly that I've started and that is
to look at the old legacy boot process from quite a low level.
The way I see it is this, I know sector0 of the bootable disk is the MBR
and wikipedia has plenty of juicy information about what that record
contains and how it is used, so I am going to get hold of one ane take a
good look at it.
Step1. getting hold of the MBR.
a brief summary about the MBR is:
The master boot record is the first 512 bytes (a single sector) at the
start of a disk. Inside the MBR there's a section at the start which is
interpreted as code, this code is 16-bit old x86 instructions.
For backward compatibility the mbr code is loaded at address 7C00
The tail end of the MBR lists 4 possible partitions where booting can
resume.
## MBR construction
+-------------------------------------------------------+
| 0x0000 MBR code area (446 bytes) |
+-------------------------------------------------------+
| 0x01BE Partition entry #1 (16 bytes) |
+-------------------------------------------------------+
| 0x01CE Partition entry #2 (16 bytes) |
+-------------------------------------------------------+
| 0x01DE Partition entry #3 (16 bytes) |
+-------------------------------------------------------+
| 0x01EE Partition entry #4 (16 bytes) |
+--------------------+----------------------------------+
| 0x01FE 0x55 | |
+--------------------| Boot Signature |
| 0x01FF 0xAA | |
+--------------------+----------------------------------+
Partition Entries::
+-------------------------------------------------------+
| 0x00 (1 byte ) status or physical drive bit-7 set for |
| active or bootable drive |
+-------------------------------------------------------+
| 0x01 (3 bytes) CHS address of first absolute sector of|
| partition |
| byte-1 is HEAD |
| byte-2 low 6 bits are sector |
| high 2 bits are high bits of the|
| cylinder |
| byte-3 the rest of the cylinder bits |
+-------------------------------------------------------+
| 0x04 (1 byte ) partition type |
+-------------------------------------------------------+
| 0x05 (3 bytes) CHS of last absolute sector in |
| partition, bytes follow same definition|
| as CHS address given above |
+-------------------------------------------------------+
| 0x08 (4 bytes) LBA of first absolute sector |
+-------------------------------------------------------+
| 0x0C (4 bytes) number of sectors in partition |
+-------------------------------------------------------+