Building a 64-bit OS from Scratch with Claude Code (isene.org)

🤖 AI Summary
A developer used Claude Code (Sonnet 4.5, 1M context) to build "Simplicity OS" from an empty directory in a single session: a bootable x86_64 operating system (1,351 bytes of bootable code) with a 512‑byte boot sector, a stage2 loader that transitions CPU modes, a working 64‑bit long mode, VGA text output and a tiny Forth interpreter implementing the NEXT inner loop. In roughly two hours they produced a project scaffold (Makefiles, git hooks, docs), debugged tricky assembly bugs (e.g., jmp [eax] vs jmp eax), and implemented 14 basic Forth words (stack ops, arithmetic, memory, I/O, control). The full interactive session — prompts, AI responses, failures and the final breakthrough — is published as MakingAnOS.md and the code is public domain on GitHub (git clone https://github.com/isene/SimplicityOS; make run boots it in QEMU). Technically notable is how Claude found the non-obvious fix for entering long mode: set up a 32‑bit GDT during setup, enable long mode while still in 32‑bit code, then load a new 64‑bit GDT and far‑jump into the 64‑bit code segment. The Forth NEXT loop is minimal (lodsq; jmp rax) and the design treats every OS primitive as a composable Forth word (e.g., SCREEN, SCREEN-SET, DISK-READ). This demonstrates that current generative models can write, iterate and debug low-level assembly and build systems, accelerating OS prototyping while producing a transparent, reproducible artifact for developers to inspect and extend.
Loading comments...
loading comments...