Writing “Hello World” for a Nintendo Game Boy!

I am a huge retro-gaming geek, I love reliving my childhood and playing classics such as Super Mario Land and Donkey Kong. The Nintendo Game Boy was (and still is!) one of my favourite systems. I’ve always stayed clear of doing any development on retro-gaming systems from the 80s/90s though as this typically involves writing code in assembly language and the learning curve for a non-dev like me is far too high 🧠.

I recently discovered the Game Boy Development Kit (GBDK) on GitHub, which allows you to write software for the Nintendo Game Boy (and a few other systems too!) in C.

I’m certainly no expert in C, however I was fairly sure that I could knock up “Hello World” without too much of an issue.

I downloaded the GBDK and extracted this to a folder (no install is required), I then set about writing this masterpiece –

#include <stdio.h>

void main()
{
int counter = 1;

while (counter <=16)
    {
    printf("\nHello World!");
    counter++;
    }
}

This is similar to the BASIC – 10 Print “Hello World”, 20 GOTO 10 that fills the screen with “Hello World” that I first wrote on my Amstrad CPC 6128 back in 1990 πŸ˜€.

Once I’d saved the file (naming this “helloworld.c“), I then compiled the code using the following command. This creates a ROM for the Game Boy named helloworld.gb

./gbdk\bin\lcc.exe -o helloworld.gb helloworld.c
Once the code had compiled, which literally took a second ⏱️. I then headed over to https://virtualconsoles.com/online-emulators/gameboy/ which is an online emulator for the Game Boy and loaded up my newly created ROM.

Voila!

12-year-old me would have been amazed!

Comments

2 responses to “Writing “Hello World” for a Nintendo Game Boy!”

  1. Continuous Integration for Nintendo Game Boy development using GitHub Actions – Brendan's Tech Ramblings Avatar

    […] previously posted about writing Hello World for the Nintendo Game Boy using the […]

    Like

  2. Brendan's Tech Ramblings Avatar

    […] previously spoken about my love of retro gaming, in particular the Nintendo Gameboy. For a long time, I’ve […]

    Like

Leave a reply to Brendan's Tech Ramblings Cancel reply