How ratsock6/retromu works
RetroEmu emulates DMG and CGB handhelds, with a command-line runner and SDL frontend. The principal workflow is selecting a ROM, loading its cartridge metadata and controller, assembling the machine, executing CPU instructions through the memory bus, and presenting PPU frames while accepting input. Separate user-facing modes provide cartridge inspection, headless execution, screenshots, tracing, disassembly, and interactive debugging. The graph reflects documented capabilities and indexed references; unsampled implementation details are not inferred.
Main entry points: main.cpp Command entry · bus.cpp Memory bus · gameboy.cpp Machine facade · frontend.cpp SDL frontend
Components 17
Entry and tools
- Command entry
src/main.cpp
Emulated hardware
- Cartridge loader
src/core/cartridge.cpp - Bank controllers
src/core/mbc.cpp - Machine facade
src/core/gameboy.cpp - SM83 CPU
src/core/cpu.cpp - Memory bus
src/core/bus.cpp - Timer
src/core/timer.cpp - DMA
src/core/dma.cpp - Console joypad
src/core/joypad.cpp
Display and input
- PPU renderer
src/core/ppu.cpp - SDL frontend
src/front/frontend.cpp - GUI widgets
src/front/ui.cpp
Debug and validation
- Disassembler
src/debug/disassembler.cpp - Interactive debugger
src/debug/debugger.cpp - Execution tracer
src/debug/tracer.cpp - CPU self-test
src/debug/cpu_selftest.cpp
Other components
- User
Connections 23
- User → Command entry: selects mode
README.md - Command entry → Cartridge loader: loads ROM
src/main.cpp - Cartridge loader → Bank controllers: creates controller
src/core/mbc.cpp - Machine facade → Cartridge loader: loads cartridge
src/core/gameboy.cpp - Command entry → Machine facade: runs machine
README.md - Machine facade → SM83 CPU: steps CPU
- SM83 CPU → Memory bus: accesses memory
- Memory bus → Cartridge loader: dispatches access
- Memory bus → PPU renderer: dispatches access
- Memory bus → Timer: ticks and routes
src/core/timer.cpp - Memory bus → DMA: dispatches DMA
src/core/dma.cpp - Memory bus → Console joypad: dispatches access
- SDL frontend → Machine facade: runs frames
- SDL frontend → Console joypad: updates buttons
src/front/frontend.cpp - SDL frontend → GUI widgets: draws interface
src/front/frontend.cpp - GUI widgets → User: presents controls
README.md - Command entry → SDL frontend: opens window
README.md - Command entry → Interactive debugger: starts debugger
README.md - Interactive debugger → Disassembler: decodes instruction
src/debug/debugger.cpp - Command entry → Execution tracer: runs trace
README.md - Execution tracer → Machine facade: traces machine
- Command entry → CPU self-test: runs CPU checks
README.md - CPU self-test → SM83 CPU: checks execution
src/debug/cpu_selftest.cpp