Categorygithub.com/cbott/GoEmulate
modulepackage
0.0.0-20231222185746-dd0d066a6937
Repository: https://github.com/cbott/goemulate.git
Documentation: pkg.go.dev

# README

GoEmulate

Game Boy Emulator in Go

GoEmulate is an emulator for the original Game Boy (DMG) written entirely in Go, utilizing the pixel library for graphics and Oto for sound. The goal of the project is to reach basic emulator functionality with minimal code complexity, and very little focus on UI or useability.

Currently no support is planned for GBC/GBA emulation

Note: this is a learning project, and the first emulator I have written. The code was heavily influenced by all the projects listed below as development resources and I encourage you to use them directly.

Features

  • Run most ROM only, MBC1, MBC3, and MBC5 cartridge types that I have tried, though Donky Kong has issues
  • Save RAM to a ".ram" file
  • Optionally skip Boot ROM (default)
  • Save and recall CPU state
  • Speed Up / Fast-Forward

Sample Screenshots:

Pokemon Yellow Tetris

Emulator Controls

KeyAction
XGame Boy "A" button
ZGame Boy "B" button
SGame Boy "Select" button
EnterGame Boy "Start" button
Arrow keysGame Boy Joypad directions
PWrite contents of RAM to file
+Increase emulation speed (Up to 10x)
-Decrease emulation speed
1,2,3Save CPU state 1-3
Shift+1,2,3Recall CPU state 1-3

Setup

Per pixel requirements https://github.com/gopxl/pixel#requirements

sudo apt install libgl1-mesa-dev
sudo apt install xorg-dev

To Do List

  • other cartridge types
  • more unit tests
  • better error handling
  • allow loading files from GUI or similar
  • implement serial

Completed Tasks

  • CPU save states
  • longer compare with goboy
  • access registers by enum
  • window scaling
  • MBC3 cartridge type
  • code cleanup/resolve todos
  • implement sound
  • RAM saving
  • reorganize into packages
  • fix display bug with window over background
  • Speed up
  • allow loading files from cmd line argument

Development Resources

Other emulators used for comparison

Game Boy docs:

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Constants

initial size of the Game Boy window, overridden by command line flag.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Game Boy joypad.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
SHIFT + SAVESTATE restores a previously saved state.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Button-to-keyboard mapping.
Emulator controls.
Maximum allowable speed multiplier for emulation.

# Structs

Emulator defines a convenient structure for passing logic core, display, and state information around together.