# errornointernet/asmfetch architecture

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

- Interactive diagram: https://gitdiagram.com/errornointernet/asmfetch
- Repository: https://github.com/errornointernet/asmfetch

## Overview

##### Project type and purpose
- asmfetch is a command‐line “fetch” tool written entirely in x86-64 Assembly for Linux.
- Its sole purpose is to gather and display system information (username, hostname, OS, kernel, shell, uptime, desktop, memory/disk usage, etc.) in under 150 µs with zero external dependencies.

##### File structure
- Top‐level .S files (asmfetch.S, print.S, memory.S, sysinfo.S, etc.) each implement a specific piece of functionality.
- Subdirectories group related functionality:
- kernel/ – different syscall wrappers for kernel info
- logo/ – hardcoded ASCII logos per distribution
- shell/ – detection of shell and path variables
- symbols.S holds all the glyphs and formatting symbols.
- No scripts or glue code: everything is linked together by the assembler and Linux linker.

##### README for additional insights
- Lists the data sources: environment variables, /etc/os-release, XDG variables, uptime, memory, disk stats, uname syscall.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build Pipeline"
        direction TB
        ModulesGroup[".S Source Files"]:::assembly
        Assembler["Assembler\n(gcc -nostdlib, -no-pie)"]:::toolchain
        Linker["Linker"]:::toolchain
        ModulesGroup --> Assembler
        Assembler --> Linker
        Linker --> Binary["asmfetch Executable"]:::toolchain
    end

    subgraph "Runtime Execution"
        direction TB
        Binary --> Core["asmfetch Core"]:::assembly

        Core --> Sysinfo["System Info Module\n(sysinfo.S)"]:::assembly
        Core --> Uname["Uname Wrapper\n(uname.S)"]:::assembly
        Core --> Meminfo["Mem Info Module\n(meminfo.S)"]:::assembly
        Core --> Memory["Memory Reader\n(memory.S)"]:::assembly
        Core --> Storage["Storage Module\n(storage.S)"]:::assembly
        Core --> Host["Host Info Module\n(host.S)"]:::assembly
        Core --> Env["Env Var Module\n(env.S)"]:::assembly
        Core --> Release["OS-Release Module\n(release.S)"]:::assembly
        Core --> Uptime["Uptime Module\n(uptime.S)"]:::assembly
        Core --> Desktop["Desktop Module\n(desktop.S)"]:::assembly
        Core --> ShellCommon["Shell Detection Common\n(shell/common.S)"]:::assembly
        Core --> ShellName["Shell Name\n(shell/name.S)"]:::assembly
        Core --> ShellPath["Shell Path\n(shell/path.S)"]:::assembly

        Sysinfo --> OSSyscalls["Linux Syscalls\n(uname, sysinfo, statfs)"]:::os
        Uname --> OSSyscalls
        Meminfo --> OSSyscalls
        Memory --> OSSyscalls
        Storage --> OSSyscalls
        Host --> OSSyscalls
        Uptime --> OSSyscalls

        Env --> OSFiles["OS Files\n(/etc/os-release, /proc)"]:::os
        Release --> OSFiles
        Desktop --> OSFiles
        ShellCommon --> OSFiles
        ShellName --> OSFiles
        ShellPath --> OSFiles

        OSSyscalls --> Core
        OSFiles --> Core

        Core --> Symbols["Symbols & Glyphs\n(symbols.S)"]:::assembly
        Core --> Print["Printer Module\n(print.S)"]:::assembly
        Core --> Conversion["Conversion Utilities\n(atoi.S, itoa.S, copy.S, constants.S)"]:::assembly

        Print --> Terminal["Terminal Output\n(stdout)"]:::output
    end

    subgraph "Logo Modules"
        direction TB
        Arch["Arch Logo\n(logo/arch.S)"]:::assembly
        Artix["Artix Logo\n(logo/artix.S)"]:::assembly
        Fedora["Fedora Logo\n(logo/fedora.S)"]:::assembly
        GentooLogo["Gentoo Logo\n(logo/gentoo.S)"]:::assembly
        Nixos["NixOS Logo\n(logo/nixos.S)"]:::assembly
    end

    subgraph "Color Scheme Modules"
        direction TB
        ColorsCommon["Common Colors\n(colors/common.S)"]:::assembly
        ColorsDefault["Default Colors\n(colors/default.S)"]:::assembly
        ColorsGentoo["Gentoo Colors\n(colors/gentoo.S)"]:::assembly
    end

    subgraph "Kernel Syscall Wrappers"
        direction TB
        KernelCommon["Kernel Common\n(kernel/common.S)"]:::assembly
        KernelDefault["Kernel Default\n(kernel/default.S)"]:::assembly
        KernelNoMachine["Kernel NoMachine\n(kernel/without_machine.S)"]:::assembly
    end

    classDef assembly fill:#cce5ff,stroke:#339,stroke-width:1px;
    classDef toolchain fill:#d4edda,stroke:#27632a,stroke-width:1px;
    classDef os fill:#fff3cd,stroke:#8a6d3b,stroke-width:1px;
    classDef output fill:#e2e3e5,stroke:#6c757d,stroke-width:1px;

    click Core "https://github.com/errornointernet/asmfetch/blob/main/asmfetch.S"
    click Sysinfo "https://github.com/errornointernet/asmfetch/blob/main/sysinfo.S"
    click Uname "https://github.com/errornointernet/asmfetch/blob/main/uname.S"
    click Meminfo "https://github.com/errornointernet/asmfetch/blob/main/meminfo.S"
    click Memory "https://github.com/errornointernet/asmfetch/blob/main/memory.S"
    click Storage "https://github.com/errornointernet/asmfetch/blob/main/storage.S"
    click Host "https://github.com/errornointernet/asmfetch/blob/main/host.S"
    click Env "https://github.com/errornointernet/asmfetch/blob/main/env.S"
    click Release "https://github.com/errornointernet/asmfetch/blob/main/release.S"
    click Uptime "https://github.com/errornointernet/asmfetch/blob/main/uptime.S"
    click Desktop "https://github.com/errornointernet/asmfetch/blob/main/desktop.S"
    click ShellCommon "https://github.com/errornointernet/asmfetch/blob/main/shell/common.S"
    click ShellName "https://github.com/errornointernet/asmfetch/blob/main/shell/name.S"
    click ShellPath "https://github.com/errornointernet/asmfetch/blob/main/shell/path.S"
    click Arch "https://github.com/errornointernet/asmfetch/blob/main/logo/arch.S"
    click Artix "https://github.com/errornointernet/asmfetch/blob/main/logo/artix.S"
    click Fedora "https://github.com/errornointernet/asmfetch/blob/main/logo/fedora.S"
    click GentooLogo "https://github.com/errornointernet/asmfetch/blob/main/logo/gentoo.S"
    click Nixos "https://github.com/errornointernet/asmfetch/blob/main/logo/nixos.S"
    click ColorsCommon "https://github.com/errornointernet/asmfetch/blob/main/colors/common.S"
    click ColorsDefault "https://github.com/errornointernet/asmfetch/blob/main/colors/default.S"
    click ColorsGentoo "https://github.com/errornointernet/asmfetch/blob/main/colors/gentoo.S"
    click Symbols "https://github.com/errornointernet/asmfetch/blob/main/symbols.S"
    click Print "https://github.com/errornointernet/asmfetch/blob/main/print.S"
    click Conversion "https://github.com/errornointernet/asmfetch/blob/main/atoi.S"
    click Conversion "https://github.com/errornointernet/asmfetch/blob/main/itoa.S"
    click Conversion "https://github.com/errornointernet/asmfetch/blob/main/copy.S"
    click Conversion "https://github.com/errornointernet/asmfetch/blob/main/constants.S"
    click KernelCommon "https://github.com/errornointernet/asmfetch/blob/main/kernel/common.S"
    click KernelDefault "https://github.com/errornointernet/asmfetch/blob/main/kernel/default.S"
    click KernelNoMachine "https://github.com/errornointernet/asmfetch/blob/main/kernel/without_machine.S"
```
