Examples

We included a few examples in the examples/ folder. To build the ROM files, run the following from your terminal:

make examples

10 Print

The gbforth version of the classic BASIC one-liner 10 PRINT CHR$(205.5+RND(1)); : GOTO 10. Produces a random maze-like pattern on the screen.

Brainfuck

A Brainfuck interpreter running a program that prints “Hello World!” to the screen.

Happy Birthday

Written for the Game Boy’s 30th anniversary. Uses the music lib to play Happy Birthday and prints the lyrics to the screen.

Hello World ASM

The result of decompiling an example ROM at the very start of this project. Uses plain assembly to print “Hello World !” to the screen.

Hello World

The most basic introduction to gbforth – essentially a Forth rewrite from the ASM version. Uses the term lib to print “Hello World !” to the screen.

Simon

A classic game where the player needs to memorise and repeat a growing sequence of notes. Read the step-by-step guide to learn how to implement this game yourself.

Sokoban

Bernd Paysan wrote this code in 1995 for gforth. We modified it slightly (but as little as possible) to make it run on the Game Boy. The changes are limited to adding ROM and RAM to control memory locations, moving some definitions into meta definitions (:m ... ;), and adding a little initialisation code to main. Most levels are commented out to make the game fit on a 32 KB cartridge, and the UI strings are shortened to fit the LCD display.