# graysonhuey/fasm-pong architecture

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

- Interactive diagram: https://gitdiagram.com/graysonhuey/fasm-pong
- Repository: https://github.com/graysonhuey/fasm-pong

## Overview

##### Project type and purpose
- This is a minimal single-binary game implemented entirely in x86_64 Assembly, using Raylib for graphics and input. It’s a “demo” or “toy” full-program rather than a multi-tier web app or service.

##### File structure
- Top-level files only:
- game.asm – the sole Assembly source
- Makefile – build instructions (invokes fasm, binutils)
- README.md – project description, dependencies
- LICENSE, .gitignore
- No separate “src” or “lib” folders; everything centers around game.asm and an external Raylib clone.

##### README for additional insights
- It requires: FASM assembler, GNU binutils (ld), Raylib (graphics/input library).
- Build steps: clone Raylib, then run make (Makefile wraps fasm + linking).

##### How to model this

a. Main components
1. game.asm source (your Assembly code)
2. FASM assembler (fasm) – compiles game.asm → object code
3. Linker (ld from binutils) – links object code + Raylib → executable
4. Raylib library (built from C sources) – provides graphics, input, audio API
5. OS Kernel & Drivers – Linux syscalls, GPU driver
6. Hardware (CPU, GPU, Keyboard/Mouse, Display)

b. Relationships & interactions
- At runtime: game.exe → calls Raylib API → Raylib uses OpenGL/Direct syscalls → OS Kernel → GPU, input devices
- User input (keyboard) → OS → Raylib → game logic
- Game draws frames → Raylib → GPU driver → screen

c. Architectural patterns/design principles
- Single-module “main loop” architecture: the Assembly code implements the game loop, delegates subsystems (rendering, input) to Raylib.
- External library integration: static or dynamic linking of Raylib.

d. Key technologies/frameworks/libraries
- FASM assembler, GNU ld (binutils)
- Raylib (C-based graphics/input)
- Linux x86_64 syscalls and GPU driver (OpenGL under the hood)

##### Detailed breakdown
- Build stage:
[game.asm] → (FASM) → [game.o]
[game.o] + [libraylib.a/.so] → (ld) → [game executable]
- Runtime stage:
[game executable] → game loop → calls → [Raylib API] → syscalls → [OS Kernel] → [GPU Driver/Display]
→ [Keyboard] → [Raylib input]
- External dependency: [Raylib Git clone] → build → [libraylib.a/.so]

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Project Files"
        rd["README.md"]:::docs
        gi[".gitignore"]:::docs
        lic["LICENSE"]:::docs
    end

    subgraph "Build Stage"
        mf["Makefile"]:::docs
        src["game.asm"]:::source
        asm["FASM assembler"]:::build
        obj["game.o"]:::artifact
        libbuild["Raylib Git Clone"]:::external
        rayliblib["Raylib Library (.a/.so)"]:::library
        ld["GNU ld linker"]:::build
        exe["game executable"]:::artifact

        mf --> asm
        mf --> ld
        src -->|"assembles via fasm"| asm
        asm -->|"produces object"| obj
        libbuild -->|"builds"| rayliblib
        obj -->|"links with library"| ld
        rayliblib -->|"linked by ld"| ld
        ld -->|"outputs executable"| exe
    end

    subgraph "Runtime Stage"
        exeRun["game executable"]:::runtime
        loop["Game Loop (Assembly)"]:::runtime
        api["Raylib API"]:::library
        os["OS Kernel & Drivers"]:::os
        input["Input Devices (Keyboard/Mouse)"]:::hardware
        gpu["GPU Driver"]:::hardware
        display["Display"]:::hardware
        audio["Audio Subsystem"]:::hardware

        exe --> exeRun
        exeRun -->|"starts"| loop
        input -->|"events"| api
        loop -->|"calls graphics/input"| api
        api -->|"syscalls"| os
        os -->|"render cmd"| gpu
        gpu -->|"output frames"| display
        api -->|"audio calls"| audio
        audio -->|"sound output"| audio
    end

    click src "https://github.com/graysonhuey/fasm-pong/blob/main/game.asm"
    click mf "https://github.com/graysonhuey/fasm-pong/tree/main/Makefile"
    click rd "https://github.com/graysonhuey/fasm-pong/blob/main/README.md"
    click gi "https://github.com/graysonhuey/fasm-pong/blob/main/.gitignore"
    click lic "https://github.com/graysonhuey/fasm-pong/tree/main/LICENSE"

    classDef source fill:#FFD700,stroke:#333,stroke-width:1px
    classDef build fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef artifact fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef library fill:#98FB98,stroke:#333,stroke-width:1px
    classDef runtime fill:#FFA07A,stroke:#333,stroke-width:1px
    classDef os fill:#F0E68C,stroke:#333,stroke-width:1px
    classDef hardware fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef docs fill:#FFFFFF,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
