# mamedev/mame architecture

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

- Interactive diagram: https://gitdiagram.com/mamedev/mame
- Repository: https://github.com/mamedev/mame

## Overview

MAME is a preservation-focused emulation framework for arcade games and vintage computers, consoles, and calculators. The principal workflow is selecting and running an emulated system, whose hardware model produces observable video and audio; the sampled Pipeline driver illustrates CPU, peripheral, and rendering stages. Lua exposes machine and rendering facilities, while ATA and Apple Profile/Widget devices model storage interfaces. The excerpts are partial, so the graph focuses on evidenced components and documented product scope rather than inferring links between independently sampled subsystems.

Main entry points: [`src/mame/misc/pipeline.cpp`](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp) (Pipeline driver), [`src/frontend/mame/luaengine.cpp`](https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine.cpp) (Lua engine), [`src/devices/machine/atastorage.cpp`](https://github.com/mamedev/mame/blob/master/src/devices/machine/atastorage.cpp) (ATA storage), [`src/frontend/mame/luaengine_render.cpp`](https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine_render.cpp) (Lua rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_systems["System emulation"]
  node_pipeline["Pipeline driver<br/>[pipeline.cpp]"]
  node_cpu["Emulated CPUs<br/>[pipeline.cpp]"]
  node_peripherals["Board peripherals<br/>[pipeline.cpp]"]
  node_video["Video output<br/>[pipeline.cpp]"]
  node_audio["Audio output<br/>[pipeline.cpp]"]
end

subgraph group_interfaces["User interfaces"]
  node_lua["Lua engine<br/>[luaengine.cpp]"]
  node_lua_render["Lua rendering"]
end

subgraph group_storage["Storage emulation"]
  node_ata["ATA storage<br/>[atastorage.cpp]"]
  node_harddisk[("Hard disk image<br/>[atastorage.h]")]
  node_apple_storage["ApplePP storage<br/>[storagehle.cpp]"]
end

node_user(("MAME user"))

node_user -->|"scripts"| node_lua
node_lua -->|"controls core"| node_pipeline
node_lua -->|"uses bindings"| node_lua_render
node_pipeline -->|"configures"| node_cpu
node_pipeline -->|"maps I/O"| node_peripherals
node_pipeline -->|"renders"| node_video
node_pipeline -->|"routes sound"| node_audio
node_ata -->|"reads/writes sectors"| node_harddisk

click node_lua "https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine.cpp"
click node_lua_render "https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine_render.cpp"
click node_pipeline "https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp"
click node_cpu "https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp"
click node_peripherals "https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp"
click node_video "https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp"
click node_audio "https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp"
click node_ata "https://github.com/mamedev/mame/blob/master/src/devices/machine/atastorage.cpp"
click node_harddisk "https://github.com/mamedev/mame/blob/master/src/devices/machine/atastorage.h"
click node_apple_storage "https://github.com/mamedev/mame/blob/master/src/devices/bus/applepp/storagehle.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_pipeline,node_cpu,node_peripherals,node_video,node_audio,node_user toneBlue
class node_lua,node_lua_render toneAmber
class node_ata,node_harddisk,node_apple_storage toneMint
```

## Components

### System emulation

- [Pipeline driver](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp): `src/mame/misc/pipeline.cpp`
- [Emulated CPUs](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp): `src/mame/misc/pipeline.cpp`
- [Board peripherals](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp): `src/mame/misc/pipeline.cpp`
- [Video output](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp): `src/mame/misc/pipeline.cpp`
- [Audio output](https://github.com/mamedev/mame/blob/master/src/mame/misc/pipeline.cpp): `src/mame/misc/pipeline.cpp`

### User interfaces

- [Lua engine](https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine.cpp): `src/frontend/mame/luaengine.cpp`
- [Lua rendering](https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine_render.cpp): `src/frontend/mame/luaengine_render.cpp`

### Storage emulation

- [ATA storage](https://github.com/mamedev/mame/blob/master/src/devices/machine/atastorage.cpp): `src/devices/machine/atastorage.cpp`
- [Hard disk image](https://github.com/mamedev/mame/blob/master/src/devices/machine/atastorage.h): `src/devices/machine/atastorage.h`
- [ApplePP storage](https://github.com/mamedev/mame/blob/master/src/devices/bus/applepp/storagehle.cpp): `src/devices/bus/applepp/storagehle.cpp`

### Other components

- **MAME user**

## Connections

- MAME user → Lua engine: scripts
- Lua engine → Pipeline driver: controls core
- Lua engine → Lua rendering: uses bindings
- Pipeline driver → Emulated CPUs: configures
- Pipeline driver → Board peripherals: maps I/O
- Pipeline driver → Video output: renders
- Pipeline driver → Audio output: routes sound
- ATA storage → Hard disk image: reads/writes sectors
