# cazzuloa/fs-os architecture

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

- Interactive diagram: https://gitdiagram.com/cazzuloa/fs-os
- Repository: https://github.com/cazzuloa/fs-os

## Overview

FS-Os is an experimental 32-bit x86 operating system. Its user-visible workflow is BIOS boot, bootloader disk load and protected-mode handoff, kernel initialization, then keyboard-driven shell commands with VGA output. The graph includes the documented interrupt, keyboard, timer, and shell capabilities. Some implementation files were not sampled; links for those stages rely on the README, and uncertain internal wiring is omitted.

Main entry points: [`kernel/src/shell.c`](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/shell.c) (Interactive shell), [`kernel/src/idt.c`](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/idt.c) (IDT and dispatch), [`kernel/src/kernel.c`](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kernel.c) (Kernel startup), [`kernel/src/keyboard.c`](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/keyboard.c) (PS/2 keyboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot"]
  node_bootloader["Bootloader<br/>[boot.asm]"]
end

subgraph group_kernel["Kernel core"]
  node_entry["Kernel entry<br/>[start.S]"]
  node_main["Kernel startup<br/>[kernel.c]"]
  node_interrupts["IDT and dispatch<br/>[idt.c]"]
  node_isr["ISR stubs<br/>[isr.asm]"]
end

subgraph group_interaction["Input and shell"]
  node_keyboard["PS/2 keyboard<br/>[keyboard.c]"]
  node_shell["Interactive shell<br/>[shell.c]"]
end

subgraph group_services["Kernel services"]
  node_pic["PIC controller<br/>[pic.c]"]
  node_timer["PIT timer<br/>[timer.c]"]
  node_vga["VGA text driver<br/>[vga.c]"]
  node_kprintf["Formatted output<br/>[kprintf.c]"]
  node_kstring["String and memory<br/>[kstring.c]"]
end

node_bios(("BIOS"))
node_user(("User"))
node_disk[("Boot disk")]
node_hardware["x86 hardware"]

node_bios -->|"loads at 0x7C00"| node_bootloader
node_bootloader -->|"reads kernel sectors"| node_disk
node_bootloader -->|"jumps at 0x1000"| node_entry
node_entry -->|"enters kernel"| node_main
node_main -->|"initializes IDT"| node_interrupts
node_interrupts -->|"remaps PIC"| node_pic
node_interrupts -->|"registers stubs"| node_isr
node_interrupts -->|"reports exceptions"| node_vga
node_main -->|"initializes driver"| node_keyboard
node_main -->|"initializes PIT"| node_timer
node_main -->|"starts shell"| node_shell
node_keyboard -->|"registers IRQ handler"| node_interrupts
node_keyboard -->|"unmasks IRQ1"| node_pic
node_timer -->|"registers IRQ handler"| node_interrupts
node_timer -->|"unmasks IRQ0"| node_pic
node_user -->|"types keys"| node_keyboard
node_shell -->|"reads characters"| node_keyboard
node_shell -->|"reads ticks or sleeps"| node_timer
node_shell -->|"prints commands"| node_kprintf
node_shell -->|"edits and clears display"| node_vga
node_shell -->|"parses command text"| node_kstring
node_kprintf -->|"writes characters"| node_vga
node_vga -->|"updates text display"| node_hardware

click node_bootloader "https://github.com/cazzuloa/fs-os/blob/main/bootloader/boot.asm"
click node_entry "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/start.S"
click node_main "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kernel.c"
click node_interrupts "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/idt.c"
click node_isr "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/isr.asm"
click node_pic "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/pic.c"
click node_keyboard "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/keyboard.c"
click node_timer "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/timer.c"
click node_shell "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/shell.c"
click node_vga "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/vga.c"
click node_kprintf "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kprintf.c"
click node_kstring "https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kstring.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_user toneBlue
class node_entry,node_main,node_interrupts,node_isr,node_disk toneAmber
class node_keyboard,node_shell toneMint
class node_pic,node_timer,node_vga,node_kprintf,node_kstring toneRose
class node_bios,node_hardware toneIndigo
```

## Components

### Boot

- [Bootloader](https://github.com/cazzuloa/fs-os/blob/main/bootloader/boot.asm): `bootloader/boot.asm`

### Kernel core

- [Kernel entry](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/start.S): `kernel/src/start.S`
- [Kernel startup](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kernel.c): `kernel/src/kernel.c`
- [IDT and dispatch](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/idt.c): `kernel/src/idt.c`
- [ISR stubs](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/isr.asm): `kernel/src/isr.asm`

### Input and shell

- [PS/2 keyboard](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/keyboard.c): `kernel/src/keyboard.c`
- [Interactive shell](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/shell.c): `kernel/src/shell.c`

### Kernel services

- [PIC controller](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/pic.c): `kernel/src/pic.c`
- [PIT timer](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/timer.c): `kernel/src/timer.c`
- [VGA text driver](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/vga.c): `kernel/src/vga.c`
- [Formatted output](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kprintf.c): `kernel/src/kprintf.c`
- [String and memory](https://github.com/cazzuloa/fs-os/blob/main/kernel/src/kstring.c): `kernel/src/kstring.c`

### Other components

- **BIOS**
- **User**
- **Boot disk**
- **x86 hardware**

## Connections

- BIOS → Bootloader: loads at 0x7C00 (evidence: `Readme.md`)
- Bootloader → Boot disk: reads kernel sectors (evidence: `Readme.md`)
- Bootloader → Kernel entry: jumps at 0x1000 (evidence: `Readme.md`)
- Kernel entry → Kernel startup: enters kernel (evidence: `Readme.md`)
- Kernel startup → IDT and dispatch: initializes IDT (evidence: `Readme.md`)
- IDT and dispatch → PIC controller: remaps PIC (evidence: `kernel/src/idt.c`)
- IDT and dispatch → ISR stubs: registers stubs (evidence: `kernel/src/idt.c`)
- IDT and dispatch → VGA text driver: reports exceptions (evidence: `kernel/src/idt.c`)
- Kernel startup → PS/2 keyboard: initializes driver (evidence: `Readme.md`)
- Kernel startup → PIT timer: initializes PIT (evidence: `Readme.md`)
- Kernel startup → Interactive shell: starts shell (evidence: `Readme.md`)
- PS/2 keyboard → IDT and dispatch: registers IRQ handler (evidence: `kernel/src/keyboard.c`)
- PS/2 keyboard → PIC controller: unmasks IRQ1 (evidence: `kernel/src/keyboard.c`)
- PIT timer → IDT and dispatch: registers IRQ handler (evidence: `Readme.md`)
- PIT timer → PIC controller: unmasks IRQ0 (evidence: `Readme.md`)
- User → PS/2 keyboard: types keys (evidence: `Readme.md`)
- Interactive shell → PS/2 keyboard: reads characters (evidence: `kernel/src/shell.c`)
- Interactive shell → PIT timer: reads ticks or sleeps (evidence: `kernel/src/shell.c`)
- Interactive shell → Formatted output: prints commands (evidence: `kernel/src/shell.c`)
- Interactive shell → VGA text driver: edits and clears display (evidence: `kernel/src/shell.c`)
- Interactive shell → String and memory: parses command text (evidence: `kernel/src/shell.c`)
- Formatted output → VGA text driver: writes characters (evidence: `kernel/src/kprintf.c`)
- VGA text driver → x86 hardware: updates text display (evidence: `Readme.md`)
