# rrrh/vcfe_zh16 architecture

> Architecture diagram of the GitHub repository rrrh/vcfe_zh16, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rrrh/vcfe_zh16
- Repository: https://github.com/rrrh/vcfe_zh16

## Overview

##### ROM Structure Layer
- Program ROM section
- Graphics/Asset ROM section
- Sound ROM section

##### Core Components
- Main Core Engine (core.c)
- Memory Management (memory.c)
- SNES Hardware Interface (snes_funcs.c)
- Sound Core (snd/snd_core.s)

##### Scene Management
- State Machine (include/state_machine.h)
- Scene Components:
- Start Screen
- Exhibit View
- Timeline View
- Scroller Component (vcfe_scroller)

##### Resource Management
- Graphics Assets:
- Exhibits (multiple computer systems)
- Fonts
- Sprites
- Background elements
- Sound Assets
- Data Tables (sin tables, etc.)

##### Use a Layered Architecture Approach
- [Hardware Layer (SNES)]
- ↑↓
- [Hardware Interface Layer (SNES Functions/Registers)]
- ↑↓
- [Core System Layer (Memory/State Management)]
- ↑↓
- [Scene Management Layer]
- ↑↓
- [Resource Management Layer]

##### Component Relationships
- Use double lines for hardware interfaces

##### Technical Details
- ROM size and organization
- Memory map regions
- Hardware register interfaces
- Asset compression/decompression flows

- The separation between hardware-specific code and game logic
- Resource loading and management paths
- Scene transition flow
- Hardware-specific optimizations and constraints

- SNES-specific terminology
- Memory region markers
- Asset format indicators (.clr, .pic, .map files)
- Hardware register references

Keep the abstraction level appropriate for SNES development while maintaining enough detail to show the unique aspects of retro-gaming system architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef hardware fill:#ff9999,stroke:#333
    classDef core fill:#99ccff,stroke:#333
    classDef scene fill:#ffff99,stroke:#333
    classDef resource fill:#99ff99,stroke:#333
    classDef sound fill:#e6b3ff,stroke:#333

    %% Hardware Layer
    subgraph HW["Hardware Layer"]
        SNES["SNES Hardware"]:::hardware
    end

    %% Hardware Interface Layer
    subgraph HI["Hardware Interface Layer"]
        SNESADDR["SNES Addresses"]:::hardware
        SNESCONST["SNES Constants"]:::hardware
        SNESFUNC["SNES Functions"]:::hardware
        SNESREG["SNES Registers"]:::hardware
    end

    %% Core System Layer
    subgraph CS["Core System Layer"]
        CORE["Main Core Engine"]:::core
        MEM["Memory Management"]:::core
        HWIF["SNES Hardware Interface"]:::core
        SNDCORE["Sound Core"]:::sound
    end

    %% Scene Management Layer
    subgraph SM["Scene Management Layer"]
        STATEMACH["State Machine"]:::scene
        subgraph SCENES["Scene Components"]
            START["Start Screen"]:::scene
            EXHIBIT["Exhibit View"]:::scene
            TIMELINE["Timeline View"]:::scene
        end
        SCROLLER["Scroller Component"]:::scene
    end

    %% Resource Management Layer
    subgraph RM["Resource Management Layer"]
        subgraph GA["Graphics Assets"]
            SPRITES["Sprites"]:::resource
            FONTS["Fonts"]:::resource
            BG["Backgrounds"]:::resource
        end
        subgraph SA["Sound Assets"]
            SNDCONF["Sound Configuration"]:::sound
        end
        subgraph DT["Data Tables"]
            SINTABLES["Sin Tables"]:::resource
        end
        EXHIBITDEF["Exhibit Definitions"]:::resource
        SCENEDEF["Scene Definitions"]:::resource
    end

    %% Relationships
    HW --> HI
    HI --> CS
    CS --> SM
    SM --> RM

    %% Click Events
    click CORE "https://github.com/rrrh/vcfe_zh16/blob/master/src/core.c"
    click MEM "https://github.com/rrrh/vcfe_zh16/blob/master/src/memory.c"
    click HWIF "https://github.com/rrrh/vcfe_zh16/blob/master/src/snes_funcs.c"
    click SNDCORE "https://github.com/rrrh/vcfe_zh16/blob/master/snd/snd_core.s"
    click STATEMACH "https://github.com/rrrh/vcfe_zh16/blob/master/include/state_machine.h"
    click START "https://github.com/rrrh/vcfe_zh16/blob/master/src/slices/StartScreen.c"
    click EXHIBIT "https://github.com/rrrh/vcfe_zh16/blob/master/src/slices/ExhibitView.c"
    click TIMELINE "https://github.com/rrrh/vcfe_zh16/blob/master/src/slices/timeline.c"
    click SCROLLER "https://github.com/rrrh/vcfe_zh16/blob/master/src/vcfe_scroller.c"
    click SNESADDR "https://github.com/rrrh/vcfe_zh16/blob/master/include/snes_addresses.h"
    click SNESCONST "https://github.com/rrrh/vcfe_zh16/blob/master/include/snes_consts.h"
    click SNESFUNC "https://github.com/rrrh/vcfe_zh16/blob/master/include/snes_funcs.h"
    click SNESREG "https://github.com/rrrh/vcfe_zh16/blob/master/include/snes_regs.h"
    click SPRITES "https://github.com/rrrh/vcfe_zh16/blob/master/data/sprites.pic"
    click FONTS "https://github.com/rrrh/vcfe_zh16/blob/master/data/font.pic"
    click SNDCONF "https://github.com/rrrh/vcfe_zh16/blob/master/snd/snd_regs.inc"
    click SINTABLES "https://github.com/rrrh/vcfe_zh16/blob/master/data/sin_table_s.s"
    click EXHIBITDEF "https://github.com/rrrh/vcfe_zh16/blob/master/include/exhibits.h"
    click SCENEDEF "https://github.com/rrrh/vcfe_zh16/blob/master/include/scenes.h"

    %% Legend
    subgraph Legend
        L1["Hardware Components"]:::hardware
        L2["Core Components"]:::core
        L3["Scene Components"]:::scene
        L4["Resource Components"]:::resource
        L5["Sound Components"]:::sound
    end
```
