GB Recompiled

GB Recompiled — Free Download. Static recompiler for GameBoy ROMs
GB Recompiled translates original GameBoy ROM Z80 assembly into portable C code. The tool analyzes control flow across memory banks, decodes instructions, and generates native machine code through standard compilers. Runtime includes cycle-accurate instruction timing, precise interrupt handling, and full memory bank controller support for MBC1, MBC2, MBC3 with RTC, and MBC5.
5.0(1 ratings)

Download GB Recompiled (Official links)
File size: 1.11 MB
The latest version of GB Recompiled is: 0.0.2
Operating system: Windows, Linux, MacOS
Languages: English
Price: $0.00 USD

  • Z80 to C static translation. Each Z80 instruction converts to equivalent C code blocks maintaining exact processor behavior. Translation occurs once before compilation, eliminating interpretation overhead. Generated C code receives optimizations from modern compilers like GCC or Clang while preserving original game logic.
  • Cycle-accurate instruction timing. Implements exact timing for every Z80 instruction including the HALT bug present on real hardware. Each operation counts correct clock cycles, enabling games dependent on strict synchronization to run without desynchronization. This precision supports demos and titles using timing-based visual effects.
  • Complete memory bank controller support. Includes functional implementations of MBC1 with Mode 1, MBC2, MBC3 with real-time clock, and MBC5. These controllers manage ROM and external RAM banking, allowing games up to 8 Mbits to execute. Real-time clock on MBC3 functions correctly in games such as Pokemon Gold and Silver.
  • Parallel multi-core recompilation. Code generation process uses all available CPU cores by default. Each memory bank and code section processes simultaneously, reducing recompilation time for large ROMs. User can limit thread count using --jobs argument.
  • Android project generation. Using --android flag, the tool creates complete Android project with SDL2. Generated project targets arm64-v8a architecture, uses landscape orientation, and produces Gradle-compilable APK. Default controller mapping is position-based and remappable at runtime through SDL settings menu.
  • Imported symbol name sanitization. Labels from .sym files convert to valid C identifiers with sym_ prefix. For example, EnterMap becomes sym_EnterMap and OverworldLoop.delay.check transforms into sym_OverworldLoop_delay_check. This prevents conflicts with C language reserved keywords.
  • Address constants for RAM and HRAM. Imported RAM and HRAM labels elevate to constants such as GB_ADDR_wSoundID and GB_ADDR_hJoyHeld. Generated code accesses memory positions directly without manual address calculation, improving clarity of resulting C source files.
  • ROM data pointers and constants. Labeled ROM data from .sym files converts to GB_ROM_ADDR_* constants for addresses and GB_ROM_PTR_* pointers into rom_data[] array. Recompiler automatically treats Nintendo logo at 0x0104-0x0133 and cartridge header at 0x0134-0x014f as built-in data, preventing misinterpretation as code.
  • Game Boy Color support. Current implementation includes CGB extended instruction set, double speed mode management, and hardware detection. Representative games like Pokemon Crystal and Link's Awakening function correctly. Ongoing work focuses on CGB hardware test routines and edge-case accuracy improvements.
  • Default MinSizeRel build profile. Generated projects use size optimization with -O1, LTO disabled, and dead section stripping. This configuration facilitates manual testing and debugging. For maximum performance, Release configuration with -O3, IPO enabled, and symbol stripping disabled can be set via explicit CMake parameters.
  • Screenshot capture and instruction limit. Debugging tools enable screen capture at any moment during game execution. Instruction execution limit can be set, useful for regression testing and behavior analysis on specific ROM segments.
  • Trace logging. Recompiler generates detailed execution logs showing each executed instruction, memory bank changes, and interrupt state. This feature is essential for debugging games that malfunction after recompilation.

Development history of GB Recompiled started in 2023, created by developer arcanite24 on GitHub platform. The project emerged as alternative to traditional emulation, aiming to preserve GameBoy games through static recompilation. Primary programming language is C++ for the recompiler tool, while generated game code is standard C. Runtime library and SDL2 platform layer are also written in C.


Alternatives to GB Recompiled: