Back to portfolio
LOW-LEVEL SYSTEMS / BOOTSTRAP EXPERIMENT CASE / TINY-X64-BOOTLOADER

Tiny x64 Bootloader

A minimal 512-byte BIOS boot sector for exploring x86 startup, real-mode initialization, segment registers, and stack setup.

RoleSystems programmer · assembly and emulator workflow
Period2026
CategoryLow-level systems
View source repository Read from the actual codebase
Bootloader flow diagram from BIOS to the operating system Repository artifact / visual reference
Boot sector budget512 BThe BIOS-readable sector must fit the first-stage program and signature.
Boot signature21930The final two bytes mark the sector as bootable to classic BIOS firmware.
ReproductionNASM + BochsAssemble the binary, then inspect the boot path in an emulator.
The problem

Before an operating system can load files, manage memory, or show a shell, firmware must find a bootable sector and transfer control into a tiny, constrained program.

The outcome

A reproducible first-stage boot experiment that makes the 512-byte boundary, real-mode CPU state, assembly output, and BIOS-to-bootloader handoff tangible.

Before the kernel, there is a sector

This project is a deliberately small answer to a large systems question: what does a computer actually do before an operating system exists? Classic BIOS looks for bootable media, reads the first 512 bytes into memory at 0x007C00, checks for the 0x55AA signature, and transfers control to the code it loaded.

That is an unusually good learning boundary. There is no filesystem abstraction, no process model, and no convenient runtime. The program has to establish enough state to make the next instruction predictable.

The boot chain

BIOS / POST
    │  read sector 0

0x007C00 ──► 512-byte boot sector ──► larger bootloader ──► kernel ──► OS
                  real mode

The repository’s own notes use the experiment to contrast real mode with protected mode. Real mode gives early code direct BIOS access but no modern memory protection or multitasking. A larger loader such as GRUB can then take over the work that cannot fit into the first sector.

The implementation surface

bootloader.asm is the source of truth. The first-stage code initializes the early execution environment, configures segment registers, establishes a stack, and leaves a compact base for a future handoff. boot.com is the assembled binary that makes the size constraint visible rather than theoretical.

ArtifactRole in the experiment
bootloader.asmHuman-readable x86 assembly source.
boot.comFlat assembled boot-sector artifact.
bochsrc.txtEmulator configuration for a repeatable boot.
bochsout.txtCaptured emulator output for inspection.
README.mdNotes on BIOS, POST, real mode, protected mode, and chainloading.

The build path stays intentionally direct:

nasm -f bin bootloader.asm -o boot.com
bochs -f bochsrc.txt

Why the 512-byte limit is useful

A bigger program can hide a surprising amount of state behind libraries and conventions. A boot sector cannot. The limit forces a direct relationship between each instruction and the machine state it prepares. It also clarifies why classic BIOS does not simply load an entire operating system: BIOS knows how to read sector zero and check a signature, not how to parse every filesystem and locate a kernel.

The “x64” label is therefore a useful point of discussion rather than a claim that the first instruction executes in a modern 64-bit environment. The initial firmware handoff begins in the historical real-mode setup; protected-mode and long-mode transitions belong to later stages.

Evidence map

  • bootloader.asm contains the compact boot-sector implementation.
  • boot.com shows the assembled flat binary that must fit the boot-sector boundary.
  • bochsrc.txt makes the emulator invocation reproducible.
  • bochsout.txt preserves a run artifact for inspection.
  • The repository documents the BIOS load address, boot signature, real-mode constraints, and chainloading model.

Limits and next stage

This is an educational first-stage boot experiment, not a complete operating-system loader. It does not parse filesystems, load a kernel, transition through protected mode, or provide a full long-mode runtime. Those limits are exactly what make the project useful: it isolates the first handoff instead of claiming to be an OS.

Repository

View the source repository →