Skip to content

Instantly share code, notes, and snippets.

@keztricks
Last active March 27, 2024 19:50
Show Gist options
  • Save keztricks/863349fd597f8e43f42976a1ca19e263 to your computer and use it in GitHub Desktop.
Save keztricks/863349fd597f8e43f42976a1ca19e263 to your computer and use it in GitHub Desktop.
Developing in gbdc on Mac

I've been following GamingMonsters's gbdk Gameboy Dev tutorial (it's rad! https://www.youtube.com/playlist?list=PLeEj4c2zF7PaFv5MPYhNAkBGrkx4iPGJo).

Was doing this for my own reference, but thought I may as well flesh out & share I'm on MacOS, so have put together anywhere I've had to do something different, I'm up to Session 10, so will update if anything further comes along as we progress.

Quick heads up, before you run anything here make sure you know what it's doing, this all worked fine and dandy for me, but I'm not making any promises!

"Hello World" - Part 1

Installing gdbk

Only Windows & Linux versions are available at Sourceforge.

A Mac version is available on github, however I had real trouble getting it to compile, fortunately, a pre-compiled version is available.

  1. Download gdbk-mac here Source: https://www.gbdkjs.com/docs/installation/.
  2. Unzip, and stick it wherever you like (I recommend /opt/gbdk/).
  3. Tell the OS where you've installed gbdk, open a terminal and run export GBDKDIR=/path/to/gbdk/ swapping out /path/to/gbdk/ with the wherever you've chosen to put gbdk.

BAT file

The make.bat file is Windows specific, instead we have the lovely makefile.

  1. Instead of make.bat create makefile
  2. Inside your makefile you'll want:
all:
  /path/to/gbdk/bin/lcc -Wa-l -Wl-m -Wl-j -c -o main.o main.c
  /path/to/gbdk/bin/lcc -Wa-l -Wl-m -Wl-j -o main.gb main.o

Be sure to swap out /path/to/gbdk/ with wherever you've put gbdk
3. When you want to compile your code, in terminal run make, be sure you're in the same directory as the makefile.

Note we've removed -DUSE_SFR_FOR_REG from our commands, I'm unsure what this does (let me know if you know!), we're possibly using a different version of gbdk that is used in the tutorial, and this was preventing compiling code.

Emulator (BGB Alternative)

BGB is not available for Mac, Sameboy is, and shares many of BGB's nice dev tools.

https://sameboy.github.io/downloads/

"Sprites" - Part 2

Gameboy Tile Designer

Unfortunately Gameboy Tile Designer is Windows only, and I had trouble finding an alternative. Fortunately it runs brilliantly in Wine.

To get running in Wine:

  1. Install Homebrew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Use Homebrew to install xquartz: brew cask install xquartz
  3. Use Homebrew to install Wine: brew install wine
  4. Download Gameboy Tile Designer
  5. In terminal, launch Gameboy Tile Designer wine /path/to/GBTD/GBTD.exe, make sure to swap out that path for wherever you have downloaded to.

(Source)[https://www.davidbaumgold.com/tutorials/wine-mac/]

"Backgrounds" - Part 4

Gameboy Map Builder

This is exactly the same as getting the Tile Designer running in part 2, so take a look there!

@Challenger-Games
Copy link

brew install wine says it cant find it!

@ccano2011
Copy link

I'm hoping this gets an answer, but I'm having a heck of a time trying to just compile a rom. I followed everything to a tee but getting an ASXXXX error every time I run make. Any suggestions are appreciated
Screen Shot 2021-03-12 at 12 56 31 AM

@mcguire-jack-ece
Copy link

I'm hoping this gets an answer, but I'm having a heck of a time trying to just compile a rom. I followed everything to a tee but getting an ASXXXX error every time I run make. Any suggestions are appreciated
Screen Shot 2021-03-12 at 12 56 31 AM

It's strange that the error points to that .lst file. I'm not sure what that is, though I see you have it open, but know that mine compiles fine without that. I would recommend starting off with keztrick's makefile,

all:
  /path/to/gbdk/bin/lcc -Wa-l -Wl-m -Wl-j -c -o main.o main.c
  /path/to/gbdk/bin/lcc -Wa-l -Wl-m -Wl-j -o main.gb main.o

before getting fancy with jesi-rgb's.

Also, for anyone who hasn't figured this out yet, Wine is no longer operable on macOS since 10.15 stopped supporting 32-bit binaries altogether. I suggest using PlayOnMac instead. I got the Windows programs working in no time: https://www.playonmac.com/en/

@freitzzz
Copy link

Some remarks (September 2021)

If you are running macOS Catalina and above, do not install the official binaries of wine! They do not run function properly as Apple dropped support for 32 bit software starting on Catalina.
Instead use homebrew-wine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment