# amaiorano/vectrexy architecture

> Architecture diagram of the GitHub repository amaiorano/vectrexy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amaiorano/vectrexy
- Repository: https://github.com/amaiorano/vectrexy

## Overview

Vectrexy is a C++ Vectrex emulator. The main workflow starts the selected engine, registers an emulator client, initializes the emulator and debugger, loads a ROM (or uses built-in Mine Storm), then advances frames and returns rendering and audio data to the engine. SDL supplies the interactive display and controls; a null engine is also available. The README additionally documents configurable input, overlays, and a Debug Adapter Protocol debugger. Some subsystem links are omitted because the relevant implementation excerpts were not provided.

Main entry points: [`libs/vectrexy/src/main.cpp`](https://github.com/amaiorano/vectrexy/blob/master/libs/vectrexy/src/main.cpp) (Emulator client), [`libs/sdl_engine/src/SDLEngine.cpp`](https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/SDLEngine.cpp) (SDL engine), [`libs/emulator/src/Emulator.cpp`](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Emulator.cpp) (Emulator coordinator), [`libs/emulator/src/Cpu.cpp`](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Cpu.cpp) (CPU execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application coordination"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_client["Emulator client<br/>[main.cpp]"]
  node_overlay["Overlay matching<br/>[Overlays.cpp]"]
  node_options["Options and paths<br/>[Options.cpp]"]
  node_core["Core utilities"]
end

subgraph group_emu["Vectrex emulation"]
  node_emulator["Emulator coordinator<br/>[Emulator.cpp]"]
  node_cpu["CPU execution<br/>[Cpu.cpp]"]
  node_memory["Memory bus<br/>[MemoryBus.h]"]
  node_devices["Console devices<br/>[Via.cpp]"]
  node_screen["Vector screen<br/>[Screen.cpp]"]
  node_sound["PSG audio<br/>[Psg.cpp]"]
  node_cartridge["ROM and BIOS<br/>[Cartridge.cpp]"]
end

subgraph group_engine["Engine and I/O"]
  node_sdl["SDL engine<br/>[SDLEngine.cpp]"]
  node_input["Input mapping<br/>[InputManager.cpp]"]
  node_render["OpenGL rendering<br/>[GLRender.cpp]"]
  node_audio["SDL audio<br/>[SDLAudioDriver.cpp]"]
  node_null["Null engine<br/>[NullEngine.cpp]"]
end

subgraph group_debug["Debugging"]
  node_debugger["Interactive debugger<br/>[Debugger.cpp]"]
  node_dap["DAP debugger<br/>[DapDebugger.cpp]"]
  node_symbols["Symbols and RST<br/>[RstParser.cpp]"]
end

node_user(("Player"))

node_user -->|"starts"| node_entry
node_entry -->|"registers and runs"| node_sdl
node_entry -.->|"selects alternative"| node_null
node_sdl -->|"runs callbacks"| node_client
node_client -->|"initializes and updates"| node_emulator
node_client -->|"loads ROM or BIOS"| node_cartridge
node_client -->|"loads and matches"| node_overlay
node_client -->|"updates when enabled"| node_debugger
node_client -->|"updates when enabled"| node_dap
node_emulator -.->|"coordinates execution"| node_cpu
node_cpu -->|"accesses memory"| node_memory
node_emulator -->|"uses peripherals"| node_devices
node_devices -.->|"provides display"| node_screen
node_emulator -.->|"produces audio"| node_sound
node_sdl -.->|"polls controls"| node_input
node_sdl -.->|"renders frames"| node_render
node_sdl -.->|"plays samples"| node_audio
node_debugger -.->|"inspects execution"| node_emulator
node_dap -.->|"uses debug metadata"| node_symbols

click node_entry "https://github.com/amaiorano/vectrexy/blob/master/libs/vectrexy/src/main.cpp"
click node_client "https://github.com/amaiorano/vectrexy/blob/master/libs/vectrexy/src/main.cpp"
click node_overlay "https://github.com/amaiorano/vectrexy/blob/master/libs/engine/src/Overlays.cpp"
click node_options "https://github.com/amaiorano/vectrexy/blob/master/libs/engine/src/Options.cpp"
click node_core "https://github.com/amaiorano/vectrexy/tree/master/libs/core/include/core"
click node_emulator "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Emulator.cpp"
click node_cpu "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Cpu.cpp"
click node_memory "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/include/emulator/MemoryBus.h"
click node_devices "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Via.cpp"
click node_screen "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Screen.cpp"
click node_sound "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Psg.cpp"
click node_cartridge "https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Cartridge.cpp"
click node_sdl "https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/SDLEngine.cpp"
click node_input "https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/InputManager.cpp"
click node_render "https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/GLRender.cpp"
click node_audio "https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/SDLAudioDriver.cpp"
click node_null "https://github.com/amaiorano/vectrexy/blob/master/libs/null_engine/src/NullEngine.cpp"
click node_debugger "https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/Debugger.cpp"
click node_dap "https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/DapDebugger.cpp"
click node_symbols "https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/RstParser.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_client,node_overlay,node_options,node_core toneBlue
class node_emulator,node_cpu,node_memory,node_devices,node_screen,node_sound,node_cartridge toneAmber
class node_sdl,node_input,node_render,node_audio,node_null toneMint
class node_debugger,node_dap,node_symbols toneRose
class node_user toneIndigo
```

## Components

### Application coordination

- [Application entry](https://github.com/amaiorano/vectrexy/blob/master/libs/vectrexy/src/main.cpp): `libs/vectrexy/src/main.cpp`
- [Emulator client](https://github.com/amaiorano/vectrexy/blob/master/libs/vectrexy/src/main.cpp): `libs/vectrexy/src/main.cpp`
- [Overlay matching](https://github.com/amaiorano/vectrexy/blob/master/libs/engine/src/Overlays.cpp): `libs/engine/src/Overlays.cpp`
- [Options and paths](https://github.com/amaiorano/vectrexy/blob/master/libs/engine/src/Options.cpp): `libs/engine/src/Options.cpp`
- [Core utilities](https://github.com/amaiorano/vectrexy/tree/master/libs/core/include/core): `libs/core/include/core`

### Vectrex emulation

- [Emulator coordinator](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Emulator.cpp): `libs/emulator/src/Emulator.cpp`
- [CPU execution](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Cpu.cpp): `libs/emulator/src/Cpu.cpp`
- [Memory bus](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/include/emulator/MemoryBus.h): `libs/emulator/include/emulator/MemoryBus.h`
- [Console devices](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Via.cpp): `libs/emulator/src/Via.cpp`
- [Vector screen](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Screen.cpp): `libs/emulator/src/Screen.cpp`
- [PSG audio](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Psg.cpp): `libs/emulator/src/Psg.cpp`
- [ROM and BIOS](https://github.com/amaiorano/vectrexy/blob/master/libs/emulator/src/Cartridge.cpp): `libs/emulator/src/Cartridge.cpp`

### Engine and I/O

- [SDL engine](https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/SDLEngine.cpp): `libs/sdl_engine/src/SDLEngine.cpp`
- [Input mapping](https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/InputManager.cpp): `libs/sdl_engine/src/InputManager.cpp`
- [OpenGL rendering](https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/GLRender.cpp): `libs/sdl_engine/src/GLRender.cpp`
- [SDL audio](https://github.com/amaiorano/vectrexy/blob/master/libs/sdl_engine/src/SDLAudioDriver.cpp): `libs/sdl_engine/src/SDLAudioDriver.cpp`
- [Null engine](https://github.com/amaiorano/vectrexy/blob/master/libs/null_engine/src/NullEngine.cpp): `libs/null_engine/src/NullEngine.cpp`

### Debugging

- [Interactive debugger](https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/Debugger.cpp): `libs/debugger/src/Debugger.cpp`
- [DAP debugger](https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/DapDebugger.cpp): `libs/debugger/src/DapDebugger.cpp`
- [Symbols and RST](https://github.com/amaiorano/vectrexy/blob/master/libs/debugger/src/RstParser.cpp): `libs/debugger/src/RstParser.cpp`

### Other components

- **Player**

## Connections

- Player → Application entry: starts (evidence: `README.md`)
- Application entry → SDL engine: registers and runs (evidence: `libs/vectrexy/src/main.cpp`)
- Application entry → Null engine: selects alternative
- SDL engine → Emulator client: runs callbacks (evidence: `libs/sdl_engine/src/SDLEngine.cpp`)
- Emulator client → Emulator coordinator: initializes and updates (evidence: `libs/vectrexy/src/main.cpp`)
- Emulator client → ROM and BIOS: loads ROM or BIOS (evidence: `libs/vectrexy/src/main.cpp`)
- Emulator client → Overlay matching: loads and matches (evidence: `libs/vectrexy/src/main.cpp`)
- Emulator client → Interactive debugger: updates when enabled (evidence: `libs/vectrexy/src/main.cpp`)
- Emulator client → DAP debugger: updates when enabled (evidence: `libs/vectrexy/src/main.cpp`)
- Emulator coordinator → CPU execution: coordinates execution
- CPU execution → Memory bus: accesses memory (evidence: `libs/emulator/src/Cpu.cpp`)
- Emulator coordinator → Console devices: uses peripherals
- Console devices → Vector screen: provides display
- Emulator coordinator → PSG audio: produces audio
- SDL engine → Input mapping: polls controls
- SDL engine → OpenGL rendering: renders frames
- SDL engine → SDL audio: plays samples
- Interactive debugger → Emulator coordinator: inspects execution
- DAP debugger → Symbols and RST: uses debug metadata
