GB ASM Programming

Welcome to Game Boy Assembly programming! These pages contain a tutorial on how to program for the Game Boy, and information about the Game Boy's inner workings.
The goal is to be helpful to both newcomers that want to make a Game Boy game, and provide more detailed info to already experienced GB programmers. You may also enjoy this peek at the console's inner workings if you're just an enthusiast, too!

To get started, click here to begin with the introduction!


GBDK users

If you're a GBDK user, let it be known that I'm not a fan of GBDK. But, before you leave thinking I'm just a purist that hates C, that's not the grudge I have against GBDK. C is useful because it abstracts a lot of implementation tidbits that ASM requires, and I use C a lot on my computer. Further, developing ASM is slower, be it just because you have to type more; so, ASM isn't really suited for game jams, for example.

The problem with GBDK is that it's extremely inefficient due to an awful C compiler, and a thoroughly unoptimized stdlib. But even worse is that it attempts to abstract the way the hardware works, but ultimately fails at doing so. It's basically impossible to abstract such a small, constrained device. I have seen a lot of people who were having problems that they couldn't comprehend, but that were obvious (some of them almost trivial) to me because I knew what the hardware was doing.

Besides, another big bummer (but this one is related to C on the Game Boy more than GBDK) is, there are no C debuggers for the Game Boy. All there is is BGB, which provides ASM debugging. (I don't think there's going to be a C debugger for the GB, either, because it would be way too complex). Thus, I recommend at least having enough ASM knowledge - even if you don't end up programming in ASM! - to be able to use BGB to debug your C programs.

Finally, I'd like to address the fear that some people have about ASM. Over at the GBDev Discord server, I asked someone what was their opinion on ASM. He has started with a project in GBDK (a graphing calculator), and at that time, was very reluctant about ASM. At the time I'm typing these lines, he's now programming his own game in ASM. Here's what he replied to my enquiry:

My opinion was that it's too complicated, takes too long to get anything to work etc. But now I actually quite enjoy working in ASM, and I feel like I'm learning a lot (screenshot)

By the way, I have also made a write-up about the benefits and drawbacks of using either C or ASM on the Game Boy, if you're interested in a comparison.

Contributing

This website is published on GitHub Pages, which means that anyone can contribute to it. The source repo is here, so any HTML-savvy people can send me a pull request. If you have a request, want to point out a mistake, but can't do any HTML, can simply open an issue, for which I usually recieve a notification e-mail.