Skip to content
ZapskiRetro

Super Game Boy border builder

Give it your 256×224 border art. It checks the art against the Super Game Boy's tile and palette limits, shows you which tiles break them, and writes the border as C for a GBDK game.

Choose a 256×224 PNG, drag one onto this box, or paste one.

Show

Everything happens in your browser. Your art is never uploaded.

The rules a border has to follow

  • The picture is 256×224 pixels, cut into 8×8 tiles. The Game Boy screen is the 160×144 area at (48, 40), and it has to stay transparent. Anything painted there is cleared for you.
  • A border can use three palettes of 16 colours. The Super Game Boy draws colour 0 of every palette as the backdrop, so each palette has 15 colours to paint with, and each tile uses one palette.
  • Colours have five bits a channel. Colours that differ only in the low three bits become the same colour.
  • The transfer can send 255 different tiles. A tile that is another tile mirrored counts as the same one.

Tiles are given palettes in reading order, each taking the first palette with room for its colours. The Palettes view tints every tile by the palette it landed in, which shows where the colours are going when the art needs a fourth.

Using the output

Save both files beside sgb_border.c and sgb_border.h from GB-SGB-Tooling, build with -Wm-ys, and call this once at startup before loading your own tiles:

DISPLAY_ON;
for (uint8_t i = 4; i != 0; i--) vsync();
set_sgb_border(
    border_data_tiles, sizeof(border_data_tiles),
    border_data_map, sizeof(border_data_map),
    (const unsigned char *)border_data_palettes,
    sizeof(border_data_palettes));

The files have the layout GBDK's png2asset writes, so they also replace a border_data.c you already build.

Limits

  • The art is not resized or reduced to fewer colours. Fix what the check marks in your paint program and load it again.
  • The preview is this page's reading of the data, not an emulator. Test the built ROM too: the tooling's sgb_border_test.py does that in PyBoy.
  • The output is for GBDK-2020. There is no RGBDS export, and no #pragma bank line; add one if the border lives in a switched bank.

How the border transfer works, and the bugs we fixed in it. To see a border made this way, play FPS Dungeon.

More tools