# encrize/fukos architecture

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

- Interactive diagram: https://gitdiagram.com/encrize/fukos
- Repository: https://github.com/encrize/fukos

## Overview

fukOS is a freestanding i686 operating system whose user-facing path runs from keyboard input through the shell to filesystem commands, built-in applications, or external FUK programs. It also integrates Doom Generic, with gameplay, graphics, and persistent saves, alongside storage and hardware services. The README documents the major capabilities; source excerpts and the index support selected module links, but many subsystem implementations were not sampled, so uncertain internal calls are omitted.

Main entry points: [`kernel/shell.c`](https://github.com/encrize/fukos/blob/main/kernel/shell.c) (Shell), [`kernel/app.c`](https://github.com/encrize/fukos/blob/main/kernel/app.c) (FUK1 virtual machine), [`kernel/fat.c`](https://github.com/encrize/fukos/blob/main/kernel/fat.c) (FAT filesystem), [`doom/g_game.c`](https://github.com/encrize/fukos/blob/main/doom/g_game.c) (Game simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interaction"]
  node_shell["Shell<br/>[shell.c]"]
  node_console["Framebuffer console<br/>[console.c]"]
  node_keyboard["Keyboard input<br/>[keyboard.c]"]
end

subgraph group_storage["Storage and media"]
  node_fat["FAT filesystem<br/>[fat.c]"]
  node_ata["ATA PIO<br/>[ata.c]"]
  node_usb["USB mass storage<br/>[xhci.c]"]
end

subgraph group_apps["Applications"]
  node_fukvm["FUK1 virtual machine<br/>[app.c]"]
  node_fukparse["FUK parser<br/>[fuk_parse.c]"]
  node_fuklabels["FUK labels<br/>[fuk_labels.c]"]
  node_image["Image viewer<br/>[image.c]"]
end

subgraph group_doom["Doom runtime"]
  node_doomhost["Doom kernel port<br/>[doomgeneric.c]"]
  node_doommain["Doom startup loop<br/>[d_main.c]"]
  node_game["Game simulation<br/>[g_game.c]"]
  node_renderer["Doom renderer<br/>[r_main.c]"]
  node_saves["Doom savegame<br/>[p_saveg.c]"]
end

subgraph group_platform["Kernel platform"]
  node_heap["Kernel heap<br/>[heap.c]"]
  node_audio["HDA audio<br/>[hda.c]"]
  node_boot["Multiboot2 setup<br/>[multiboot2.c]"]
  node_framebuffer["Framebuffer driver<br/>[framebuffer.c]"]
end

node_user(("User"))

node_user -->|"provides input"| node_keyboard
node_keyboard -->|"drives commands"| node_shell
node_shell -->|"renders interface"| node_console
node_shell -->|"runs file commands"| node_fat
node_shell -->|"starts apps"| node_fukvm
node_fukvm -->|"loads app files"| node_fat
node_fukvm -->|"parses instructions"| node_fukparse
node_fukvm -->|"uses labels"| node_fuklabels
node_fukvm -->|"prints output"| node_console
node_fukvm -->|"allocates memory"| node_heap
node_shell -->|"opens images"| node_image
node_shell -->|"controls playback"| node_audio
node_shell -->|"launches Doom"| node_doomhost
node_doomhost -.->|"enters engine"| node_doommain
node_doommain -->|"runs gameplay"| node_game
node_game -.->|"updates display"| node_renderer
node_game -->|"loads and saves"| node_saves
node_saves -->|"persists save files"| node_fat
node_fat -->|"uses ATA storage"| node_ata
node_fat -->|"uses USB storage"| node_usb
node_boot -.->|"sets graphics"| node_framebuffer

click node_shell "https://github.com/encrize/fukos/blob/main/kernel/shell.c"
click node_console "https://github.com/encrize/fukos/blob/main/kernel/console.c"
click node_keyboard "https://github.com/encrize/fukos/blob/main/kernel/keyboard.c"
click node_fat "https://github.com/encrize/fukos/blob/main/kernel/fat.c"
click node_ata "https://github.com/encrize/fukos/blob/main/kernel/ata.c"
click node_usb "https://github.com/encrize/fukos/blob/main/kernel/xhci.c"
click node_heap "https://github.com/encrize/fukos/blob/main/kernel/heap.c"
click node_fukvm "https://github.com/encrize/fukos/blob/main/kernel/app.c"
click node_fukparse "https://github.com/encrize/fukos/blob/main/kernel/fuk_parse.c"
click node_fuklabels "https://github.com/encrize/fukos/blob/main/kernel/fuk_labels.c"
click node_image "https://github.com/encrize/fukos/blob/main/kernel/image.c"
click node_audio "https://github.com/encrize/fukos/blob/main/kernel/hda.c"
click node_doomhost "https://github.com/encrize/fukos/blob/main/doom/doomgeneric.c"
click node_doommain "https://github.com/encrize/fukos/blob/main/doom/d_main.c"
click node_game "https://github.com/encrize/fukos/blob/main/doom/g_game.c"
click node_renderer "https://github.com/encrize/fukos/blob/main/doom/r_main.c"
click node_saves "https://github.com/encrize/fukos/blob/main/doom/p_saveg.c"
click node_boot "https://github.com/encrize/fukos/blob/main/kernel/multiboot2.c"
click node_framebuffer "https://github.com/encrize/fukos/blob/main/kernel/framebuffer.c"

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_shell,node_console,node_keyboard,node_user toneBlue
class node_fat,node_ata,node_usb toneAmber
class node_fukvm,node_fukparse,node_fuklabels,node_image toneMint
class node_doomhost,node_doommain,node_game,node_renderer,node_saves toneRose
class node_heap,node_audio,node_boot,node_framebuffer toneIndigo
```

## Components

### User interaction

- [Shell](https://github.com/encrize/fukos/blob/main/kernel/shell.c): `kernel/shell.c`
- [Framebuffer console](https://github.com/encrize/fukos/blob/main/kernel/console.c): `kernel/console.c`
- [Keyboard input](https://github.com/encrize/fukos/blob/main/kernel/keyboard.c): `kernel/keyboard.c`

### Storage and media

- [FAT filesystem](https://github.com/encrize/fukos/blob/main/kernel/fat.c): `kernel/fat.c`
- [ATA PIO](https://github.com/encrize/fukos/blob/main/kernel/ata.c): `kernel/ata.c`
- [USB mass storage](https://github.com/encrize/fukos/blob/main/kernel/xhci.c): `kernel/xhci.c`

### Applications

- [FUK1 virtual machine](https://github.com/encrize/fukos/blob/main/kernel/app.c): `kernel/app.c`
- [FUK parser](https://github.com/encrize/fukos/blob/main/kernel/fuk_parse.c): `kernel/fuk_parse.c`
- [FUK labels](https://github.com/encrize/fukos/blob/main/kernel/fuk_labels.c): `kernel/fuk_labels.c`
- [Image viewer](https://github.com/encrize/fukos/blob/main/kernel/image.c): `kernel/image.c`

### Doom runtime

- [Doom kernel port](https://github.com/encrize/fukos/blob/main/doom/doomgeneric.c): `doom/doomgeneric.c`
- [Doom startup loop](https://github.com/encrize/fukos/blob/main/doom/d_main.c): `doom/d_main.c`
- [Game simulation](https://github.com/encrize/fukos/blob/main/doom/g_game.c): `doom/g_game.c`
- [Doom renderer](https://github.com/encrize/fukos/blob/main/doom/r_main.c): `doom/r_main.c`
- [Doom savegame](https://github.com/encrize/fukos/blob/main/doom/p_saveg.c): `doom/p_saveg.c`

### Kernel platform

- [Kernel heap](https://github.com/encrize/fukos/blob/main/kernel/heap.c): `kernel/heap.c`
- [HDA audio](https://github.com/encrize/fukos/blob/main/kernel/hda.c): `kernel/hda.c`
- [Multiboot2 setup](https://github.com/encrize/fukos/blob/main/kernel/multiboot2.c): `kernel/multiboot2.c`
- [Framebuffer driver](https://github.com/encrize/fukos/blob/main/kernel/framebuffer.c): `kernel/framebuffer.c`

### Other components

- **User**

## Connections

- User → Keyboard input: provides input
- Keyboard input → Shell: drives commands
- Shell → Framebuffer console: renders interface
- Shell → FAT filesystem: runs file commands
- Shell → FUK1 virtual machine: starts apps
- FUK1 virtual machine → FAT filesystem: loads app files (evidence: `kernel/app.c`)
- FUK1 virtual machine → FUK parser: parses instructions (evidence: `kernel/app.c`)
- FUK1 virtual machine → FUK labels: uses labels (evidence: `kernel/app.c`)
- FUK1 virtual machine → Framebuffer console: prints output (evidence: `kernel/app.c`)
- FUK1 virtual machine → Kernel heap: allocates memory (evidence: `kernel/app.c`)
- Shell → Image viewer: opens images
- Shell → HDA audio: controls playback
- Shell → Doom kernel port: launches Doom
- Doom kernel port → Doom startup loop: enters engine
- Doom startup loop → Game simulation: runs gameplay (evidence: `doom/d_main.c`)
- Game simulation → Doom renderer: updates display
- Game simulation → Doom savegame: loads and saves
- Doom savegame → FAT filesystem: persists save files
- FAT filesystem → ATA PIO: uses ATA storage (evidence: `kernel/fat.c`)
- FAT filesystem → USB mass storage: uses USB storage (evidence: `kernel/fat.c`)
- Multiboot2 setup → Framebuffer driver: sets graphics
