# timoheimonen/amiga-lemmings-editor architecture

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

- Interactive diagram: https://gitdiagram.com/timoheimonen/amiga-lemmings-editor
- Repository: https://github.com/timoheimonen/amiga-lemmings-editor

## Overview

This repository patches the original Amiga Lemmings game with an in-game custom-level editor. The principal workflow is: select or create a custom level, edit and save it, then play it from the one- or two-player list. Floppy level-disk management and WHDLoad `.lvl` storage are alternate persistence paths; `savedisk.py` also supports level exchange outside the game. Assembly connections below reflect README-documented behavior; the assembly source itself was not sampled, so internal call details are not asserted.

Main entry points: [`src/editor.s`](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/editor.s) (Level editor), [`src/levels.s`](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/levels.s) (Custom level lists), [`src/title.s`](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/title.s) (Title and menu), [`src/disk_io.s`](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/disk_io.s) (Floppy disk I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["In-game experience"]
  node_title["Title and menu<br/>[title.s]"]
  node_level_menu["Custom level lists<br/>[levels.s]"]
  node_gameplay["Lemmings gameplay<br/>[menu.s]"]
end

subgraph group_editing["Level editing"]
  node_editor["Level editor<br/>[editor.s]"]
  node_terrain["Terrain editing<br/>[editor.s]"]
  node_steel["Steel editing<br/>[steel.s]"]
  node_objects["Object editing<br/>[objects.s]"]
  node_parameters["Parameter editing<br/>[params.s]"]
  node_undo["Undo and redo<br/>[undo.s]"]
end

subgraph group_storage["Level storage"]
  node_save["Save level<br/>[level_save.s]"]
  node_delete["Delete level<br/>[level_delete.s]"]
  node_disk_io["Floppy disk I/O<br/>[disk_io.s]"]
  node_disk_codec["Level disk codec<br/>[disk_codec.s]"]
  node_level_disk[("Level disk")]
  node_savedisk["Disk and level exchange<br/>[savedisk.py]"]
end

subgraph group_distribution["Patch and install"]
  node_patcher["Game disk patcher<br/>[patch.py]"]
  node_whdload_slave["WHDLoad runtime<br/>[slave.s]"]
  node_whdload_files[("WHDLoad level files<br/>[disk_file.s]")]
end

node_player(("Amiga player"))

node_player -->|"starts game"| node_title
node_title -->|"opens CUSTOM"| node_level_menu
node_title -->|"creates level"| node_editor
node_level_menu -->|"plays selection"| node_gameplay
node_level_menu -->|"opens for editing"| node_editor
node_level_menu -->|"deletes selection"| node_delete
node_editor -->|"edits terrain"| node_terrain
node_editor -->|"edits steel"| node_steel
node_editor -->|"edits objects"| node_objects
node_editor -->|"edits parameters"| node_parameters
node_editor -->|"undoes changes"| node_undo
node_editor -->|"saves level"| node_save
node_save -->|"writes level"| node_disk_io
node_disk_io -->|"encodes disk data"| node_disk_codec
node_disk_io -->|"reads and writes"| node_level_disk
node_delete -->|"removes level"| node_disk_io
node_savedisk -->|"manages levels"| node_level_disk
node_savedisk -->|"exchanges .lvl files"| node_player
node_patcher -->|"patches game"| node_title
node_player -->|"starts install"| node_whdload_slave
node_save -.->|"writes .lvl file"| node_whdload_files
node_delete -.->|"deletes .lvl file"| node_whdload_files

click node_title "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/title.s"
click node_level_menu "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/levels.s"
click node_gameplay "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/menu.s"
click node_editor "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/editor.s"
click node_terrain "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/editor.s"
click node_steel "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/steel.s"
click node_objects "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/objects.s"
click node_parameters "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/params.s"
click node_undo "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/undo.s"
click node_save "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/level_save.s"
click node_delete "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/level_delete.s"
click node_disk_io "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/disk_io.s"
click node_disk_codec "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/disk_codec.s"
click node_savedisk "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/savedisk.py"
click node_patcher "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/patch.py"
click node_whdload_slave "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/whdload/src/slave.s"
click node_whdload_files "https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/whdload/src/disk_file.s"

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_title,node_level_menu,node_gameplay toneBlue
class node_editor,node_terrain,node_steel,node_objects,node_parameters,node_undo toneAmber
class node_save,node_delete,node_disk_io,node_disk_codec,node_level_disk,node_savedisk toneMint
class node_patcher,node_whdload_slave,node_whdload_files toneRose
class node_player toneIndigo
```

## Components

### In-game experience

- [Title and menu](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/title.s): `src/title.s`
- [Custom level lists](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/levels.s): `src/levels.s`
- [Lemmings gameplay](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/menu.s): `src/menu.s`

### Level editing

- [Level editor](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/editor.s): `src/editor.s`
- [Terrain editing](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/editor.s): `src/editor.s`
- [Steel editing](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/steel.s): `src/steel.s`
- [Object editing](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/objects.s): `src/objects.s`
- [Parameter editing](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/params.s): `src/params.s`
- [Undo and redo](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/undo.s): `src/undo.s`

### Level storage

- [Save level](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/level_save.s): `src/level_save.s`
- [Delete level](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/level_delete.s): `src/level_delete.s`
- [Floppy disk I/O](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/disk_io.s): `src/disk_io.s`
- [Level disk codec](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/src/disk_codec.s): `src/disk_codec.s`
- **Level disk**
- [Disk and level exchange](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/savedisk.py): `savedisk.py`

### Patch and install

- [Game disk patcher](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/patch.py): `patch.py`
- [WHDLoad runtime](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/whdload/src/slave.s): `whdload/src/slave.s`
- [WHDLoad level files](https://github.com/timoheimonen/amiga-lemmings-editor/blob/main/whdload/src/disk_file.s): `whdload/src/disk_file.s`

### Other components

- **Amiga player**

## Connections

- Amiga player → Title and menu: starts game (evidence: `README.md`)
- Title and menu → Custom level lists: opens CUSTOM (evidence: `README.md`)
- Title and menu → Level editor: creates level (evidence: `README.md`)
- Custom level lists → Lemmings gameplay: plays selection (evidence: `README.md`)
- Custom level lists → Level editor: opens for editing (evidence: `README.md`)
- Custom level lists → Delete level: deletes selection (evidence: `README.md`)
- Level editor → Terrain editing: edits terrain (evidence: `README.md`)
- Level editor → Steel editing: edits steel (evidence: `README.md`)
- Level editor → Object editing: edits objects (evidence: `README.md`)
- Level editor → Parameter editing: edits parameters (evidence: `README.md`)
- Level editor → Undo and redo: undoes changes (evidence: `README.md`)
- Level editor → Save level: saves level (evidence: `README.md`)
- Save level → Floppy disk I/O: writes level (evidence: `README.md`)
- Floppy disk I/O → Level disk codec: encodes disk data (evidence: `README.md`)
- Floppy disk I/O → Level disk: reads and writes (evidence: `README.md`)
- Delete level → Floppy disk I/O: removes level (evidence: `README.md`)
- Disk and level exchange → Level disk: manages levels (evidence: `README.md`)
- Disk and level exchange → Amiga player: exchanges .lvl files (evidence: `README.md`)
- Game disk patcher → Title and menu: patches game (evidence: `README.md`)
- Amiga player → WHDLoad runtime: starts install
- Save level → WHDLoad level files: writes .lvl file (evidence: `README.md`)
- Delete level → WHDLoad level files: deletes .lvl file (evidence: `README.md`)
