Reading — step 1 of 5
Read
~2 min readProduction
Beyond CHIP-8
CHIP-8 is just the start. Same patterns scale up:
NES (Nintendo Entertainment System):
- 6502 CPU (simple 8-bit processor).
- 2 KiB RAM.
- PPU (Picture Processing Unit): tile-based graphics, 64 sprites.
- APU (Audio Processing Unit): 5 audio channels.
- Mappers: cartridge-side memory bankers.
- ~3500 LOC for full emulator.
Game Boy:
- Custom 8-bit CPU (Z80-like).
- 8 KiB RAM, 8 KiB VRAM.
- LCD: 160x144, 4 shades of grey.
- Sound: 4 channels.
- Famous test ROMs: Blargg's tests, mooneye.
- ~5000 LOC for cycle-accurate.
SNES (Super Nintendo):
- 65816 CPU + dedicated sound CPU.
- Mode 7 graphics (rotation/scaling).
- Much harder to emulate accurately.
N64, PS1, GameCube:
- 3D capable.
- Custom GPUs harder than the CPU.
- Most emulators use HLE (high-level emulation): pretend to be the GPU.
Modern emulator architecture:
- CPU core: same fetch-decode-execute loop.
- Bus / memory map: route accesses to RAM, ROM, MMIO.
- PPU/GPU: render frames (often run in parallel thread).
- APU: audio (callback into audio output).
- Input mapping: keyboard/gamepad → emulated buttons.
- Save states: serialize entire state to disk.
- Rewind: keep N seconds of states, playback in reverse.
JIT (Just-In-Time):
- Recompile guest instructions to host code on the fly.
- 10-100x speedup.
- Used by QEMU TCG, Dolphin (GameCube/Wii).
Cycle-accurate vs HLE:
- Cycle-accurate: emulate exact timing. Plays glitchy games correctly.
- HLE: skip exact timing for performance.
- Modern emulators offer both modes.
Real-world emulators:
- Mesen (NES): cycle-accurate.
- Dolphin (GC/Wii): HLE.
- MAME: thousands of arcade games, ports of every CPU.
- RPCS3 (PS3): in development.
For learning:
- CHIP-8: 1-3 days.
- Game Boy: 2-4 weeks.
- NES: 3-6 weeks.
- SNES: months.
- Modern consoles: years + reverse engineering.
The lessons compound: write CHIP-8 → understand instruction decoding. Write GB → understand interrupts, banking. Write NES → understand PPU + DMA + mappers. By PS1, the patterns are familiar; just more of them.
Don't roll your own for production. Use existing emulator if you want to play games. Roll your own to learn.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…