top of page

Build Your Own Game Boy Game, Part 1: Setting Up Your Workshop

  • Writer: Marcel Pflug
    Marcel Pflug
  • Mar 12
  • 5 min read

Updated: Jul 4

The Game Boy did not just give us games to play. It gave a whole generation the itch to make them. If you have ever held a DMG-01 and wondered what it would feel like to write something of your own for it, this series is for you. Over the next few parts we are going to build a complete, playable game from scratch, in the C programming language, and run it on a real Game Boy. The game we will make is Snake: simple enough to understand fully, yet a proper game with food, growth and a satisfying way to lose.

You do not need to be a professional programmer to follow along. A little curiosity and a willingness to experiment is enough. This first part is all about setting up your workshop, so that by the end you have written your very first Game Boy program and watched it boot up on screen.

Why Write a New Game for a 1989 Console

Here is the wonderful part. The Game Boy is still very much alive as a platform for makers. Thanks to a dedicated community, the tools to build new games are free, modern and surprisingly friendly. The machine itself is also a joy to develop for, precisely because it is so limited. There is no sprawling operating system to fight and no hidden layers. You talk almost directly to the hardware, and you can hold the entire console in your head. When your code finally runs on that pea-green screen, it feels like magic in a way that modern development rarely does.

The Toolchain: Meet GBDK-2020

To turn code into a Game Boy game we need a toolchain: a set of programs that take what you type and translate it into something the console can run. We will use GBDK-2020, the Game Boy Development Kit. It is a modern, actively maintained descendant of the original GBDK from the 1990s, and it bundles everything you need in one package: a C compiler, an assembler, a linker and a library of ready-made functions for talking to the Game Boy hardware.


In plain terms, you write your game in C, GBDK-2020 compiles it, and out comes a .gb file. That .gb file is a ROM, the exact same kind of file a real cartridge holds. It will run in an emulator on your computer and, with the right hardware, on an actual Game Boy.

What You Will Need

The good news is that the whole setup is free and runs on Windows, macOS and Linux. You need four things. First, a copy of GBDK-2020. Second, a plain text or code editor to write your C files; something like Visual Studio Code works beautifully, but even a simple editor will do. Third, a Game Boy emulator to test your game quickly, where Emulicious, BGB and SameBoy are all excellent and free. And fourth, optional but deeply rewarding, a flash cartridge such as an EverDrive so you can eventually play your creation on a genuine DMG-01.

Installing GBDK-2020

Installation is refreshingly simple, because there is no installer. Head to the GBDK-2020 releases page on GitHub and download the latest package for your operating system. Unzip it somewhere sensible, for example a folder called gbdk in your home directory. Inside you will find a folder named bin, and that is where the important tools live. The one we care about most is called lcc, the program that turns your C code into a ROM. There is nothing else to configure to get started. GitHub Page: https://github.com/gbdk-2020/gbdk-2020/releases

Your First Steps in Game Boy Programming

With the toolkit in place, let us write something. Create a new file called hello.c and type in the following. It is about as small as a Game Boy program gets, and it already does something real.

#include <gb/gb.h>
#include <stdio.h>

void main(void) {
    printf("HELLO, GAME BOY!");
}

Before we run it, let us read those few lines, because you will meet them again and again. The two #include lines at the top pull in ready-made code so we can use it: gb.h brings in the Game Boy functions, and stdio.h brings in printf. The line void main(void) marks where the program begins; every Game Boy program starts running from main, and the curly brackets hold everything it does. Inside, the single instruction printf("HELLO, GAME BOY!"); prints that text on the screen. That really is a complete program: pull in what you need, then do one thing.

Save the file. Now open a terminal, navigate to the folder that contains hello.c, and run a single command. Adjust the path so that it points at the lcc program inside your GBDK bin folder.

lcc -o hello.gb hello.c

If everything is set up correctly, you will now have a brand new file sitting right next to your code: hello.gb. That is a real Game Boy ROM, and you wrote it. Open it in your emulator and you should see your message printed on screen in that unmistakable Game Boy font. Take a moment to enjoy it. You are now, officially, a Game Boy developer.


Develop your own Game Boy Game "Hello, Game Boy!"
Your first line of Code "Hello, Game Boy!"

What Just Happened

In just a few seconds, GBDK-2020 did quite a lot on your behalf. It compiled your C into the low-level machine code that the Game Boy's processor understands, linked it with the kit's built-in library, and packaged the result into a .gb ROM laid out exactly the way the console expects. The printf function you called is part of that library; it quietly handled the fiddly business of drawing letters on the screen. As the series goes on we will step away from printf and start drawing our own graphics, which is where the real fun begins.

Coming Up in Part 2

Before we can move a snake around the screen, we need to understand how the Game Boy actually draws anything at all. It does not work like a modern computer with a simple canvas of pixels. Instead it thinks in small tiles and sprites, a clever system born from the hardware limits of 1989. In the next part we will explore that mental model, and it will make everything that follows click into place.

If you want to get to know the machine we are writing for, browse the collection or look closely at the original DMG-01 console that started it all. Then open your editor, install the tools, and get that first ROM running. See you in Part 2.


The Full Series


Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page