retrogolib

module
v0.0.0-...-fb21c81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0

README

retrogolib

CI Codecov Release Go Reference License

A Go library of reusable components for retro-computing tools: emulators, debuggers, disassemblers, and system-specific utilities.

Features

  • CPU emulation - Chip-8, 6502-family, and Z80 emulators with tested instruction implementations
  • Instruction definitions - x86 definitions from the 8086 through the 80486 for static analysis tools
  • System helpers - NES cartridge, mapper, register, and parameter support
  • CGO-free GUI support - Cross-platform rendering through SDL3 with SDL2 fallback on Linux, Windows, macOS, and FreeBSD
  • CGO-free audio support - PCM playback through SDL3 with SDL2 fallback, concurrency-safe controls, and asynchronous error reporting
  • MCP server toolkit - Model Context Protocol server that exposes tools, resources, and prompts through stdio or streamable HTTP
  • Tooling utilities - Packages for CLI applications, configuration, structured logging, input, assertions, and sets
  • Small dependency footprint - Go 1.25+ with only ebitengine/purego as an external dependency

Installation

Add the module to an existing Go project:

go get github.com/retroenv/retrogolib

Then import the package needed by your tool:

import "github.com/retroenv/retrogolib/arch/cpu/cpu6502"

Packages

├─ app                         common application and service helpers
├─ arch                        shared architecture constants and types
│  ├─ cpu
│  │  ├─ chip8                 Chip-8 virtual machine
│  │  ├─ cpu6502               MOS 6502-family emulator, including NMOS and 65C02 variants
│  │  ├─ x86                   Intel x86 instruction definitions from 8086 through 80486
│  │  └─ z80                   Zilog Z80 emulator, including prefixed and undocumented opcodes
│  └─ system/nes               Nintendo Entertainment System support
│     ├─ cartridge             .nes ROM loading and saving
│     ├─ codedatalog           Raw FCEUX NES code/data logs
│     ├─ parameter             assembler-compatible instruction parameter formatting
│     └─ register              NES memory-register constants
├─ assert                      test assertion helpers
├─ audio                       PCM formats and playback controls
│  ├─ sdl2                     SDL2 audio backend
│  └─ sdl3                     SDL3 audio backend
├─ buildinfo                   release metadata reading and version formatting
├─ cli                         subcommands, aliases, global flags, and positional arguments
├─ config                      configuration loading, parsing, and persistence
├─ gui                         CGO-free GUI rendering abstractions
│  ├─ internal/framebuffer     frame-buffer helpers for GUI backends
│  ├─ sdl2                     SDL2 GUI backend
│  └─ sdl3                     SDL3 GUI backend
├─ host                        frame presentation, audio playback, and headless operation
├─ input                       keyboard and controller input helpers
├─ internal                    shared dynamic-library, SDL subsystem, and renderer registry helpers
├─ log                         nil-safe structured logging built on log/slog
├─ mcp                         Model Context Protocol server for tools, resources, and prompts
├─ renderer                    shared types to register and select audio and GUI renderers
└─ set                         generic set data structures and operations

For package-level APIs and examples, see the Go package documentation.

Directories

Path Synopsis
analysis
knownbits
Package knownbits describes fixed-width integers with known-zero and known-one bits.
Package knownbits describes fixed-width integers with known-zero and known-one bits.
Package app implements common application/service helpers.
Package app implements common application/service helpers.
Package arch provides architecture constants and types.
Package arch provides architecture constants and types.
cpu/analysis
Package analysis defines local machine-transfer records and logical register views.
Package analysis defines local machine-transfer records and logical register views.
cpu/chip8
Package chip8 provides a complete Chip-8 virtual machine implementation.
Package chip8 provides a complete Chip-8 virtual machine implementation.
cpu/cpu6502
Package cpu6502 provides a complete MOS Technology 6502 CPU emulation.
Package cpu6502 provides a complete MOS Technology 6502 CPU emulation.
cpu/x86
Package x86 provides Intel x86 instruction definitions for static analysis.
Package x86 provides Intel x86 instruction definitions for static analysis.
cpu/z80
Package z80 provides a high-performance Z80 CPU emulator with comprehensive instruction set support and memory management functionality for retro computing systems.
Package z80 provides a high-performance Z80 CPU emulator with comprehensive instruction set support and memory management functionality for retro computing systems.
system/nes
Package nes provides support for the Nintendo Entertainment System (NES).
Package nes provides support for the Nintendo Entertainment System (NES).
system/nes/cartridge
Package cartridge provides .nes ROM loading and saving.
Package cartridge provides .nes ROM loading and saving.
system/nes/codedatalog
Package codedatalog reads and writes raw FCEUX NES Code/Data Logger files.
Package codedatalog reads and writes raw FCEUX NES Code/Data Logger files.
system/nes/parameter
Package parameter provides helpers to output instruction parameters as string compatible with specific assemblers.
Package parameter provides helpers to output instruction parameters as string compatible with specific assemblers.
system/nes/register
Package register contains constants that represent special memory register addresses.
Package register contains constants that represent special memory register addresses.
Package assert contains test assertion helpers.
Package assert contains test assertion helpers.
Package audio provides CGO-free PCM playback for retro console emulators.
Package audio provides CGO-free PCM playback for retro console emulators.
sdl2
Package sdl2 provides a CGO-free SDL2 audio renderer for package audio.
Package sdl2 provides a CGO-free SDL2 audio renderer for package audio.
sdl3
Package sdl3 provides CGO-free SDL3 audio playback for package audio.
Package sdl3 provides CGO-free SDL3 audio playback for package audio.
Package buildinfo reads release metadata and formats version information.
Package buildinfo reads release metadata and formats version information.
Package cli provides utilities for building command-line interface applications.
Package cli provides utilities for building command-line interface applications.
Package config provides configuration loading and saving with comment preservation.
Package config provides configuration loading and saving with comment preservation.
gui
Package gui provides cross-platform GUI rendering capabilities for retro console emulators.
Package gui provides cross-platform GUI rendering capabilities for retro console emulators.
internal/framebuffer
Package framebuffer contains frame-buffer helpers for GUI renderer backends.
Package framebuffer contains frame-buffer helpers for GUI renderer backends.
sdl2
Package sdl2 provides a SDL2 GUI renderer.
Package sdl2 provides a SDL2 GUI renderer.
sdl3
Package sdl3 provides a CGO-free SDL3 GUI renderer for package gui.
Package sdl3 provides a CGO-free SDL3 GUI renderer for package gui.
Package host supplies a frame-driven desktop frontend for console backends.
Package host supplies a frame-driven desktop frontend for console backends.
Package input provides hardware controller/keyboard helpers.
Package input provides hardware controller/keyboard helpers.
internal
backends
Package backends keeps a priority-ordered registry of renderers.
Package backends keeps a priority-ordered registry of renderers.
dynlib
Package dynlib contains dynamic library helpers for multimedia backends.
Package dynlib contains dynamic library helpers for multimedia backends.
sdl2
Package sdl2 coordinates SDL2 library loading and subsystem ownership.
Package sdl2 coordinates SDL2 library loading and subsystem ownership.
sdl3
Package sdl3 coordinates SDL3 library loading and subsystem ownership.
Package sdl3 coordinates SDL3 library loading and subsystem ownership.
Package log provides nil-safe, leveled structured logging built on log/slog.
Package log provides nil-safe, leveled structured logging built on log/slog.
mcp
Package mcp provides a Model Context Protocol (MCP) server toolkit.
Package mcp provides a Model Context Protocol (MCP) server toolkit.
example command
jsonschema
Package jsonschema validates a subset of JSON Schema 2020-12.
Package jsonschema validates a subset of JSON Schema 2020-12.
mcptest
Package mcptest contains an in-process MCP client for testing servers.
Package mcptest contains an in-process MCP client for testing servers.
Package renderer contains the types that the audio and gui packages use to register and select renderers.
Package renderer contains the types that the audio and gui packages use to register and select renderers.
Package set provides a generic, type-safe set data structure implementation.
Package set provides a generic, type-safe set data structure implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL