# moinnuddinnn/monos architecture

> Architecture diagram of the GitHub repository moinnuddinnn/monos, 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/moinnuddinnn/monos
- Repository: https://github.com/moinnuddinnn/monos

## Overview

AtariOS is a small sample operating system with a bootloader, kernel, terminal shell, calculator, and disk-backed filesystem. The intended user workflow is to boot into the kernel, use keyboard input to interact with the shell, and issue commands for help, calculation, or file operations. The kernel sets up interrupt handling and the keyboard before initializing the filesystem and shell. The excerpts show shell command dispatch and filesystem-to-disk calls, but do not show a complete keyboard-to-shell input path; that connection is therefore omitted.

Main entry points: [`kernel.c`](https://github.com/moinnuddinnn/monos/blob/main/kernel.c) (Kernel startup), [`shell.c`](https://github.com/moinnuddinnn/monos/blob/main/shell.c) (Command shell), [`fs.c`](https://github.com/moinnuddinnn/monos/blob/main/fs.c) (Filesystem), [`calc.c`](https://github.com/moinnuddinnn/monos/blob/main/calc.c) (Calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and kernel"]
  node_bootloader["Bootloader<br/>[boot.asm]"]
  node_kernel["Kernel startup<br/>[kernel.c]"]
end

subgraph group_interrupts["Interrupt input"]
  node_idt["IDT setup<br/>[idt.c]"]
  node_isr["CPU exceptions<br/>[isr.c]"]
  node_irq["IRQ controller<br/>[irq.c]"]
  node_keyboard["Keyboard driver<br/>[keyboard.c]"]
end

subgraph group_interaction["Terminal and commands"]
  node_shell["Command shell<br/>[shell.c]"]
  node_calculator["Calculator<br/>[calc.c]"]
  node_inputmode["Input mode<br/>[input.c]"]
  node_console["Terminal console<br/>[console.c]"]
end

subgraph group_storage["Disk filesystem"]
  node_filesystem["Filesystem<br/>[fs.c]"]
  node_directory["Disk directory<br/>[fs_disk.h]"]
end

subgraph group_support["Hardware and utilities"]
  node_ata["ATA disk access<br/>[ata.c]"]
  node_portio["Port I/O<br/>[port_io.c]"]
  node_reboot["Reboot control<br/>[reboot.c]"]
  node_strings["String utilities<br/>[string.c]"]
end

node_user(("OS user"))

node_kernel -->|"initializes and prints"| node_console
node_kernel -->|"installs"| node_idt
node_kernel -->|"installs"| node_isr
node_kernel -->|"installs"| node_irq
node_kernel -->|"installs"| node_keyboard
node_kernel -->|"sets mode"| node_inputmode
node_kernel -->|"initializes"| node_filesystem
node_kernel -->|"starts"| node_shell
node_irq -->|"sets IRQ gates"| node_idt
node_irq -->|"uses registers"| node_isr
node_keyboard -->|"registers handler"| node_irq
node_shell -->|"prints output"| node_console
node_shell -->|"opens calculator"| node_calculator
node_shell -->|"runs file commands"| node_filesystem
node_shell -->|"reboots system"| node_reboot
node_filesystem -->|"reads and writes sectors"| node_ata
node_filesystem -->|"uses entries"| node_directory
node_filesystem -->|"prints file list"| node_console
node_filesystem -->|"uses string operations"| node_strings
node_ata -->|"uses port access"| node_portio
node_calculator -->|"prints results"| node_console
node_calculator -->|"uses input mode"| node_inputmode
node_calculator -->|"uses string operations"| node_strings
node_user -.->|"boots OS"| node_bootloader
node_user -->|"issues commands"| node_shell

click node_bootloader "https://github.com/moinnuddinnn/monos/blob/main/boot.asm"
click node_kernel "https://github.com/moinnuddinnn/monos/blob/main/kernel.c"
click node_idt "https://github.com/moinnuddinnn/monos/blob/main/idt.c"
click node_isr "https://github.com/moinnuddinnn/monos/blob/main/isr.c"
click node_irq "https://github.com/moinnuddinnn/monos/blob/main/irq.c"
click node_keyboard "https://github.com/moinnuddinnn/monos/blob/main/keyboard.c"
click node_shell "https://github.com/moinnuddinnn/monos/blob/main/shell.c"
click node_calculator "https://github.com/moinnuddinnn/monos/blob/main/calc.c"
click node_inputmode "https://github.com/moinnuddinnn/monos/blob/main/input.c"
click node_console "https://github.com/moinnuddinnn/monos/blob/main/console.c"
click node_filesystem "https://github.com/moinnuddinnn/monos/blob/main/fs.c"
click node_directory "https://github.com/moinnuddinnn/monos/blob/main/fs_disk.h"
click node_ata "https://github.com/moinnuddinnn/monos/blob/main/ata.c"
click node_portio "https://github.com/moinnuddinnn/monos/blob/main/port_io.c"
click node_reboot "https://github.com/moinnuddinnn/monos/blob/main/reboot.c"
click node_strings "https://github.com/moinnuddinnn/monos/blob/main/string.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_bootloader,node_kernel,node_user toneBlue
class node_idt,node_isr,node_irq,node_keyboard toneAmber
class node_shell,node_calculator,node_inputmode,node_console toneMint
class node_filesystem,node_directory toneRose
class node_ata,node_portio,node_reboot,node_strings toneIndigo
```

## Components

### Boot and kernel

- [Bootloader](https://github.com/moinnuddinnn/monos/blob/main/boot.asm): `boot.asm`
- [Kernel startup](https://github.com/moinnuddinnn/monos/blob/main/kernel.c): `kernel.c`

### Interrupt input

- [IDT setup](https://github.com/moinnuddinnn/monos/blob/main/idt.c): `idt.c`
- [CPU exceptions](https://github.com/moinnuddinnn/monos/blob/main/isr.c): `isr.c`
- [IRQ controller](https://github.com/moinnuddinnn/monos/blob/main/irq.c): `irq.c`
- [Keyboard driver](https://github.com/moinnuddinnn/monos/blob/main/keyboard.c): `keyboard.c`

### Terminal and commands

- [Command shell](https://github.com/moinnuddinnn/monos/blob/main/shell.c): `shell.c`
- [Calculator](https://github.com/moinnuddinnn/monos/blob/main/calc.c): `calc.c`
- [Input mode](https://github.com/moinnuddinnn/monos/blob/main/input.c): `input.c`
- [Terminal console](https://github.com/moinnuddinnn/monos/blob/main/console.c): `console.c`

### Disk filesystem

- [Filesystem](https://github.com/moinnuddinnn/monos/blob/main/fs.c): `fs.c`
- [Disk directory](https://github.com/moinnuddinnn/monos/blob/main/fs_disk.h): `fs_disk.h`

### Hardware and utilities

- [ATA disk access](https://github.com/moinnuddinnn/monos/blob/main/ata.c): `ata.c`
- [Port I/O](https://github.com/moinnuddinnn/monos/blob/main/port_io.c): `port_io.c`
- [Reboot control](https://github.com/moinnuddinnn/monos/blob/main/reboot.c): `reboot.c`
- [String utilities](https://github.com/moinnuddinnn/monos/blob/main/string.c): `string.c`

### Other components

- **OS user**

## Connections

- Kernel startup → Terminal console: initializes and prints (evidence: `kernel.c`)
- Kernel startup → IDT setup: installs (evidence: `kernel.c`)
- Kernel startup → CPU exceptions: installs (evidence: `kernel.c`)
- Kernel startup → IRQ controller: installs (evidence: `kernel.c`)
- Kernel startup → Keyboard driver: installs (evidence: `kernel.c`)
- Kernel startup → Input mode: sets mode (evidence: `kernel.c`)
- Kernel startup → Filesystem: initializes (evidence: `kernel.c`)
- Kernel startup → Command shell: starts (evidence: `kernel.c`)
- IRQ controller → IDT setup: sets IRQ gates (evidence: `irq.c`)
- IRQ controller → CPU exceptions: uses registers
- Keyboard driver → IRQ controller: registers handler (evidence: `keyboard.c`)
- Command shell → Terminal console: prints output (evidence: `shell.c`)
- Command shell → Calculator: opens calculator (evidence: `shell.c`)
- Command shell → Filesystem: runs file commands (evidence: `shell.c`)
- Command shell → Reboot control: reboots system (evidence: `shell.c`)
- Filesystem → ATA disk access: reads and writes sectors (evidence: `fs.c`)
- Filesystem → Disk directory: uses entries (evidence: `fs.c`)
- Filesystem → Terminal console: prints file list (evidence: `fs.c`)
- Filesystem → String utilities: uses string operations (evidence: `fs.c`)
- ATA disk access → Port I/O: uses port access (evidence: `ata.c`)
- Calculator → Terminal console: prints results (evidence: `calc.c`)
- Calculator → Input mode: uses input mode (evidence: `calc.c`)
- Calculator → String utilities: uses string operations (evidence: `calc.c`)
- OS user → Bootloader: boots OS (evidence: `README.md`)
- OS user → Command shell: issues commands (evidence: `shell.c`)
