gbaid 0.1.2-alpha

A GameBoy Advance emulator in D

To use this package, run the following command in your project's root directory:


GBAiD stands for <strong>G</strong>ame<strong>B</strong>oy <strong>A</strong>dvance <strong>i</strong>n <strong>D</strong>. I've started this project as an effort to learn the D programming language.

This emulator is written mostly in pure D, with some inline x86 (32 and 64 bit) assembly in the graphics to help with performance.

Compiling works on OS X and Windows (and likely on Linux), but due to bugs with DMD, it won't compile in release mode and linking is broken on Windows.

Current state

All of the GameBoy's built-in hardware has been implemented, with the exception of sound.

I've tested 8 games so far:

  • Super Mario Advance
  • Mario kart
  • Pokemon Emerald
  • Legend of Zelda: A Link To The Past
  • Legend of Zelda: Minish Cap
  • Doom
  • Classic NES Series: Super Mario Bros
  • Classic NES Series: Metroid

Mario Kart exhibits some light graphical glitches due problems with timings (this also affects the world map in LoZ).

The Classic NES Series games load, but are very glitchy. Considering the anti-emulation features implemented in them, just the fact that they load is a good thing.

The emulator uses just under 50% CPU on my 2.66GHz dual core i7 (4GB RAM), at 60 FPS.



GBAiD uses SDL2 for input, OpenGL graphics, sound (eventually) and controller support.

  • SDL 2.0.3 or greater is required
  • OpenGL 2.0 or greater is required


First install the DUB package manager if you haven't already. GBAiD is officially built using LDC, which should also be installed.

Then use:

dub build --compiler ldc2 --build release



dub run --compiler ldc2 --build release -- (arguments)

Or get the binary from the bin folder after building and use:

./gbaid (arguments)


At minimum, you must specify the path to the bios and rom images with

-b (path to bios) (path to rom)

The following arguments are also recognized:

Long formShort formArgumentUsage
--bios-bPath to biosSpecify bios image
--save-sPath to saveSpecify path for loading and saving saves
--noload-nNoneDon't load the save
--nosave-NNoneDon't save the save
--scale-rScaling factor (float)Draw the display at "factor" times the original resolution
--filtering-fLINEAR or NONEWhat technique to use to filter the output texture to be drawn to the screen
--upscaling-uEPX, XBR, BICUBIC or NONEWhat technique to use to increase the resolution of the drawn texture
--controller-cNoneDisable keyboard input and use a controller instead
--memory-mSee saves sectionWhat memory configuration to use for the save format

Note that these arguments are case sensitive and that bundling is only supported by the noload and nosave switches.


Saves use a custom format and .gsf extension that is not compatible with other emulators. If no save path is specified, the same path as the ROM is used, but with the .gsf extension instead of whatever the ROM image is using. If no save is found matching either the given or default path, then a new save is created using that path. Saves are overwritten on exit, unless the --nosave argument is used.

The emulator can almost always auto-detect the save type, but for some games, such as the Classic NES Series, this will not work. Instead, the --memory flag should be used, with one of the arguments from below.

SRAM64K of static RAM
SRAM_EEPROM64K of static RAM and an EEPROM
FLASH64K64K of Flash
FLASH64K_EEPROM64K of Flash and an EEPROM
FLASH128K128K of Flash
FLASH128K_EEPROM128K of Flash and an EEPROM
AUTOAuto-detect, default

For Classic NES Series games, use EEPROM

These flags are only needed when creating a new save, after that the format is saved in the save file.


These will be re-mapable soon.

UpWD-pad or L-stick
DownSD-pad or L-stick
RightDD-pad or L-stick
LeftAD-pad or L-stick
RR-shiftRB or RT
LL-shiftLB or LT


All upscaling is implemented as OpenGL shaders.

  • EPX is a simple but fast 2x upscaler.
  • XBR is a 5x implementation, it gives better results, but is slower.
  • BICUBIC is an interpolation method that offers better results than linear filtering at a greater cost. It upscales to whatever is defined by the --scale switch so it should always be used with this method.

When you use the --upscaling switch you should also use the --scale switch with the appropriate factor for the selected algorithm.


GBAiD is licensed under MIT

Useful information

This page for a whole lot of detailed information on the hardware.

This and this for a list of all instructions supported by the ARM7TDMI CPU.

  • Aleksi "DDoS" Sapon
derelict-gl3, derelict-sdl2
0.3.0-beta 2017-Jul-19
0.2.1-alpha 2017-Mar-16
0.2.0-alpha 2016-Dec-26
0.1.2-alpha 2015-Mar-25
0.1.1-alpha 2014-Dec-27
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 352 downloads total

Short URL: