https://github.com/retroenv/retrogolib
A standard library for Golang based retro console development.
https://github.com/retroenv/retrogolib
go golang golang-library retro
Last synced: 5 months ago
JSON representation
A standard library for Golang based retro console development.
- Host: GitHub
- URL: https://github.com/retroenv/retrogolib
- Owner: retroenv
- License: apache-2.0
- Created: 2022-09-05T19:34:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T05:34:43.000Z (5 months ago)
- Last Synced: 2026-01-12T15:40:17.526Z (5 months ago)
- Topics: go, golang, golang-library, retro
- Language: Go
- Homepage:
- Size: 346 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
## RetroGoLib - a Golang library for retro console tooling development
[](https://github.com/retroenv/retrogolib/actions)
[](https://pkg.go.dev/github.com/retroenv/retrogolib)
[](https://goreportcard.com/report/github.com/retroenv/retrogolib)
[](https://app.codecov.io/gh/retroenv/retrogolib)
## Installation
```bash
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](https://pkg.go.dev/github.com/retroenv/retrogolib).
## License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.