# luuunodotxd/the-freerootsdos architecture

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

- Interactive diagram: https://gitdiagram.com/luuunodotxd/the-freerootsdos
- Repository: https://github.com/luuunodotxd/the-freerootsdos

## Overview

FreeRootSDOS is a minimal 32-bit x86 operating system with a command shell, persistent and RAM filesystems, a graphical Balloon desktop, and networking. The primary user path is input through the shell, command dispatch, then a filesystem, network, or other OS service returning output to the terminal. Balloon provides a parallel graphical entry point to desktop tools. The README documents the broader driver and protocol capabilities; source excerpts and the index show only some wiring, so links to unsampled subsystems are included only where documented, and uncertain calls are omitted.

Main entry points: [`shell/shell.c`](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/shell.c) (Interactive shell), [`gui/balloon.c`](https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/balloon.c) (Balloon desktop), [`fs/fs_disk.c`](https://github.com/luuunodotxd/the-freerootsdos/blob/main/fs/fs_disk.c) (Persistent filesystem), [`net/net.c`](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/net.c) (Network protocols)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Kernel services"]
  node_kernel["Kernel entry<br/>[kernel.c]"]
  node_interrupts["IDT and timer<br/>[idt.c]"]
  node_heap["Kernel heap<br/>[kmalloc.c]"]
end

subgraph group_shell["Shell and tools"]
  node_shell_main["Interactive shell<br/>[shell.c]"]
  node_terminal["Text terminal<br/>[terminal.c]"]
  node_virtual_tty["Virtual terminals<br/>[tty.c]"]
  node_environment["Environment variables<br/>[env.c]"]
  node_programs["Shell programs<br/>[programs.c]"]
end

subgraph group_storage["Filesystems and storage"]
  node_ram_fs[("RAM filesystem<br/>[fs.c]")]
  node_disk_fs[("Persistent filesystem<br/>[fs_disk.c]")]
end

subgraph group_network["Networking"]
  node_net_stack["Network protocols<br/>[net.c]"]
  node_arp["ARP<br/>[arp.c]"]
  node_ip["IP and ICMP<br/>[ip.c]"]
  node_transport["TCP and UDP<br/>[tcp.c]"]
  node_dns["DNS<br/>[dns.c]"]
end

subgraph group_desktop["Balloon desktop"]
  node_balloon["Balloon desktop<br/>[balloon.c]"]
  node_minesweeper["Minesweeper<br/>[minesweeper.c]"]
  node_bmp["BMP viewer<br/>[bmp.c]"]
end

subgraph group_devices["Device drivers"]
  node_ata["ATA disk<br/>[disk.c]"]
  node_storage_hal["Storage interface<br/>[storage.c]"]
  node_net_hal["Network device HAL<br/>[netdev.c]"]
  node_nic_drivers["NIC drivers"]
  node_sound_hal["Sound HAL<br/>[sound.c]"]
  node_sound_drivers["Sound drivers"]
  node_input["PS/2 input<br/>[keyboard.c]"]
  node_video["VGA video<br/>[vga12h.c]"]
end

node_user(("User"))
node_network_peer(("Network peer"))
node_disk[("Disk hardware")]

node_user -->|"enters commands"| node_shell_main
node_shell_main -->|"reads and prints"| node_terminal
node_shell_main -->|"dispatches tools"| node_programs
node_shell_main -->|"switches terminals"| node_virtual_tty
node_shell_main -->|"expands variables"| node_environment
node_programs -->|"reads and writes"| node_ram_fs
node_shell_main -->|"runs filesystem commands"| node_ram_fs
node_shell_main -->|"runs disk commands"| node_disk_fs
node_programs -->|"loads and saves files"| node_disk_fs
node_disk_fs -->|"reads and writes sectors"| node_ata
node_disk_fs -->|"allocates file buffers"| node_heap
node_kernel -.->|"initializes interrupts"| node_interrupts
node_kernel -.->|"initializes heap"| node_heap
node_interrupts -->|"dispatches IRQs"| node_input
node_shell_main -->|"runs network commands"| node_net_stack
node_shell_main -->|"reports active adapter"| node_net_hal
node_net_stack -.->|"uses address resolution"| node_arp
node_net_stack -.->|"handles IP traffic"| node_ip
node_net_stack -.->|"handles transport"| node_transport
node_dns -->|"queries via UDP"| node_transport
node_net_hal -.->|"selects detected driver"| node_nic_drivers
node_net_stack -->|"exchanges packets"| node_network_peer
node_user -->|"opens desktop"| node_balloon
node_balloon -->|"draws interface"| node_video
node_balloon -->|"reads keyboard and mouse"| node_input
node_balloon -->|"hosts terminal"| node_terminal
node_balloon -.->|"submits commands"| node_shell_main
node_balloon -->|"browses files"| node_ram_fs
node_balloon -->|"accesses disk files"| node_disk_fs
node_balloon -->|"opens game"| node_minesweeper
node_balloon -.->|"offers image viewing"| node_bmp
node_sound_hal -->|"selects detected driver"| node_sound_drivers
node_programs -.->|"requests sound"| node_sound_hal
node_disk_fs -->|"persists data"| node_disk

click node_kernel "https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/kernel.c"
click node_interrupts "https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/idt.c"
click node_heap "https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/kmalloc.c"
click node_shell_main "https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/shell.c"
click node_terminal "https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/terminal.c"
click node_virtual_tty "https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/tty.c"
click node_environment "https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/env.c"
click node_programs "https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/programs.c"
click node_ram_fs "https://github.com/luuunodotxd/the-freerootsdos/blob/main/fs/fs.c"
click node_disk_fs "https://github.com/luuunodotxd/the-freerootsdos/blob/main/fs/fs_disk.c"
click node_ata "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/storage/ata/disk.c"
click node_storage_hal "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/storage/storage.c"
click node_net_stack "https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/net.c"
click node_arp "https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/arp.c"
click node_ip "https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/ip.c"
click node_transport "https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/tcp.c"
click node_dns "https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/dns.c"
click node_net_hal "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/net/netdev.c"
click node_nic_drivers "https://github.com/luuunodotxd/the-freerootsdos/tree/main/drivers/net"
click node_sound_hal "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/sound/sound.c"
click node_sound_drivers "https://github.com/luuunodotxd/the-freerootsdos/tree/main/drivers/sound"
click node_input "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/input/ps2/keyboard.c"
click node_video "https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/video/vga/vga12h.c"
click node_balloon "https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/balloon.c"
click node_minesweeper "https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/minesweeper.c"
click node_bmp "https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/bmp.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_kernel,node_interrupts,node_heap,node_user toneBlue
class node_shell_main,node_terminal,node_virtual_tty,node_environment,node_programs,node_disk toneAmber
class node_ram_fs,node_disk_fs toneMint
class node_net_stack,node_arp,node_ip,node_transport,node_dns toneRose
class node_balloon,node_minesweeper,node_bmp,node_network_peer toneIndigo
class node_ata,node_storage_hal,node_net_hal,node_nic_drivers,node_sound_hal,node_sound_drivers,node_input,node_video toneTeal
```

## Components

### Kernel services

- [Kernel entry](https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/kernel.c): `kernel/kernel.c`
- [IDT and timer](https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/idt.c): `kernel/idt.c`
- [Kernel heap](https://github.com/luuunodotxd/the-freerootsdos/blob/main/kernel/kmalloc.c): `kernel/kmalloc.c`

### Shell and tools

- [Interactive shell](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/shell.c): `shell/shell.c`
- [Text terminal](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/terminal.c): `shell/terminal.c`
- [Virtual terminals](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/tty.c): `shell/tty.c`
- [Environment variables](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/env.c): `shell/env.c`
- [Shell programs](https://github.com/luuunodotxd/the-freerootsdos/blob/main/shell/programs.c): `shell/programs.c`

### Filesystems and storage

- [RAM filesystem](https://github.com/luuunodotxd/the-freerootsdos/blob/main/fs/fs.c): `fs/fs.c`
- [Persistent filesystem](https://github.com/luuunodotxd/the-freerootsdos/blob/main/fs/fs_disk.c): `fs/fs_disk.c`

### Networking

- [Network protocols](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/net.c): `net/net.c`
- [ARP](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/arp.c): `net/arp.c`
- [IP and ICMP](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/ip.c): `net/ip.c`
- [TCP and UDP](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/tcp.c): `net/tcp.c`
- [DNS](https://github.com/luuunodotxd/the-freerootsdos/blob/main/net/dns.c): `net/dns.c`

### Balloon desktop

- [Balloon desktop](https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/balloon.c): `gui/balloon.c`
- [Minesweeper](https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/minesweeper.c): `gui/minesweeper.c`
- [BMP viewer](https://github.com/luuunodotxd/the-freerootsdos/blob/main/gui/bmp.c): `gui/bmp.c`

### Device drivers

- [ATA disk](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/storage/ata/disk.c): `drivers/storage/ata/disk.c`
- [Storage interface](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/storage/storage.c): `drivers/storage/storage.c`
- [Network device HAL](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/net/netdev.c): `drivers/net/netdev.c`
- [NIC drivers](https://github.com/luuunodotxd/the-freerootsdos/tree/main/drivers/net): `drivers/net`
- [Sound HAL](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/sound/sound.c): `drivers/sound/sound.c`
- [Sound drivers](https://github.com/luuunodotxd/the-freerootsdos/tree/main/drivers/sound): `drivers/sound`
- [PS/2 input](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/input/ps2/keyboard.c): `drivers/input/ps2/keyboard.c`
- [VGA video](https://github.com/luuunodotxd/the-freerootsdos/blob/main/drivers/video/vga/vga12h.c): `drivers/video/vga/vga12h.c`

### Other components

- **User**
- **Network peer**
- **Disk hardware**

## Connections

- User → Interactive shell: enters commands (evidence: `README.md`)
- Interactive shell → Text terminal: reads and prints (evidence: `shell/shell.c`)
- Interactive shell → Shell programs: dispatches tools (evidence: `shell/shell.c`)
- Interactive shell → Virtual terminals: switches terminals (evidence: `shell/shell.c`)
- Interactive shell → Environment variables: expands variables (evidence: `README.md`)
- Shell programs → RAM filesystem: reads and writes (evidence: `shell/programs.c`)
- Interactive shell → RAM filesystem: runs filesystem commands (evidence: `shell/shell.c`)
- Interactive shell → Persistent filesystem: runs disk commands (evidence: `shell/shell.c`)
- Shell programs → Persistent filesystem: loads and saves files (evidence: `shell/programs.c`)
- Persistent filesystem → ATA disk: reads and writes sectors (evidence: `fs/fs_disk.c`)
- Persistent filesystem → Kernel heap: allocates file buffers (evidence: `fs/fs_disk.c`)
- Kernel entry → IDT and timer: initializes interrupts
- Kernel entry → Kernel heap: initializes heap
- IDT and timer → PS/2 input: dispatches IRQs (evidence: `kernel/idt.c`)
- Interactive shell → Network protocols: runs network commands (evidence: `shell/shell.c`)
- Interactive shell → Network device HAL: reports active adapter (evidence: `shell/shell.c`)
- Network protocols → ARP: uses address resolution
- Network protocols → IP and ICMP: handles IP traffic
- Network protocols → TCP and UDP: handles transport
- DNS → TCP and UDP: queries via UDP (evidence: `net/dns.c`)
- Network device HAL → NIC drivers: selects detected driver
- Network protocols → Network peer: exchanges packets (evidence: `README.md`)
- User → Balloon desktop: opens desktop (evidence: `README.md`)
- Balloon desktop → VGA video: draws interface (evidence: `gui/balloon.c`)
- Balloon desktop → PS/2 input: reads keyboard and mouse (evidence: `gui/balloon.c`)
- Balloon desktop → Text terminal: hosts terminal (evidence: `gui/balloon.c`)
- Balloon desktop → Interactive shell: submits commands
- Balloon desktop → RAM filesystem: browses files (evidence: `gui/balloon.c`)
- Balloon desktop → Persistent filesystem: accesses disk files (evidence: `gui/balloon.c`)
- Balloon desktop → Minesweeper: opens game (evidence: `README.md`)
- Balloon desktop → BMP viewer: offers image viewing
- Sound HAL → Sound drivers: selects detected driver (evidence: `README.md`)
- Shell programs → Sound HAL: requests sound
- Persistent filesystem → Disk hardware: persists data (evidence: `README.md`)
