Skip to the content.

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.

Aces Up โ˜ž

A solitaire card game.

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.