How rekcah97/chip8-emulator works
This is a CHIP-8 emulator: the user supplies a ROM path, the main loop loads it, polls mapped keyboard input, runs ten emulation cycles, ticks timers, and presents the framebuffer. The emulator core owns ROM loading, machine state, instruction fetch/dispatch, opcode behavior, and timers; the SDL platform handles window events, keyboard mapping, and display. The README documents the 64×32 display, 10× scaling, and standard opcode coverage. The sampled sources support the main runtime links; SDL is shown as an external dependency.
Main entry points: main.cpp Main loop · hardware.h Machine state · platform.cpp Input polling · chip8.cpp ROM loader
Components 12
Runtime loop
- Main loop
main.cpp
Emulator core
- ROM loader
src/chip8.cpp - Machine state
src/hardware.h - Instruction cycle
src/chip8.cpp - Opcode dispatch
src/chip8.cpp - Opcode handlers
src/chip8.cpp - Timers
src/chip8.cpp
SDL platform
- Input polling
src/platform.cpp - Framebuffer display
src/platform.cpp
Other components
- ROM user
- CHIP-8 ROM
- SDL2
Connections 15
- ROM user → Main loop: supplies ROM path
README.md - Main loop → ROM loader: loads ROM
main.cpp - CHIP-8 ROM → ROM loader: provides bytes
src/chip8.cpp - ROM loader → Machine state: writes RAM
src/chip8.cpp - Main loop → Input polling: polls input
main.cpp - Input polling → Machine state: updates keys
src/platform.cpp - Main loop → Instruction cycle: runs cycles
main.cpp - Instruction cycle → Opcode dispatch: dispatches opcode
src/chip8.cpp - Opcode dispatch → Opcode handlers: calls handler
src/chip8.cpp - Opcode handlers → Machine state: updates machine
src/chip8.cpp - Main loop → Timers: ticks timers
main.cpp - Timers → Machine state: updates timers
src/chip8.cpp - Main loop → Framebuffer display: presents screen
main.cpp - Framebuffer display → SDL2: renders via
src/platform.cpp - Input polling → SDL2: polls events
src/platform.cpp