Gameboy Coding : Hello World

It’s long been an ambition of mine to Program something on the classic Gameboy. It’s been a faithful companion throughout my childhood, on car trips and as I sat in the bedroom completing Super Mario Land for the hundredth time. The good news is that if you know the C Programming Language its quite easy to begin coding for this handheld gem.

If you are new to C there’s some excellent tutorials out there I would recommend The following video series to get started:

Things you will Need

Getting Started

The object of this tutorial is just to get a simple “Hello World” placed on the screen.

First extract the files of the Gameboy Development Kit to a suitable location. On my system, I have extracted this to the root of my C drive.

Next we are going to write some code in Visual Studio Code. I like to organise my projects in folders, so I created a folder called Gameboy Programming and opened this in Visual Studio.

I created a new .c file called HelloWorld.c

Writing the Code

The first two lines are include statements. The first is a call to a library within the Gameboy Development Kit and the second is a call to the standard Input/Output library in C.

We then create our main function – this is where the program will execute from.

We then call a C function which will print a string to the screen.

Creating the Make File

In order to compile the code we have just written we need to craft a Make file. This is nothing too scary and comprises of two lines.

Create a new file in your folder and all it Make.bat. Copy the following lines into it and save

In order to run this file, go to the Terminal section of Visual Studio Code and type .\make.bat. This will run the file and create the Gameboy file which we need to run on the emulator.

When we open our Emulator and run the file we should see:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s