Skip to the content ForoHackers
Log inJoin

Emulation: start here

Emulation
#2993 · · Quote · Report

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

  1. Number systems, binary and hexadecimal, and the structure of a simple instruction set.
  2. Write a CHIP-8 interpreter, a tiny virtual machine, and run programs you write.
  3. Read the public documentation of a simple 8-bit processor and implement its instructions.
  4. Pass published test programs for the CPU, instruction by instruction, comparing against known logs.
  5. Add a video and an input device, then timing; learn why synchronisation is the hard part.

Related tags

#computer-architecture #retrocomputing #virtualization #assembly

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply