A complete 16-bit computer system built from scratch. CPU, assembler, graphics, audio, debugger — all in Rust.
Problem
I wanted to build something that touches every layer of a real system: CPU architecture, assembly language design, graphics, audio, memory mapping, interrupts, debugging tools. Constraints are what breed creativity. When modern games ship at 80+ GiB, there’s something refreshing about stepping back and working with only 64 KiB.
Approach
I designed a custom instruction set architecture (ISA) with mixed 16/32-bit encoding, 8 general-purpose registers, deterministic cycle timing, memory-mapped I/O, and interrupt handling. The system is split into three independent crates: core (CPU, memory, 21 syscalls), assembler (multi-pass with labels, forward references, and automatic short-to-long expansion), and emulator (SDL2 with REPL debugger, breakpoints, disassembly, and basic backtrace).
Features
- Custom CPU: 30 opcodes, mixed 16/32-bit encoding, 8 registers, 30 instructions, 1–5 cycles per instruction
- Assembler: Multi-pass with labels,
.org/.dw/.db/.ds/.equdirectives, automatic short/long expansion, symbol table - Emulator: SDL2, audio via rodio, memory-mapped keyboard/mouse/controller input, async HTTP, REPL debugger
- Graphics: 128×128, 4 bpp nibble-packed, 4 palette banks × 16 colours, hardware-scrolling tilemap, sprite bank (512 sprites, first 256 usable as a tilemap)
- Audio: 4 channels, 5 waveforms, memory-mapped registers
- 21 syscalls: Debug print, sprites, tile, text rendering, shapes (line/rect/circle), random, sqrt, sin, async HTTP, save/load
- Cartridge format:
.cove.png= valid PNG with program data appended at the end - 317+ unit tests and 29 end-to-end tests running headlessly in CI
- 2100+ line programmer’s manual and specification documentation
What it offers
Cove isn’t just a fantasy console, that may have been the original spark, but Cove also works as an educational tool. It provides insight into why computers work the way they do, all in a relatively small codebase where you can reasonably understand the entire system and why things work the way they do.
Tech Stack:
- Language: Rust
- Graphics: SDL2
- Audio: rodio, 4 channel waves
- Tools: Custom assembler, custom emulator, REPL debugger
Repository: git.jimmy-b.se/JimBer110/Cove