# habib256/pom2 architecture

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

- Interactive diagram: https://gitdiagram.com/habib256/pom2
- Repository: https://github.com/habib256/pom2

## Overview

POM2 is a desktop and WebAssembly Apple II emulator. The principal workflow is choosing a machine profile, mounting a disk image, then booting and interacting with the emulated machine. Its runtime combines CPU, memory, and slot devices; supporting branches cover media management, display and input, audio, debugging and rewind, networking, and Apple II graphics tools. The README documents product capabilities; source excerpts and the SOURCE INDEX provide stronger implementation evidence for storage and slot relationships. Unsampled feature wiring is left unasserted.

Main entry points: [`src/EmulationController.cpp`](https://github.com/habib256/pom2/blob/main/src/EmulationController.cpp) (Emulation runtime), [`src/StorageCoordinator.cpp`](https://github.com/habib256/pom2/blob/main/src/StorageCoordinator.cpp) (Storage coordinator), [`src/MainWindow.cpp`](https://github.com/habib256/pom2/blob/main/src/MainWindow.cpp) (Main window), [`src/SlotBus.h`](https://github.com/habib256/pom2/blob/main/src/SlotBus.h) (Slot bus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_machine["Emulated machine"]
  node_machine_profile["Machine profiles<br/>[SystemProfile.cpp]"]
  node_emulation["Emulation runtime"]
  node_cpu_memory["CPU and memory<br/>[Memory.cpp]"]
  node_slot_bus["Slot bus<br/>[SlotBus.h]"]
  node_rewind["Rewind history<br/>[RewindBuffer.cpp]"]
  node_debugger["Debugger<br/>[Debugger.cpp]"]
end

subgraph group_media["Media management"]
  node_storage_coordinator["Storage coordinator"]
  node_disk_images["Disk images<br/>[DiskImage.h]"]
  node_disk_library["Disk library"]
  node_block_backing[("Block storage<br/>[Block512Backing.h]")]
  node_disk_ii["Disk II cards<br/>[DiskIICard.h]"]
  node_smartport["SmartPort storage<br/>[SmartPortCard.h]"]
  node_prodos_hard_disk["ProDOS hard disk"]
end

subgraph group_interface["User interface"]
  node_main_window["Main window<br/>[MainWindow.cpp]"]
  node_display["Apple II display<br/>[Apple2Display.cpp]"]
  node_keyboard["Keyboard input<br/>[Keyboard.cpp]"]
end

subgraph group_devices["Peripherals and services"]
  node_audio["Audio"]
  node_network["Networking"]
end

subgraph group_creative["Graphics tools"]
  node_hgr_paint["Hi-res paint editor<br/>[HgrPaintEditor.cpp]"]
  node_hgr_sprite["Sprite editor"]
  node_paint_model["Paint model<br/>[HgrPaintModel.cpp]"]
end

node_user(("User"))

node_user -->|"operates"| node_main_window
node_user -->|"chooses"| node_machine_profile
node_machine_profile -.->|"configures"| node_emulation
node_user -->|"selects image"| node_disk_images
node_disk_library -->|"browses"| node_disk_images
node_main_window -.->|"routes media commands"| node_storage_coordinator
node_storage_coordinator -->|"inspects cards"| node_slot_bus
node_storage_coordinator -->|"mounts media"| node_disk_ii
node_storage_coordinator -->|"manages bays"| node_prodos_hard_disk
node_storage_coordinator -->|"manages bays"| node_smartport
node_prodos_hard_disk -->|"uses storage"| node_block_backing
node_smartport -->|"exposes backings"| node_block_backing
node_slot_bus -->|"hosts card"| node_disk_ii
node_emulation -.->|"runs machine"| node_cpu_memory
node_emulation -->|"accesses slots"| node_slot_bus
node_emulation -.->|"tracks history"| node_rewind
node_emulation -.->|"supports debugging"| node_debugger
node_main_window -->|"shows screen"| node_display
node_main_window -->|"accepts input"| node_keyboard
node_emulation -.->|"produces sound"| node_audio
node_emulation -.->|"supports networking"| node_network
node_user -.->|"edits graphics"| node_hgr_paint
node_user -.->|"edits sprites"| node_hgr_sprite
node_hgr_paint -->|"edits model"| node_paint_model
node_hgr_sprite -->|"uses model"| node_paint_model

click node_machine_profile "https://github.com/habib256/pom2/blob/main/src/SystemProfile.cpp"
click node_emulation "https://github.com/habib256/pom2/blob/main/src/EmulationController.cpp"
click node_cpu_memory "https://github.com/habib256/pom2/blob/main/src/Memory.cpp"
click node_slot_bus "https://github.com/habib256/pom2/blob/main/src/SlotBus.h"
click node_rewind "https://github.com/habib256/pom2/blob/main/src/RewindBuffer.cpp"
click node_debugger "https://github.com/habib256/pom2/blob/main/src/Debugger.cpp"
click node_storage_coordinator "https://github.com/habib256/pom2/blob/main/src/StorageCoordinator.cpp"
click node_disk_images "https://github.com/habib256/pom2/blob/main/src/DiskImage.h"
click node_disk_library "https://github.com/habib256/pom2/blob/main/src/DiskLibrary_ImGui.cpp"
click node_block_backing "https://github.com/habib256/pom2/blob/main/src/Block512Backing.h"
click node_disk_ii "https://github.com/habib256/pom2/blob/main/src/DiskIICard.h"
click node_smartport "https://github.com/habib256/pom2/blob/main/src/SmartPortCard.h"
click node_prodos_hard_disk "https://github.com/habib256/pom2/blob/main/src/ProDOSHardDiskCard.h"
click node_main_window "https://github.com/habib256/pom2/blob/main/src/MainWindow.cpp"
click node_display "https://github.com/habib256/pom2/blob/main/src/Apple2Display.cpp"
click node_keyboard "https://github.com/habib256/pom2/blob/main/src/Keyboard.cpp"
click node_audio "https://github.com/habib256/pom2/blob/main/src/AudioCoordinator.cpp"
click node_network "https://github.com/habib256/pom2/blob/main/src/NetworkCoordinator.cpp"
click node_hgr_paint "https://github.com/habib256/pom2/blob/main/src/hgrpaint/HgrPaintEditor.cpp"
click node_hgr_sprite "https://github.com/habib256/pom2/blob/main/src/hgrsprite/HgrSpriteEditor.cpp"
click node_paint_model "https://github.com/habib256/pom2/blob/main/src/hgrpaint/HgrPaintModel.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_machine_profile,node_emulation,node_cpu_memory,node_slot_bus,node_rewind,node_debugger,node_user toneBlue
class node_storage_coordinator,node_disk_images,node_disk_library,node_block_backing,node_disk_ii,node_smartport,node_prodos_hard_disk toneAmber
class node_main_window,node_display,node_keyboard toneMint
class node_audio,node_network toneRose
class node_hgr_paint,node_hgr_sprite,node_paint_model toneIndigo
```

## Components

### Emulated machine

- [Machine profiles](https://github.com/habib256/pom2/blob/main/src/SystemProfile.cpp): `src/SystemProfile.cpp`
- [Emulation runtime](https://github.com/habib256/pom2/blob/main/src/EmulationController.cpp): `src/EmulationController.cpp`
- [CPU and memory](https://github.com/habib256/pom2/blob/main/src/Memory.cpp): `src/Memory.cpp`
- [Slot bus](https://github.com/habib256/pom2/blob/main/src/SlotBus.h): `src/SlotBus.h`
- [Rewind history](https://github.com/habib256/pom2/blob/main/src/RewindBuffer.cpp): `src/RewindBuffer.cpp`
- [Debugger](https://github.com/habib256/pom2/blob/main/src/Debugger.cpp): `src/Debugger.cpp`

### Media management

- [Storage coordinator](https://github.com/habib256/pom2/blob/main/src/StorageCoordinator.cpp): `src/StorageCoordinator.cpp`
- [Disk images](https://github.com/habib256/pom2/blob/main/src/DiskImage.h): `src/DiskImage.h`
- [Disk library](https://github.com/habib256/pom2/blob/main/src/DiskLibrary_ImGui.cpp): `src/DiskLibrary_ImGui.cpp`
- [Block storage](https://github.com/habib256/pom2/blob/main/src/Block512Backing.h): `src/Block512Backing.h`
- [Disk II cards](https://github.com/habib256/pom2/blob/main/src/DiskIICard.h): `src/DiskIICard.h`
- [SmartPort storage](https://github.com/habib256/pom2/blob/main/src/SmartPortCard.h): `src/SmartPortCard.h`
- [ProDOS hard disk](https://github.com/habib256/pom2/blob/main/src/ProDOSHardDiskCard.h): `src/ProDOSHardDiskCard.h`

### User interface

- [Main window](https://github.com/habib256/pom2/blob/main/src/MainWindow.cpp): `src/MainWindow.cpp`
- [Apple II display](https://github.com/habib256/pom2/blob/main/src/Apple2Display.cpp): `src/Apple2Display.cpp`
- [Keyboard input](https://github.com/habib256/pom2/blob/main/src/Keyboard.cpp): `src/Keyboard.cpp`

### Peripherals and services

- [Audio](https://github.com/habib256/pom2/blob/main/src/AudioCoordinator.cpp): `src/AudioCoordinator.cpp`
- [Networking](https://github.com/habib256/pom2/blob/main/src/NetworkCoordinator.cpp): `src/NetworkCoordinator.cpp`

### Graphics tools

- [Hi-res paint editor](https://github.com/habib256/pom2/blob/main/src/hgrpaint/HgrPaintEditor.cpp): `src/hgrpaint/HgrPaintEditor.cpp`
- [Sprite editor](https://github.com/habib256/pom2/blob/main/src/hgrsprite/HgrSpriteEditor.cpp): `src/hgrsprite/HgrSpriteEditor.cpp`
- [Paint model](https://github.com/habib256/pom2/blob/main/src/hgrpaint/HgrPaintModel.cpp): `src/hgrpaint/HgrPaintModel.cpp`

### Other components

- **User**

## Connections

- User → Main window: operates
- User → Machine profiles: chooses
- Machine profiles → Emulation runtime: configures
- User → Disk images: selects image
- Disk library → Disk images: browses
- Main window → Storage coordinator: routes media commands
- Storage coordinator → Slot bus: inspects cards (evidence: `src/StorageCoordinator.cpp`)
- Storage coordinator → Disk II cards: mounts media (evidence: `src/StorageCoordinator.cpp`)
- Storage coordinator → ProDOS hard disk: manages bays (evidence: `src/StorageCoordinator.cpp`)
- Storage coordinator → SmartPort storage: manages bays (evidence: `src/StorageCoordinator.cpp`)
- ProDOS hard disk → Block storage: uses storage (evidence: `src/ProDOSHardDiskCard.h`)
- SmartPort storage → Block storage: exposes backings (evidence: `src/SmartPortCard.h`)
- Slot bus → Disk II cards: hosts card (evidence: `src/SlotBus.h`)
- Emulation runtime → CPU and memory: runs machine
- Emulation runtime → Slot bus: accesses slots
- Emulation runtime → Rewind history: tracks history
- Emulation runtime → Debugger: supports debugging
- Main window → Apple II display: shows screen
- Main window → Keyboard input: accepts input
- Emulation runtime → Audio: produces sound
- Emulation runtime → Networking: supports networking
- User → Hi-res paint editor: edits graphics
- User → Sprite editor: edits sprites
- Hi-res paint editor → Paint model: edits model (evidence: `src/hgrpaint/HgrPaintEditor.cpp`)
- Sprite editor → Paint model: uses model (evidence: `src/hgrsprite/HgrSpriteEditor.cpp`)
