Inspiration
1977 saw the release of three machines that brought computing into people's homes: the Apple II, the Commodore PET and the TRS-80, later nicknamed the "1977 Trinity." We wanted to understand what it was like to design and program a computer from that era, so we designed our own. The Trinity Home Computer is an imaginary fourth member of that family, with its own CPU, memory map, video hardware and instruction set, built from scratch the way those machines were.
What it does
The Trinity Home Computer is a complete fantasy 8-bit computer:
- CPU: an 8-bit processor with an accumulator, two general-purpose registers, an index register, a 16-bit stack pointer and program counter, and zero and carry flags. It runs at 1,000,000 instructions per second, with about 60 instructions across 10 addressing modes.
- Memory: a 64 KB address space with 32 KB of user RAM, video RAM and memory-mapped I/O for the clock, keyboard, joystick, bell and a tape player.
- Video: 320 × 240 output in 16 colors, with three modes:
- a 40 × 30 text mode using our own hand-drawn character set
- an 80 × 60 graphics mode
- a mixed mode with graphics on top and text below
- Software: programs are written in our own assembly language, turned into machine code by our assembler, and run on the emulator. To prove the machine works, we built a suite of games for it:
- Snake
- Breakout
- a first-person DOOM-style 3D shooter, with multiple levels, imp enemies that throw fireballs you have to dodge, and a level editor for making your own maps
How we built it
The entire project is written in Python. The emulator uses pygame for graphics and input, and the IDE uses Tkinter.
The emulator is split into the parts real hardware would have:
- a CPU core that executes one instruction at a time
- banked memory with RAM, ROM and I/O regions
- a video chip that reads VRAM and draws each mode
- an input layer that maps the keyboard and arrow keys onto the machine's I/O addresses
Alongside it we built an assembler that supports labels and data directives, a sprite editor for designing the character set, and a 16-color palette.
Challenges we ran into
Emulating the Trinity's video system was the hardest part. The screen layout lives entirely in VRAM, with two bytes per character cell and colors packed into nibbles, and every team member had a slightly different picture of how it worked. That led to a lot of miscommunication, and at one point two versions of the graphics mode disagreed about how big the screen was. We learned to treat the written spec as the single source of truth.
Writing real programs for the machine uncovered bugs in the CPU itself, such as an instruction that silently did nothing and addressing modes that read from the wrong place. We fixed them and added tests that check every instruction against the spec.
Performance was a constant puzzle too. A 1 MHz 8-bit CPU with no multiply or divide instruction makes 3D graphics hard, so the shooter relies on precomputed lookup tables and hand-tuned drawing routines.
Accomplishments that we're proud of
We ended up with a working emulator and a suite of games that run on it. Going from a spec sheet to a playable first-person shooter on a computer that never existed is something we're really proud of. The games aren't just demos: they push the hardware to its limits and helped us find and fix real bugs in the emulator.
What we learned
We learned a lot about assembly and machine language: how a CPU fetches and executes instructions, why flags and addressing modes matter, and how much careful thought goes into every byte when you only have 32 KB. We also gained a new respect for the engineers and programmers of 1977, who did all of this without modern tools.
What's next for Trinity Home Computer
The Trinity Home Computer needs an operating system. Right now it boots straight into a single program. Next we want a small built-in OS in its ROM:
- a command line for loading and running programs from tape
- a simple file system
- a library of routines for text, graphics and input, so programs don't have to reinvent them
After that, a built-in BASIC interpreter would make it a true home computer of its era.
Log in or sign up for Devpost to join the conversation.