Ubuntu 需先装 libasound2-dev 及 libxkbcommon-dev、libwayland-cursor0、libwayland-dev;Windows 需装 Microsoft C++ Build Tools;音频默认关闭,要加 --enable-audio 才有声音。
cargo run --release -- ./res/pokemon_crystal.gbcREADME 未说明显存或 GPU 要求;已在 Windows、Ubuntu、Mac 上测试,依赖 cpal 与 minifb 的原生库。
用 Rust 写的跨平台 GameBoy 模拟器,能跑商业 ROM,还通过了硬件测试套件
用 Rust 写的跨平台 GameBoy 模拟器,功能完整,能在不同系统上跑 GameBoy 游戏。
核心能力
- 用 Rust 实现基于时钟周期的硬件模拟
- 通过 Blargg 与 Mooneye 硬件测试 ROM
- 支持音频开关、1/2/4/8 倍缩放与倍速
- UI 模块化,可自行替换为终端或 Web 前端
- 内置按键映射:Z/X 对应 A/B,方向键对应十字键
容易踩的坑
- v2.0.0最新正式版2026-05-15 · 2026-05-15 09:44 UTC
What's Changed
- add mac output file
mods/Boxes (PD).savto .gitignore by @urmyfaith in https://github.com/mohanson/gameboy/pull/1 - Fully rewrote the scanline function in GPU by @mohanson in https://github.com/mohanson/gameboy/pull/3
- Add Blargg's Gameboy hardware test by @mohanson in https://github.com/mohanson/gameboy/pull/4
- Rewrite the timer by @mohanson in https://github.com/mohanson/gameboy/pull/6
- Rewrite DMA Transfer in GPU by @mohanson in https://github.com/mohanson/gameboy/pull/7
- Fully rewrited the cpu and gpu, also closed the apu. by @mohanson in https://github.com/mohanson/gameboy/pull/10
- Typos: GameBoy => Game Boy by @mohanson in https://github.com/mohanson/gameboy/pull/11
- Rewrite interrupt by @mohanson in https://github.com/mohanson/gameboy/pull/12
- Partial rewriting of the audio portion by @mohanson in https://github.com/mohanson/gameboy/pull/13
- Fix half carry flag logic in alu_add_hl by @nwtnni in https://github.com/mohanson/gameboy/pull/14
- Remove redundant code about clock by @mohanson in https://github.com/mohanson/gameboy/pull/16
- make command line options more discoverable by @ethanpailes in https://github.com/mohanson/gameboy/pull/19
- fix frame timing drift bug on slow boxes by @ethanpailes in https://github.com/mohanson/gameboy/pull/21
- render in terminal via blockish by @yazgoo in https://github.com/mohanson/gameboy/pull/22
- blockish update by @yazgoo in https://github.com/mohanson/gameboy/pull/23
- Use features to distinguish ui by @mohanson in https://github.com/mohanson/gameboy/pull/24
- fix tty mode by @yazgoo in https://github.com/mohanson/gameboy/pull/27
- parallelize blockish by @yazgoo in https://github.com/mohanson/gameboy/pull/26
- Fix(Hdma): fix the address value in get method. by @Hanaasagi in https://github.com/mohanson/gameboy/pull/30
- update Cargo.lock to fix issue #32 by @heropoo in https://github.com/mohanson/gameboy/pull/33
- Update README.md by @eric-lac in https://github.com/mohanson/gameboy/pull/36
- Specify native dependencies in README.md by @rhian-cs in https://github.com/mohanson/gameboy/pull/37
- Added an extra game after testing by @carnageiron in https://github.com/mohanson/gameboy/pull/40
- Update cpal to v0.15 by @mohanson in https://github.com/mohanson/gameboy/pull/41
- fixed audio timer period overflow by @stecheiguess in https://github.com/mohanson/gameboy/pull/42
- Refactor OAM DMA process by @mohanson in https://github.com/mohanson/gameboy/pull/44
- Pass all blargg and mooneye test cases by @mohanson in https://github.com/mohanson/gameboy/pull/45
- Refactor Global struct field order and initialize sdiv in power_up by @mohanson in https://github.com/mohanson/gameboy/pull/46
- Refactor serial by @mohanson in https://github.com/mohanson/gameboy/pull/47
- Refactor joypad by @mohanson in https://github.com/mohanson/gameboy/pull/48
- Add a cycles counter that only strictly increases by @mohanson in https://github.com/mohanson/gameboy/pull/49
- Refactor dma by @mohanson in https://github.com/mohanson/gameboy/pull/50
New Contributors
- @urmyfaith made their first contribution in https://github.com/mohanson/gameboy/pull/1
- @nwtnni made their first contribution in https://github.com/mohanson/gameboy/pull/14
- @ethanpailes made their first contribution in https://github.com/mohanson/gameboy/pull/19
- @yazgoo made their first contribution in https://github.com/mohanson/gameboy/pull/22
- @Hanaasagi made their first contribution in https://github.com/mohanson/gameboy/pull/30
- @heropoo made their first contribution in https://github.com/mohanson/gameboy/pull/33
- @eric-lac made their first contribution in https://github.com/mohanson/gameboy/pull/36
- @rhian-cs made their first contribution in https://github.com/mohanson/gameboy/pull/37
- @carnageiron made their first contribution in https://github.com/mohanson/gameboy/pull/40
- @stecheiguess made their first contribution in https://github.com/mohanson/gameboy/
- add mac output file
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Gameboy
Full-featured Cross-platform GameBoy emulator. Forever boys!

You can start a game with the following command. The following example uses the built-in game "POKEMON CRYSTAL":
$ cargo run --release -- ./res/pokemon_crystal.gbc
The following options are supported:
-a, --enable-audio Enable audio, default is false
-x, --scale-factor Scale the video by a factor of 1, 2, 4, or 8
-s, --speed-factor Set the emulator speed (1 for normal speed, 2 for double speed, etc)
Gameboy is developed in Rust and has been thoroughly tested on Windows, Ubuntu, and Mac.
Dependencies
This project depends on the following Rust libraries, which have native dependencies:
You may need to install the native dependencies these libraries require before running this emulator.
For Ubuntu Linux, you can run:
sudo apt install libasound2-dev # Install cpal dependencies
sudo apt install libxkbcommon-dev libwayland-cursor0 libwayland-dev # Install minifb dependencies
For Windows, you should install Microsoft C++ Build Tools.
Controls
_n_________________
|_|_______________|_|
| ,-------------. |
| | .---------. | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | `---------' | |
| `---------------' |
| _ GAME BOY |
Up | _| |_ ,-. | ----> Z
Left/Right <--- ||_ O _| ,-. "._,"|
Down | |_| "._," A | ----> X
| _ _ B |
| // // |
| // // \\\\\\ | ----> Enter/BackSpace
| ` ` \\\\\\ ,
|________...______,"
Develop your own UI
This emulator is designed to be modular, allowing you to replace the built-in UI with your own implementation. In terms of default settings, all the code related to display and audio is located in the mode_minifb() function in src/main.rs. You can refer to this code and then easily implement your own UI: for example, Gameboy running in the terminal or web.
Tests
This project is a cycles-based hardware simulator that has passed all Blargg's Gameboy hardware test ROMs and Mooneye Test Suite.
$ cargo run --example blargg
| Test Name | Result |
|---|---|
| cgb_sound | ![]() |
| cpu_instrs | ![]() |
| dmg_sound | ![]() |
| halt_bug | ![]() |
| instr_timing | ![]() |
| interrupt_time | ![]() |
| mem_timing | ![]() |
| mem_timing-2 | ![]() |
| oam_bug | ![]() |
$ cargo run --example mts
| Test Name | Result |
|---|---|
| acceptance/add_sp_e_timing.gb | Passed |
| acceptance/bits/mem_oam.gb | Passed |
| acceptance/bits/reg_f.gb | Passed |
| acceptance/bits/unused_hwio-GS.gb | Passed |
| acceptance/boot_div-S.gb | / |
| acceptance/boot_div-dmg0.gb | / |
| acceptance/boot_div-dmgABCmgb.gb | Passed |
| acceptance/boot_div2-S.gb | / |
| acceptance/boot_hwio-S.gb | / |
| acceptance/boot_hwio-dmg0.gb | / |
| acceptance/boot_hwio-dmgABCmgb.gb | Passed |
| acceptance/boot_regs-dmg0.gb | / |
| acceptance/boot_regs-dmgABC.gb | Passed |
| acceptance/boot_regs-mgb.gb | / |
| acceptance/boot_regs-sgb.gb | / |
| acceptance/boot_regs-sgb2.gb | / |
| acceptance/call_cc_timing.gb | Passed |
| acceptance/call_cc_timing2.gb | Passed |
| acceptance/call_timing.gb | Passed |
| acceptance/call_timing2.gb | Passed |
| acceptance/di_timing-GS.gb | Passed |
| acceptance/div_timing.gb | Passed |
| acceptance/ei_sequence.gb | Passed |
| acceptance/ei_timing.gb | Passed |
| acceptance/halt_ime0_ei.gb | Passed |
| acceptance/halt_ime0_nointr_timing.gb | Passed |
| acceptance/halt_imePassed_timing.gb | Passed |
| acceptance/halt_imePassed_timing2-GS.gb | Passed |
| acceptance/if_ie_registers.gb | Passed |
| acceptance/instr/daa.gb | Passed |
| acceptance/interrupts/ie_push.gb | Passed |
| acceptance/intr_timing.gb | Passed |
| acceptance/jp_cc_timing.gb | Passed |
| acceptance/jp_timing.gb | Passed |
| acceptance/ld_hl_sp_e_timing.gb | Passed |
| acceptance/oam_dma/basic.gb | Passed |
| acceptance/oam_dma/reg_read.gb | Passed |
| acceptance/oam_dma/sources-GS.gb | Passed |
| acceptance/oam_dma_restart.gb | Passed |
| acceptance/oam_dma_start.gb | Passed |
| acceptance/oam_dma_timing.gb | Passed |
| acceptance/pop_timing.gb | Passed |
| acceptance/ppu/hblank_ly_scx_timing-GS.gb | Passed |
| acceptance/ppu/intr_Passed_2_timing-GS.gb | Passed |
| acceptance/ppu/intr_2_0_timing.gb | Passed |
| acceptance/ppu/intr_2_mode0_timing.gb | Passed |
| acceptance/ppu/intr_2_mode0_timing_sprites.gb | Passed |
| acceptance/ppu/intr_2_mode3_timing.gb | Passed |
| acceptance/ppu/intr_2_oam_ok_timing.gb | Passed |
| acceptance/ppu/lcdon_timing-GS.gb | Passed |
| acceptance/ppu/lcdon_write_timing-GS.gb | Passed |
| acceptance/ppu/stat_irq_blocking.gb | Passed |
| acceptance/ppu/stat_lyc_onoff.gb | Passed |
| acceptance/ppu/vblank_stat_intr-GS.gb | Passed |
| acceptance/push_timing.gb | Passed |
| acceptance/rapid_di_ei.gb | Passed |
| acceptance/ret_cc_timing.gb | Passed |
| acceptance/ret_timing.gb | Passed |
| acceptance/reti_intr_timing.gb | Passed |
| acceptance/reti_timing.gb | Passed |
| acceptance/rst_timing.gb | Passed |
| acceptance/serial/boot_sclk_align-dmgABCmgb.gb | Passed |
| acceptance/timer/div_write.gb | Passed |
| acceptance/timer/rapid_toggle.gb | Passed |
| acceptance/timer/tim00.gb | Passed |
| acceptance/timer/tim00_div_trigger.gb | Passed |
| acceptance/timer/tim0Passed.gb | Passed |
| acceptance/timer/tim0Passed_div_trigger.gb | Passed |
| acceptance/timer/timPassed0.gb | Passed |
| acceptance/timer/timPassed0_div_trigger.gb | Passed |
| acceptance/timer/timPassedPassed.gb | Passed |
| acceptance/timer/timPassedPassed_div_trigger.gb | Passed |
| acceptance/timer/tima_reload.gb | Passed |
| acceptance/timer/tima_write_reloading.gb | Passed |
| acceptance/timer/tma_write_reloading.gb | Passed |
| emulator-only/mbcPassed/bits_bankPassed.gb | Passed |
| emulator-only/mbcPassed/bits_bank2.gb | Passed |
| emulator-only/mbcPassed/bits_mode.gb | Passed |
| emulator-only/mbcPassed/bits_ramg.gb | Passed |
| emulator-only/mbcPassed/multicart_rom_8Mb.gb | / |
| emulator-only/mbcPassed/ram_256kb.gb | Passed |
| emulator-only/mbcPassed/ram_64kb.gb | Passed |
| emulator-only/mbcPassed/rom_Passed6Mb.gb | Passed |
| emulator-only/mbcPassed/rom_PassedMb.gb | Passed |
| emulator-only/mbcPassed/rom_2Mb.gb | Passed |
| emulator-only/mbcPassed/rom_4Mb.gb | Passed |
| emulator-only/mbcPassed/rom_5Passed2kb.gb | Passed |
| emulator-only/mbcPassed/rom_8Mb.gb | Passed |
| emulator-only/mbc2/bits_ramg.gb | Passed |
| emulator-only/mbc2/bits_romb.gb | Passed |
| emulator-only/mbc2/bits_unused.gb | Passed |
| emulator-only/mbc2/ram.gb | Passed |
| emulator-only/mbc2/rom_PassedMb.gb | Passed |
| emulator-only/mbc2/rom_2Mb.gb | Passed |
| emulator-only/mbc2/rom_5Passed2kb.gb | Passed |
| emulator-only/mbc5/rom_Passed6Mb.gb | Passed |
| emulator-only/mbc5/rom_PassedMb.gb | Passed |
| emulator-only/mbc5/rom_2Mb.gb | Passed |
| emulator-only/mbc5/rom_32Mb.gb | Passed |
| emulator-only/mbc5/rom_4Mb.gb | Passed |
| emulator-only/mbc5/rom_5Passed2kb.gb | Passed |
| emulator-only/mbc5/rom_64Mb.gb | Passed |
| emulator-only/mbc5/rom_8Mb.gb | Passed |
| madness/mgb_oam_dma_halt_sprites.gb | / |
| manual-only/sprite_priority.gb | / |
| misc/bits/unused_hwio-C.gb | / |
| misc/boot_div-A.gb | / |
| misc/boot_div-cgb0.gb | / |
| misc/boot_div-cgbABCDE.gb | / |
| misc/boot_hwio-C.gb | / |
| misc/boot_regs-A.gb | / |
| misc/boot_regs-cgb.gb | / |
| misc/ppu/vblank_stat_intr-C.gb | / |
| utils/bootrom_dumper.gb | / |
| utils/dump_boot_hwio.gb | / |
References
- Gbdev
- Open Game Boy Documentation Project
- LR35902 Opcodes
- LR35902 Opcodes Table
- Game Boy Memory Map
- Game Boy Technical Data
- awesome-gbdev
- List of MBC roms
- Roms download
Licenses
MIT.








