Master the fundamental concepts of the boot process: theory through this focused micro-challenge.
You have read the whole brief, and the concepts above stay free on every task. Writing and running the code needs a plan.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it worksBefore an OS owns memory, firmware and PC architecture conventions carve the low megabyte into fixed regions. Bootloaders must avoid clobbering the IVT, BDA, and video areas. For example, the boot sector lands at 0x7C00, while the Interrupt Vector Table occupies 0x00000 through 0x003FF.
| Region | Range | Role |
|---|---|---|
| IVT | 0x00000-0x003FF | 256 real-mode interrupt vectors |
| BDA | 0x00400-0x004FF | BIOS data (equipment, timers) |
| Boot sector | 0x07C00 | 512-byte MBR/VBR load address |
| VGA text | 0xB8000 | Color text framebuffer |
| BIOS ROM | 0xC0000-0xFFFFF | Option ROMs and system firmware |
The A20 line gates address bit 20. When disabled, accesses wrap in the first megabyte (0x100000 wraps to 0x00000), which breaks loaders that place data above 1 MB. Enabling A20 is mandatory before protected-mode kernels use extended memory.
cLoading…
You will map reserved regions and explain when the A20 gate must be enabled. This exercise requires showing why a bootloader cannot blindly use every address below 1 MB without hitting firmware-owned structures.
A bootloader needs two answers: which region of the real-mode memory map owns an address, and where an address really goes with the A20 gate on or off.
| Region | Range |
|---|---|
| IVT | 0x00000-0x003FF |
| BDA | 0x00400-0x004FF |
| FREE | 0x00500-0x07BFF |
| BOOT | 0x07C00-0x07DFF (the boot sector) |
| FREE | 0x07E00-0x9FBFF |
| EBDA | 0x9FC00-0x9FFFF |
| VIDEO | 0xA0000-0xBFFFF |
| ROM | 0xC0000-0xEFFFF |
| BIOS | 0xF0000-0xFFFFF |
| EXTENDED | 0x100000 and above |
With A20 off, address bit 20 and above are lost, so the address is masked to 20 bits: 0x100000 lands in the IVT. With A20 on, it is unchanged.
N, then N commands:
A ADDR: classify ADDR (hex).W ADDR off or W ADDR on: apply the A20 gate to ADDR (hex), then classify the result.A: ADDR 0x07C00 REGION=BOOT, with the address as at least 5 uppercase hex digits.W ... off: A20-OFF 0x00100000 -> 0x00000 REGION=IVT.W ... on: A20-ON 0x00100000 -> 0x100000 REGION=EXTENDED, with two spaces after A20-ON so the arrows line up.The input address is printed as 8 uppercase hex digits and the result as at least 5.