Skip to main content
Back to articles
2026 / 01
| 2 min read

Big Repo Restructure and Backend Migration

Splitting the repository into cores, languages, assemblers, and BIOS so the directory layout matches the dependency graph.

emulator architecture rust refactoring

Every import path I touched broke two more. After the third hour of chasing circular dependencies and build failures I couldn’t explain, I stopped repairing the existing layout and spent the rest of the day moving hundreds of files into a structure that matches what actually depends on what.

The constraint was simple: a CPU core should build and test without importing the web app, and an interpreter should know nothing about the modem.

The new backbone is:

cores/        # CPU emulators (Z80, MOS 6502, Intel 8080/8088)
languages/    # Interpreters (Forth, BASIC, Scheme, Prolog, ZIL)
assemblers/   # Assemblers (6502, Z80, x86)
bios/         # ROMs and BIOS code
src/          # Application code
  main/       # Entry point
  frontend/   # UI components
  backend/    # Backend services
  audio/      # Audio system
  serial/     # Modem communication

With those edges in place, cargo test in cores/z80/ stops being a full-repo compile and becomes a few seconds of feedback. The same applies to languages/: someone can take a single interpreter and work on it without holding the rest of the system in their head.

The migration was a grind. Move a file, fix imports; find an implicit re-export, fix three more; repeat until the graph stops moving. The backends were the noisiest part, since every game, BBS service, and ANSI animator had to move and have its imports corrected. I touched forty-odd files just fixing paths after the main restructure landed.

The README and manual pages now line up with the new directory layout, so the docs and the code disagree about fewer things than they did yesterday.

Changes

  • Restructured the repo into domain directories (cores/, languages/, assemblers/, bios/) with real dependency boundaries.
  • Migrated all backends into a consistent directory structure within src/backend/.
  • Updated import paths, manuals, and top-level documentation to match the new shape.
  • Fixed dozens of broken imports left over from the circular dependency mess that started this exercise.

Tomorrow I’m going to tackle the remaining JavaScript-to-TypeScript migration. Half the worker files are still .js, and every time I touch them I have to switch mental contexts. The language workers and frontend visualizations should be the easy half.

Previous: 2026-01-22