An emulator is a program that behaves like another machine, so software written for one processor and its hardware runs on a different computer. Writing one is a deep exercise in how real machines work. It also keeps old systems usable. Run only software you own or have the right to use, such as your own programs and homebrew.
Key concepts
- CPU emulation: an interpreter that fetches, decodes and executes each instruction, or a translator that converts blocks into native code.
- Memory and bus: the address space, with RAM, ROM and device registers each handled at its address.
- Device emulation: video chips, sound chips, timers and controllers, each with its own behaviour.
- Timing and synchronisation: keeping components in step, either approximately or cycle by cycle.
- Accuracy and speed: exact behaviour costs time, so every emulator picks a trade-off.
Vocabulary
- Interpreter and dynamic recompiler: running instructions one at a time, or translating them into native code on the fly.
- Cycle-accurate: modelling the exact clock timing of the original hardware.
- Test ROM: a program written to check one behaviour and report whether it passed.
- Homebrew: new software that people write for old systems.
What to study, in order
- Number systems, binary and hexadecimal, and the structure of a simple instruction set.
- Write a CHIP-8 interpreter, a tiny virtual machine, and run programs you write.
- Read the public documentation of a simple 8-bit processor and implement its instructions.
- Pass published test programs for the CPU, instruction by instruction, comparing against known logs.
- Add a video and an input device, then timing; learn why synchronisation is the hard part.
Related tags
#computer-architecture #retrocomputing #virtualization #assembly