Close

programming Game Boy games on a Mac in 2016

A project log for Game Boy Cartridge plus Programmer

not the first cartridge on this platform

davedarkodavedarko 11/17/2016 at 00:214 Comments

First - get homebrew if you haven't.

http://brew.sh/

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install wget

Then follow this for installing gbdk, or do what's in the box.

https://github.com/dunn/homebrew-formulae

brew tap mistydemeo/formulae
brew install --HEAD mistydemeo/formulae/gbdk

Then start a new.c file with your text editor of choice

nano new.c 

and copy this example I borrowed from the credited site

// http://www.loirak.com/gameboy/gbprog.php

#include <gb/gb.h>
#include <stdio.h>

void main()
{
        printf("Welcome to GAMEBOY\nProgramming");
        printf("\nPress Start");
        waitpad(J_START);  // other keys are J_A, J_UP, J_SELECT, etc.
        printf("\nIsn't it easy!");
}

Run the compiler

lcc -o new.gb new.c

Lastly, get mGBA to emulate your "game" - example


and after you hit [ENTER]

Discussions

esot.eric wrote 11/17/2016 at 01:42 point

Oh man, that looks too easy. Can you then load new.gb directly into your cartridge's EEPROM and run this on your actual gameboy?

Gameboy-oscilloscope, here we come!

  Are you sure? yes | no

davedarko wrote 11/17/2016 at 01:57 point

It now looks easy ;) took me 5 hours of googling and cursing. I started on the PI zero because I thought it would be easier to run the gbdk on linux, but then I got to the homebrew thing (its THE place to go, obviously, but I didn't know that :D ) and then I just googled "gbdk + brew" and hallelujah! It came to a lot of "ignoring tutorials" because they were all written around the year 2000 for windows pcs...

new.gb would be the rom "image" - and the hardware goal is to do exactly that, yes :) I've always wanted to do that but never dared to, this website cured me from holding back!

  Are you sure? yes | no

esot.eric wrote 11/17/2016 at 02:15 point

Awesome that you wrote it up for us real lazy folk :)

  Are you sure? yes | no

esot.eric wrote 11/17/2016 at 02:19 point

ohhh, I didn't catch that. Homebrew is the general-purpose package-manager for MacOS, kinda like Macports... and gbdk must be Game-Boy Dev-Kit... I see that gdbk isn't in my linux package-manager... hmmm...

  Are you sure? yes | no