# abdooowd/abdooos-32bit architecture

> Architecture diagram of the GitHub repository abdooowd/abdooos-32bit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdooowd/abdooos-32bit
- Repository: https://github.com/abdooowd/abdooos-32bit

## Overview

##### Component Relationships

a) Boot Flow:
- Interaction with FAT12 filesystem during boot

b) Interrupt Handling:
- Flow from hardware interrupts → IDT → ISR handlers
- Timer and keyboard interrupts to their respective drivers

c) Driver Integration:
- Drivers to both hardware and kernel layers
- Screen and keyboard driver interfaces

##### Detailed Component Breakdown

Core Components to Include:

**Boot Section:**
- Stage1 & Stage2 bootloaders
- A20 gate handler
- GDT setup
- FAT12 implementation

**CPU Management:**
- IDT (Interrupt Descriptor Table)
- ISR (Interrupt Service Routines)
- Timer implementation

**Drivers:**
- Keyboard controller
- Screen driver

**Core Kernel:**
- Kernel entry point
- Main kernel functions
- Memory management

**System Libraries:**
- Standard C library functions
- String manipulation
- Printf implementation
- Utility functions

##### Additional Elements

Supporting elements:
- Memory map representation
- Interrupt vector table
- Hardware I/O ports
- File system structure

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef hardware fill:#808080,stroke:#000,color:white
    classDef assembly fill:#FF6B6B,stroke:#000,color:white
    classDef kernel fill:#4D96FF,stroke:#000,color:white
    classDef driver fill:#6BCB77,stroke:#000,color:white
    classDef library fill:#FFD93D,stroke:#000,color:white
    classDef header fill:#D8D9DA,stroke:#000,color:black

    %% Hardware Interface Layer
    subgraph Hardware
        BIOS["BIOS Interface"]:::hardware
        CPU["CPU"]:::hardware
        KB["Keyboard"]:::hardware
        DISP["Display"]:::hardware
    end

    %% Boot Process Layer
    subgraph BootProcess
        Stage1["Stage 1 Bootloader"]:::assembly
        Stage2["Stage 2 Bootloader"]:::assembly
        A20["A20 Gate Handler"]:::assembly
        GDT["GDT Setup"]:::assembly
        FAT12Boot["FAT12 Boot"]:::assembly
    end

    %% Kernel Core Layer
    subgraph KernelCore
        KernelEntry["Kernel Entry"]:::kernel
        MainKernel["Main Kernel"]:::kernel
        
        subgraph CPUManagement
            IDT["IDT"]:::kernel
            ISR["ISR Handlers"]:::kernel
            Timer["Timer"]:::kernel
            IntAsm["Interrupt Assembly"]:::kernel
        end
        
        subgraph Drivers
            KBDriver["Keyboard Controller"]:::driver
            ScreenDriver["Screen Driver"]:::driver
        end
    end

    %% System Libraries Layer
    subgraph SystemLibraries
        Printf["Printf"]:::library
        String["String Functions"]:::library
        Memory["Memory Management"]:::library
        FAT["FAT Filesystem"]:::library
        LowLevel["Low Level Functions"]:::library
        Util["Utility Functions"]:::library
    end

    %% Headers
    subgraph Headers
        CRT["C Runtime Definitions"]:::header
        StdIO["Standard I/O"]:::header
        Types["Type Definitions"]:::header
    end

    %% Relationships
    BIOS --> Stage1
    Stage1 --> Stage2
    Stage2 --> A20
    Stage2 --> GDT
    Stage2 --> FAT12Boot
    FAT12Boot --> KernelEntry
    KernelEntry --> MainKernel
    MainKernel --> IDT
    IDT --> ISR
    ISR --> IntAsm
    ISR --> Timer
    KB --> KBDriver
    KBDriver --> ISR
    DISP --> ScreenDriver
    ScreenDriver --> MainKernel

    %% Library Dependencies
    MainKernel --> Printf
    MainKernel --> String
    MainKernel --> Memory
    MainKernel --> FAT
    MainKernel --> LowLevel
    MainKernel --> Util

    %% Click Events
    click Stage1 "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/boot/stage1.asm"
    click Stage2 "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/boot/stage2.asm"
    click A20 "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/boot/A20.inc"
    click GDT "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/boot/gdt.inc"
    click FAT12Boot "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/boot/fat12.inc"
    click IDT "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/cpu/idt.c"
    click ISR "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/cpu/isr.c"
    click Timer "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/cpu/timer.c"
    click IntAsm "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/cpu/interrupt.asm"
    click KBDriver "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/drivers/keyboard.c"
    click ScreenDriver "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/drivers/screen.c"
    click KernelEntry "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/kernel/entry.c"
    click MainKernel "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/kernel/kernel.c"
    click Printf "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/printf.c"
    click String "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/string.c"
    click Memory "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/mem.c"
    click FAT "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/fat.c"
    click LowLevel "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/low_level.c"
    click Util "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/lib/util.c"
    click CRT "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/include/crtdefs.h"
    click StdIO "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/include/stdio.h"
    click Types "https://github.com/AbdooOwd/AbdooOS-32bit/blob/main/src/core/include/types.h"
```
