需要 Go 1.25 或更高版本才能从源码构建;模拟器本身不含游戏,需自备 .gb/.gbc ROM 文件作为参数传入;存档写在 ROM 同目录下的 .sav,注意该目录需可写。

goboy
HumphehMIT活跃维护用 Go 写的跨平台 Game Boy Color 模拟器,能在 macOS、Windows 等系统上运行 Game Boy 和 GBC 游戏,适合想研究模拟器实现或重温老游戏的开发者。
Multi-platform Nintendo Game Boy Color emulator written in Go
go install github.com/Humpheh/goboy/cmd/goboy@latest
goboy zelda.gbREADME 未说明显存或 GPU 型号要求;依赖 Ebitengine 的图形后端,可在 Windows、macOS、Linux、WebAssembly、FreeBSD 上运行且无需 cgo,其他平台需参考 Ebitengine 安装指南。
用 Go 写的跨平台 Game Boy / Game Boy Color 模拟器,能跑大多数 GB 和 CGB 游戏
用 Go 写的跨平台 Game Boy Color 模拟器,能在 macOS、Windows 等系统上运行 Game Boy 和 GBC 游戏,适合想研究模拟器实现或重温老游戏的开发者。
核心能力
- 基于 Ebitengine 渲染图形与输入、Oto 输出声音
- 支持 Windows、macOS、Linux、WebAssembly、FreeBSD 且无需 cgo
- 内置调试功能:逐条打印 opcode 与寄存器值、单独开关四个声道
- 按住 Tab 以 2 倍速快进,按 F 切换全屏
- 卡带带电池时自动生成同名 .sav 存档并每秒刷新
容易踩的坑
- v0.5GoBoy v0.5最新正式版2020-08-09 · 2020-08-09 11:00 UTC
GoBoy v0.5 introduces a number of changes that improve the accuracy and performance of the emulator. A new APU emulation implementation now correctly times the audio with the cpu emulation, resulting in much more accurate audio playback. There have also been a number of improvements to the GPU emulation, fixing multiple sprite ordering issues and rendering bugs. Finally there are also a number of changes to improve the emulator performance.
Notable changes
f876370, da8716d - Improvements to the CPU instruction implementation for a speed increase (#21, #33) 3357ab5, 98ad423 - Implement CGB background and sprite priority rendering resolution 1f1b37e - Match APU buffering to CPU ticks (#29)
- v0.4.2GoBoy v0.42018-11-26 · 2018-11-26 22:08 UTC
查看更新说明
GoBoy v0.4 introduces some significant performance increases - seeing up to a 2x fps increase since v0.3. It also adds a dialog prompt to select the rom without running from command line, and now outputs a MacOS app which can be run standalone.
Notable Changes
21db2c2 - Pixelgl hack to make window render on darwin 5111e5b - Pick colours using array instead of map (x2 performance increase!) f086e25 - File prompt and bundled Darwin build (#14)
- v0.3GoBoy v0.32018-11-02 · 2018-11-02 12:23 UTC
查看更新说明
GoBoy v0.3 introduces a new APU engine which should be significantly more accurate than the previous one. There are still issues with sound (especially channel 3), but it is significantly better than before.
Notable Changes
e32643c - Refactor cart memory and logic, fix timers and DMA transfers (#9) 8fabcd2 - Fix graphics issue with underflowing sprite x-position 017832c - Sound v2 using lower level
otopackage (#10) - v0.2GoBoy v0.22018-07-13 · 2018-07-13 16:25 UTC
查看更新说明
Fixes a number of graphics issues.
- v0.1GoBoy v0.1pre-release2017-10-01 · 2017-10-01 10:32 UTC
查看更新说明
Initial release of GoBoy for Windows and MacOS! This version contains a playable GameBoy emulator complete with video, experimental audio and input.
Running
GoBoy must be run from the command line. To run, simply open a command prompt and navigate to the directory with goboy:
Windows
goboy-v0.1-win64.exe -sound -rom <rom>MacOS
chmod +x goboy-v0.1-mac64 ./goboy-v0.1-mac64 -sound -rom <rom>
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
GoBoy
GoBoy is a multi-platform Nintendo GameBoy and GameBoy Color emulator written in go. The emulator can run the majority of GB games and CGB games. Please feel free to contribute if you're interested in GameBoy emulator development.
The program includes debugging functions making it useful for understanding the emulator operation for building one yourself. These functions include printing of opcodes and register values to the console at each step (although will greatly slow down the emulation) and toggling of individual sound channels.
Installation
Download the latest release of GoBoy from the releases page.
Building from source
GoBoy requires Go 1.25 or later. With Go installed, you can install GoBoy into your go bin by running:
go install github.com/Humpheh/goboy/cmd/goboy@latest
Or build it from a clone of the repository:
git clone https://github.com/Humpheh/goboy.git
cd goboy
go build -o goboy ./cmd/goboy
GoBoy is compatible with macOS, Windows and Linux. It uses Ebitengine for graphics and input, and Oto for sound.
Thanks to Ebitengines support, GoBoy can run on these platforms with no cgo required:
- Windows
- macOS
- Linux
- WebAssembly
- FreeBSD
See the Ebitengine install guide for other platforms including Android, iOS, Nintendo Switch and Xbox.
Usage
goboy zelda.gb
Controls: ← ↑ ↓ → Z X Enter Backspace
Hold Tab to fast-forward at 2x speed, and press F to toggle fullscreen.
Other options:
-dmg
set to force dmg mode
-mute
mute sound output
Debug or experimental options:
-debug
enable debug functionality on startup
-cpuprofile string
write cpu profile to file (debugging)
-disableVsync
set to disable vsync (debugging)
-stepthrough
step through opcodes (debugging)
-unlocked
if to unlock the cpu speed (debugging)
Debugging
There are a few keyboard shortcuts useful for debugging. They are only active while debug
functionality is enabled, which can be toggled with </kbd> or turned on at startup with -debug:
Esc - pause/resume emulation = - cycle the colour palette (DMG mode) Q - force toggle background W - force toggle sprites D - print background map to log E - toggle opcode printing to console (will slow down execution) 7,8,9,0 - toggle sound channels 1 through 4.
Saving
If the loaded rom supports a battery a <rom-name>.sav (e.g. zelda.gb.sav) file will be created
next to the loaded rom containing a dump of the RAM from the cartridge. A loop in the program will
update this save file every second while the game is running.
Tests
GoBoy currently passes Blargg's cpu_instrs, instr_timing, mem_timing and interrupt_time test roms,
and Mooneye's sprite_priority test.
These roms are included in the source code under roms/ along with tests in pkg/gb that check the
output is as expected. Run them with go test ./...; they are also run by GitHub Actions on each commit.
Contributing
Please feel free to open pull requests to this project or play around if you're interested! There are still plenty of small bugs that can easily be found through playing games on the emulator, or take a task from the TODO list below!
Known Bugs and TODO list
- Minor APU timing issues
- MBC3 clock support
- Platform native UI?
- More DMG colour palettes
- Support save-states
- Support boot roms
- Blargg's test ROMs
Resources
A large variety of resources were used to understand and test the GameBoy hardware. Some of these include:
- http://www.codeslinger.co.uk/pages/projects/gameboy/files/GB.pdf
- https://github.com/retrio/gb-test-roms
- http://www.codeslinger.co.uk/pages/projects/gameboy/beginning.html
- http://bgb.bircd.org/ - invaluable for debugging
- https://github.com/AntonioND/giibiiadvance/tree/master/docs
- https://github.com/trekawek/coffee-gb