Skip to content

retroenv/retrogolib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RetroGoLib - a Golang library for retro console tooling development

Build status go.dev reference Go Report Card codecov

Installation

go get github.com/retroenv/retrogolib

Requirements:

  • Go 1.22 or later
  • No CGO dependencies

Overview

RetroGoLib is a Golang library designed to simplify the development of tools for retro consoles. It provides a comprehensive set of functionalities for creating emulators, debugging tools, and other retro console utilities, all while maintaining minimal dependencies and focusing on clean, maintainable code.

Key Design Principles

  • Minimal Dependencies: Only one external dependency (ebitengine/purego)
  • CGO-Free: SDL support without CGO for easier cross-compilation
  • Type Safety: Extensive use of Go generics for type-safe APIs
  • Thread Safety: CPU implementations with proper synchronization patterns
  • Testing: Comprehensive test coverage with consistent assertion patterns

Supported Systems

CPUs

  • 6502: Full instruction set with accurate timing
  • Chip-8: Complete virtual machine implementation
  • Z80: Complete Z80 CPU emulation with array-based opcode tables
  • x86: Real mode instruction set (8086 through 80486)

Consoles

  • NES (Nintendo Entertainment System): Cartridge formats, memory mapping

Features

CPU Emulation

  • 6502 CPU: Full instruction set with memory management, stack operations, and interrupt support
  • Chip-8 Virtual CPU: Complete virtual machine with display, timers, and input handling
  • Z80 CPU: Complete Z80 instruction set with 16-bit registers, prefix instructions (ED/DD/FD), and interrupts
  • x86 CPU: Real mode instruction set for static analysis (8086, 80186, 80286, 80386, 80486)

System Support

  • NES (Nintendo Entertainment System): Cartridge handling, memory mapping, and parameter conversion

Package Overview

├─ app              common application/service helpers
├─ arch/cpu/chip8   Chip-8 virtual CPU support
├─ arch/cpu/m6502   6502 CPU support
├─ arch/cpu/x86     x86 real mode CPU support (8086-486)
├─ arch/cpu/z80     Z80 CPU support
├─ arch/system/nes  NES common types and helpers
├─ assert           test assertion helpers
├─ buildinfo        show version info that is embedded in the binary
├─ cli              command-line interface utilities with section-based flag parsing
├─ config           configuration management
├─ gui              GUI support - SDL without need for CGO
├─ input            hardware controller/keyboard helpers
├─ log              fast and structured logging based on slog
├─ set              generic set data structure with comprehensive operations

API Documentation

For detailed API documentation, visit pkg.go.dev.

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.

About

A standard library for Golang based retro console development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published