
Writing a Game Boy Advance Game - ingve
https://www.reinterpretcast.com/writing-a-game-boy-advance-game
======
kruhft
I wrote 2 games for the Gameboy/Gameboy Advance back in the day (Hot Wheels
Stunt Track Driver and Matchbox Emergency Patrol) and it was an awesome
experience. There's nothing like being able to hold the entire machine in your
head and have every line of code executing being written by you.

If you're interested in development I suggest using the No Cash GB/GBA
emulator; it's spot on and only had one glitch that Nintendo found in testing
due to something about switching off the screen at the wrong time. I did
almost all of my professional development in it and only had to burn to a Bung
cartridge (used to be available from HK for cheap) for final testing
infrequently. Much cheaper and probably better than the official dev kits
available (but I wouldn't know, I never used one).

~~~
JoshM33k
Both games were very cool from my memory of them!

What led you to using No$, and not having an official dev kit? I have no idea
what the relationship would have been like with Nintendo...but did they wonder
how you'd written the game if they'd never issued an official dev kit?

~~~
kruhft
I used no$ because it was simply the best emulator available back then (circa
1999), plus the company didn't feel a need to actually buy a dev kit since I
was fully capable of building my own, and actually preferred to use, using
open source tools (assembler, linker, make, etc) and no$gba.

We were publishing through Mattel for those games as a 3rd party developer, so
they handled all the dealings with Nintendo and I assume they had an in house
dev kit or two, or at least it was just a 2 gorrila relationship.

------
corysama
I have long thought that the GBA would be an excellent teaching platform for
low-level programming if only Nintendo would allow it.

It has the feature that 100% of it's functionality is controlled through
memory-mapped structs. You can define the whole hardware API in a single c
header of struct/address pairs. To do anything, you write to those addresses
and stuff happens. No magic, black-box libraries required (I guess there is
the BIOS...)

It's also incredibly underpowered. You get a low number of clock cycles per
frame to do everything. The lack of power, lack of cache and simple
instruction set makes it an actually really good target for self-modifying
code.

And, not least of all: it's literally a device built for having fun!

~~~
patzerhacker
>if only Nintendo would allow it

You could easily teach a course on it. Have the students purchase a GBA flash
linker and GBA and then teach the course. The students can flash their GBA
games into the flash linkers, and you make the term project a completed game.

~~~
wingerlang
I went to a university where my direction was programming/game development. We
had a course in, I can't remember for sure, C perhaps, and it included making
a game for the GBA. It was some time ago but I remember it was quite
interesting.

------
fnordfnordfnord
I'd love to see more new games on old platforms like this. I even think people
would pay a small amount if someone could get with EmulationStation or
something like that and setup and install the emulators along with games. I
also really wish that getting rights to distribute abandonware were reasonably
possible.

I have a retropie set up for my son. Even though he's been exposed to all
sorts of fancy stuff you can get on an Android, as well as Don't Starve
Together, and Minecraft and a few other games on the Steam platform, he still
really loves playing some of the older console games; especially stuff from
the Megaman and Sonic franchises. I've also recently found Zelda for snes,
which I never played as a kid. If anyone has any other old games to recommend
for children on the SNES, NES, GBA, Genesis, etc. please reply.

~~~
andrepd
The SNES, for instance, is commonly held to be the 2D (J)RPG console par
excellence. Chrono Trigger, Secret of Mana, Earthbound, Super Mario RPG and
the Final Fantasy games should take 100s of hours of your time.

Still for the SNES, I recommend Yoshi's Island, one of the best 2D platformers
I've ever played. And of course, don't skip classics like The Legend of Zelda:
A Link to the Past and Super Metroid.

Sorry, I _love_ the SNES.

~~~
jeffcox
I would argue that Super Mario RPG is one of the best JRPGs (and games in
general) ever made.

~~~
andrepd
I personally like the Mario & Luigi series (spiritual sequels to Super Mario
RPG) even better.

------
Keyframe
He lists resources at the end. TONC is really invaluable:
[http://www.coranac.com/tonc/text/](http://www.coranac.com/tonc/text/)

It's an interesting thing to try out. Especially to see what memory pre-
allocation and limited resources can do to your way of modern thinking. It's
also a nice exercise in C. You can do it via emulator, but linkers are rather
cheap for GBA. There's something insanely satisfying seeing your crap run on
mystical hardware of ye old(er) days.

------
mrspeaker
In 2006 I was off work for 6 weeks recovering from an injury. Just before my
surgery I learned about the Atari 2600 homebrew scene - and was fascinated by
the tricks you had to do to get something game-looking on the screen (I mean,
the scanlines on the TV directly map to code cycles: so if you use too many
instructions while the beam is in the visible section of the television, the
whole game goes skewed!)

My recovery time was completely lost in following the AtariAge forums and
tutorials, and I ended up with this "game":
[https://github.com/mrspeaker/plops](https://github.com/mrspeaker/plops) \-
you can test it out by grabbing the .bin file and dropping in the online
emulator.

Not the most polished game ever, but was such a learning experience!

~~~
SirFatty
That's pretty cool, and I especially like the name!

------
coldpie
Doing homebrew programming on older game consoles is lots of fun. It's quite a
twist to start thinking of rendering in terms of the hardware's object APIs
instead of a simple framebuffer. Even "API" is a bit of stretch: you're really
just poking your data to the right spot in memory and the hardware takes care
of the rest. And if you've got the right hardware, you can even run your games
on the console itself!

------
yaspoon
Last year I got back into GBA dev except this time I had a degree in computer
science so I knew a bit more this time. It was fascinating to play around at
such a low level. Directly referencing registers and setting bytes of memory
to get them on the screen. I used a old gba link cable soldered to a parralel
port to send my demos to the GBA. It was a fun learning tool. I didn't make a
game though. Maybe one day :)

~~~
yaspoon
I also gave a talk at my uni to young kids learning to program about
homebrewing on the gba. Which they surprisingly found quite cool for a game
console they had never even heard of :3

------
JoshM33k
It would be interesting for the author to get a flashcart, load his rom on it,
and add some video of it playing on physical GBA hardware. Then you can really
find out if any quirks of the system would prevent it from running, or add any
slowdown.

~~~
mkarr
One of the easiest ways to get code running on the GBA is via the multiboot
protocol over the link port. This was the primary way I ran code on the GBA
circa 2003ish using a link cable spliced into a parallel port plug.

Unfortunately, parallel ports are exceedingly uncommon these days. However, it
looks like this can be done easyly enough using something like a Teensy [0] or
Arduino [1].

[0] [https://github.com/tangrs/usb-gba-
multiboot](https://github.com/tangrs/usb-gba-multiboot)

[1]
[http://web.archive.org/web/20100815071014/http://blog.evildr...](http://web.archive.org/web/20100815071014/http://blog.evildro.me.uk/?p=21)

~~~
JoshM33k
Oh, interesting! For those of you not versed in the intricacies of playground
GBA link cable gaming, this protocol was used to link multiple GBAs, where one
would have a cartridge and the others would not, and they would receive the
game over the link cable. These single-cart multiplayer experiences were
almost always very rudimentary, because as Torgo says, you're loading the
entire payload in memory.

------
Torgo
GBA is probably the last device made that acts like an old classic console
like the NES. It hardware-accelerates tiles and sprites, which are loaded from
memory-mapped locations that you set (typically) with structs made in C. You
can tweak x-y orientation through bitmaps, etc and scroll the tilemap around
the screen by setting the values in memory-mapped registers.

Since there's only a fixed number of sprites the hardware acceleration can
reference from memory to display on screen, it was really an eye-opener to
debug commercial games and see how they worked around these limitations. In
Wario Land, the Wario character onscreen had tons of animations, which would
seem to break this limitation. By debugging the game, I was able to find the
way they did it was by setting aside just a few sprite slots for Wario,
loading all his animations into a different segment of RAM, then DMA'ing the
frames into his sprite slot on a timer to do the animation.

Also, even though it's an LCD screen, the hardware simulated a CRT vertical
and horizontal blank. I guess this was because this is the paradigm that
console game-programmers were used to, as you'd do your game logic there
between animation frames.

~~~
TD-Linux
>Also, even though it's an LCD screen, the hardware simulated a CRT vertical
and horizontal blank.

It's not a simulation, the LCD is actually serially refreshed in the same scan
order as a CRT.

------
stuaxo
I'd recommend anyone that is interested look at
[http://gbadev.org](http://gbadev.org) too.

------
wkoszek
This is great. I think things such as this would be great for kids to get
started with programming.

------
Legogris
This was actually how I started out programming at the age of 11-12 (or, the
step up from QBASIC).

------
sanjaynegi89
wow

