Nana (ナナ)
“The more my dreams are fulfilled, the quicklier they become realities losing their shine.”
Nana (ナナ) is a Game Boy emulator written in Go. It's far from feature complete and there are still bugs in what it's implemented but what I got here helped me a lot to understand how computers work at one of their lowest levels, I hope this too helps someone else.
ROM Compatibility list
- Tetris
- The Legend of Zelda: Link's Awakening
Dependencies
Linux dependencies are listed here.
Installation
$ go get github.com/Ruenzuo/nana
Cross-compiling
See libsdl.org/extras/win32/cross/README.txt for information on how to build SDL for 64 bit mingw cross-compiler
$ make build-windows
Pre-compiled binaries
See Releases
Usage
$ nana path/to/rom.gb
Environment variables
NANA_DEBUG
: enables buffered debug output to nana.logNANA_LCD_STATE_DEBUG
: includes the LCD state in debug outputNANA_MEMORY_ACCESS_DEBUG
: includes the LCD state in debug outputNANA_ENABLE_TEST_PANICS
: panic on undefined behaviourNANA_ENABLE_REWIND
: hold F10 to rewind the emulationNANA_MAX_CYCLES
: enables automatic shut down to specific cycle threshold
Building your own emulator
- Start with 8-bit system
- Performance matters, profile constantly against other emulators to check how you're doing so far. You can get some inspiration from hachiko
- Implement the full instruction set + jump table first. Then try your work against an emulation test collection, these are excelent to catch edge cases and implement the bugs the original systems had
- Game Boy CPU Manual
- Game Boy Programming Manual