# rekcah97/gameboy_emulator architecture

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

- Interactive diagram: https://gitdiagram.com/rekcah97/gameboy_emulator
- Repository: https://github.com/rekcah97/gameboy_emulator

## Overview

This repository is an early Game Boy emulator prototype, but the sampled runtime does not yet show a complete emulation loop or game-loading workflow. The executable prints a banner, constructs a CPU and a separate bus, then exercises a bus read/write. CPU code provides register, fetch, and interrupt behavior; the instruction module implements opcode operations against CPU state. The excerpts do not show CPU dispatching instructions, and the Platform files are empty, so those connections and broader emulator capabilities are not inferred.

Main entry points: [`src/hardware/cpu.cpp`](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/cpu.cpp) (CPU state), [`src/hardware/bus.cpp`](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/bus.cpp) (RAM bus), [`main.cpp`](https://github.com/rekcah97/gameboy_emulator/blob/main/main.cpp) (Demo entry), [`src/hardware/instructions.cpp`](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/instructions.cpp) (Instruction set)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Program entry"]
  node_main["Demo entry<br/>[main.cpp]"]
end

subgraph group_core["Emulation core"]
  node_cpu["CPU state<br/>[cpu.cpp]"]
  node_instructions["Instruction set<br/>[instructions.cpp]"]
end

subgraph group_memory["Memory"]
  node_bus[("RAM bus<br/>[bus.cpp]")]
end

node_main -->|"constructs"| node_cpu
node_main -->|"reads/writes"| node_bus
node_cpu -->|"reads/writes"| node_bus
node_instructions -->|"updates state"| node_cpu
node_instructions -->|"reads/writes"| node_bus

click node_main "https://github.com/rekcah97/gameboy_emulator/blob/main/main.cpp"
click node_cpu "https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/cpu.cpp"
click node_instructions "https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/instructions.cpp"
click node_bus "https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/bus.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_main toneBlue
class node_cpu,node_instructions toneAmber
class node_bus toneMint
```

## Components

### Program entry

- [Demo entry](https://github.com/rekcah97/gameboy_emulator/blob/main/main.cpp): `main.cpp`

### Emulation core

- [CPU state](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/cpu.cpp): `src/hardware/cpu.cpp`
- [Instruction set](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/instructions.cpp): `src/hardware/instructions.cpp`

### Memory

- [RAM bus](https://github.com/rekcah97/gameboy_emulator/blob/main/src/hardware/bus.cpp): `src/hardware/bus.cpp`

## Connections

- Demo entry → CPU state: constructs (evidence: `main.cpp`)
- Demo entry → RAM bus: reads/writes (evidence: `main.cpp`)
- CPU state → RAM bus: reads/writes (evidence: `src/hardware/cpu.cpp`)
- Instruction set → CPU state: updates state (evidence: `src/hardware/instructions.cpp`)
- Instruction set → RAM bus: reads/writes (evidence: `src/hardware/instructions.cpp`)
