Game Boy Development Tutorial

Note: All required files for this tutorial can be found in the Software section on this website, under Nintendo Game Boy -> Software.


Introduction (this page)
Example 1 Basic screen output
Example 2 Input & Output example
Example 3 Input, output and simple strings
Example 4 Basic joypad use
Sprite 1 Using backgrounds
Sprite 2 Putting a sprite on the screen
Sprite 3 Animating a sprite
Sprite 4 Controlling sprites with joypad
Sprite 4a Updated efficient sprite movement
Detect 1 Collision detection v1.0
Detect 1.2 Collision detection v1.2
Detect 1.4 Collision detection v1.4
Detect 1.5 Collision detection v1.5 (tidier more efficient code)
Detect 1.6 Collision detection v1.6 - Level storage system
Detect 1.61 Collision detection v1.6 - graphics
Random - Simple random number generator


Hi, I guess the reason you're here is that you would like to start GameBoy programming, great I wish you luck !

But first you will need to know what programs you need, and how to set them up, this is where this page comes in. This page will help you set up all the programs needed to start progamming the GameBoy in C.  

In the begining....

To start with I shall explain the basic elements of GameBoy programming.

  • Source code - Our acutal program listing we have written.
  • GBDK - Takes our source code and compiles it into a ROM image.
  • ROM image - a binary file that the GameBoy or an emulator reads and runs.
  • Emulator - allows a computer to emulate a GameBoy.

This is basicaly the development process of GameBoy Programming.

We write our source code, compile it, then run it on an emulator !  

C Programming

It is beyond my limits to teach you how to program in C. There are a lot of resources on the net which are very good. You only need a basic understanding of the language to get started in GameBoy programming, as you are always learning.  

GameBoy Development Kit (GBDK)

This is the compiler and linker for our GameBoy source code, ie it takes our source code and turns it into a ROM image, which we can then run on an emulator. You can download GBDK from the Software page.  

Setting up GBDK.

  • This must be installed on the root of your Hard Drive. eg. unzip it to C:\
  • It will create it's own directories, something like C:\Sdk\gb-gb\2-0-17\  
  • The next thing we must do is compile the libaries, and examples.
  • Go to the \libs directory and run the file called MAKE.BAT
  • Then go to the \examples directory and run MAKE.BAT in there as well.  

We can now use GBDK to compile our GameBoy code, but if we want to run our examples we will need an emulator.  


For these examples we will be using VGB for Dos Ver 0.88. Get this from the Software page.

  • Unzip this program to a directory called C:\vgb\

We can now run our source code on this emulator, but because it is a dos program it would involve copying our files and using command lines to get it running so we won't, because to make our life a lot easier Ian James has wrote the GameBoy Development Studio, which will let you do this and more from Win95.  

GameBoy Development Studio

  • Download the GBDS from here.
  • Unzip it into a temp directory and run the installer, which will automaticly create directories and install GBDS correctly.
  • After installation is complete, find from your Start / Programs menu 'GB Development Studio' and run the 'Code Editor'.

And to set it up to work with GBDK and an emulator follow these instructions...

  • With the Code Editor running, select from the menu bar at the top of the screen 'Run' then 'Options'
  • You will then see a new window called 'Options'  
  • The first text box called 'Compiler' needs to point to our compiler, to set this up click on Browse.
  • We will then see a standard 'File Open' dialogue box, and we then need to locate 'lcc.exe' which will be in our \bin directory. eg. C:\Sdk\gb-gb\2-0-17\bin\lcc.exe
  • After selecting this file click 'Open' which will then fill in the 'Compiler' field.  
  • With the 'Options' window still visable click on 'Browse' next to 'Emulator'.
  • We then need to tell it where our emulator is, using the 'File Open' dialogue box locate your chosen emulator.
  • If you install VGB as above this will be C:\vgb\vgb.exe Select the file then click 'OK'  

In the end....

You are now ready to start writing your own GameBoy Code ! Have fun !

If you like, you could download some examples from here

Simply unzip them in a temp directory, and open them in the 'Code Editor' and click 'Run' to see them compiled and running on your emulator !

Questions ?

Check out the new GameBoy Support Formus !

People available 24/7 to answer any questions you may have on GB, GBC and Advance.