# yaul-org/libyaul architecture

> Architecture diagram of the GitHub repository yaul-org/libyaul, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yaul-org/libyaul
- Repository: https://github.com/yaul-org/libyaul

## Overview

##### Main Components Structure

a) Core Libraries Layer:
- libyaul (Main Saturn SDK)
- libmic3d (3D graphics)
- libbcl (Compression)
- libfiber (Threading)
- libmenu (UI menus)
- libtga (Image handling)

b) Hardware Abstraction Layer:
- SCU (Saturn Control Unit)
- CPU Bus Interface
- VDP1/VDP2 (Video Display Processors)
- Sound Subsystem (SCSP)
- CD Block
- SMPC (System Management & Peripheral Control)

c) Tools Layer:
As supporting components:
- bcl (Compression tools)
- bin2c/bin2o (Binary conversion)
- make-cue/make-ip/make-iso (CD image creation)
- satconv (Saturn asset conversion)

##### Component Relationships

Use these connection types:
- Double lines for hardware interfaces

##### Detailed Component Breakdown

For libyaul (main component), show internal structure:
**libyaul**
- Kernel (dbgio, fs, mm)
- SCU (bus control, DMA, DSP)
- CPU Interface
- Cache Control
- DMAC
- Peripheral Control
- VDP Interface
- VDP1 (Sprites, Drawing)
- VDP2 (Backgrounds, Scrolling)
- System Services
- CD Block
- Sound
- Input

##### Additional Elements

Include:
- Version information
- Build system flow

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef hardware fill:#2ecc71,stroke:#27ae60,color:white
    classDef tools fill:#e67e22,stroke:#d35400,color:white
    classDef system fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef interface fill:#f1c40f,stroke:#f39c12,color:black

    %% Core Libraries Layer
    subgraph CoreLibs
        YAUL[libyaul]:::core
        MIC3D[libmic3d]:::core
        BCL[libbcl]:::core
        FIBER[libfiber]:::core
        MENU[libmenu]:::core
        TGA[libtga]:::core
    end

    %% Core System Components
    subgraph CoreSystem
        KERNEL[Kernel]:::system
        MM[Memory Management]:::system
        FS[File System]:::system
        DBGIO[Debug IO]:::system
        GAMEMATH[Game Math]:::system
        LIBC[C Library]:::system
    end

    %% Hardware Abstraction Layer
    subgraph HAL
        SCU[SCU]:::hardware
        CPUBUS[CPU Bus Interface]:::hardware
        VDP[VDP1/VDP2]:::hardware
        SOUND[Sound Subsystem]:::hardware
        CDBLOCK[CD Block]:::hardware
        SMPC[SMPC]:::hardware
    end

    %% Tools Layer
    subgraph Tools
        BCLTOOLS[BCL Tools]:::tools
        BIN2C[bin2c]:::tools
        BIN2O[bin2o]:::tools
        MAKECUE[make-cue]:::tools
        MAKEIP[make-ip]:::tools
        MAKEISO[make-iso]:::tools
        SATCONV[satconv]:::tools
    end

    %% Relationships
    YAUL --> SCU
    YAUL --> CPUBUS
    YAUL --> VDP
    YAUL --> SOUND
    YAUL --> CDBLOCK
    YAUL --> SMPC
    
    YAUL --> KERNEL
    KERNEL --> MM
    KERNEL --> FS
    KERNEL --> DBGIO
    YAUL --> GAMEMATH
    YAUL --> LIBC

    %% Tool Relationships
    BCLTOOLS -.-> BCL
    BIN2C -.-> YAUL
    BIN2O -.-> YAUL
    MAKECUE -.-> CDBLOCK
    MAKEIP -.-> CDBLOCK
    MAKEISO -.-> CDBLOCK
    SATCONV -.-> VDP

    %% Click Events
    click YAUL "https://github.com/yaul-org/libyaul/tree/develop/libyaul/"
    click MIC3D "https://github.com/yaul-org/libyaul/tree/develop/libmic3d/"
    click BCL "https://github.com/yaul-org/libyaul/tree/develop/libbcl/"
    click FIBER "https://github.com/yaul-org/libyaul/tree/develop/libfiber/"
    click MENU "https://github.com/yaul-org/libyaul/tree/develop/libmenu/"
    click TGA "https://github.com/yaul-org/libyaul/tree/develop/libtga/"
    click SCU "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/"
    click CPUBUS "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/bus/cpu/"
    click VDP "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/bus/b/vdp/"
    click SOUND "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/bus/b/scsp/"
    click CDBLOCK "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/bus/a/cs2/cd-block/"
    click SMPC "https://github.com/yaul-org/libyaul/tree/develop/libyaul/scu/bus/cpu/smpc/"
    click BCLTOOLS "https://github.com/yaul-org/libyaul/tree/develop/tools/bcl/"
    click BIN2C "https://github.com/yaul-org/libyaul/tree/develop/tools/bin2c/"
    click BIN2O "https://github.com/yaul-org/libyaul/tree/develop/tools/bin2o/"
    click MAKECUE "https://github.com/yaul-org/libyaul/tree/develop/tools/make-cue/"
    click MAKEIP "https://github.com/yaul-org/libyaul/tree/develop/tools/make-ip/"
    click MAKEISO "https://github.com/yaul-org/libyaul/tree/develop/tools/make-iso/"
    click SATCONV "https://github.com/yaul-org/libyaul/tree/develop/tools/satconv/"
    click KERNEL "https://github.com/yaul-org/libyaul/tree/develop/libyaul/kernel/"
    click MM "https://github.com/yaul-org/libyaul/tree/develop/libyaul/kernel/mm/"
    click FS "https://github.com/yaul-org/libyaul/tree/develop/libyaul/kernel/fs/"
    click DBGIO "https://github.com/yaul-org/libyaul/tree/develop/libyaul/kernel/dbgio/"
    click GAMEMATH "https://github.com/yaul-org/libyaul/tree/develop/libyaul/gamemath/"
    click LIBC "https://github.com/yaul-org/libyaul/tree/develop/libyaul/libc/"

    %% Legend
    subgraph Legend
        L1[Core Libraries]:::core
        L2[Hardware Components]:::hardware
        L3[Development Tools]:::tools
        L4[System Components]:::system
        L5[External Interfaces]:::interface
    end
```
