2020q3 專題: Game Boy 模擬器
目標
- 改進給定的 Game Boy 模擬器,提升其執行效率、程式碼重構 (refactor),及其相容性
- 量化分析直譯器效率,並尋求效能改進的方案
- 實作 CPU 除錯器,允許單步執行和分析特定記憶體內容
準備工作
Game Boy 硬體資訊
Game Boy 的硬體設計與運作原理
現有的 Game Boy 模擬器
- binjgb
- 可在網頁瀏覽器中啟動
- Convenient Python test harness using hashes to validate
- Debugger with various visualizations
- jgbc
- SameBoy
- Supports Game Boy (DMG) and Game Boy Color (CGB) emulation
- High quality 96KHz audio
- Battery save support
- Save states
- Advanced text-based debugger with an expression evaluator, disassembler, conditional breakpoints, conditional watchpoints, backtracing and other features
- Several scaling algorithms (Including exclusive algorithms like OmniScale and Anti-aliased Scale2x; Requires OpenGL 3.2 or later or Metal)
- PlutoBoy
- GBC
- When the emulator detects unexpected behavior (e.g., accessing an unknown memory region), it will drop into a built-in debugger.
- Worldwide: GameBoyColor emulator written in Go
- dmg
- mgba/src/sm83: mGBA 是 Game Boy Advance 模擬器,儘管主要針對 ARMv4T,但裡頭的 sm83 則是針對 GBZ80,這部分程式碼相當簡潔並附有指令層級除錯器
- 取得原始程式碼:
- 安裝 SDL2 套件
- 編譯
- 下載 Game Boy ROM 並測試
預期會見到以下執行畫面:

Computed Goto
Opcode Generator / Instruction Tester
- 參照 emu-gameboy,允許由表格來產生 opcode 及其實作程式碼
- 預期產出
- GBIT: Game Boy Instruction Tester
- Tests all instructions of a Game Boy CPU against a known-good implementation to detect implementation bugs.
- Useful for testing and debugging, especially early on in Game Boy emulator development where test ROMs do not run yet.
研究進度
gameboy-emu
參考資訊