PiFox: bare-metal ARM assembly language Star Fox

Here’s something rather special, which should resonate with those of you over a certain age.


Star Fox was a Nintendo game for the SNES, released back in 1993 with fast, 3D gameplay – the player travels at high speed along a bounded path, avoiding and shooting obstacles and enemies, while picking up power-ups. Those obstacles were filled 3D polygons, which was very unusual at the time (and hard to render).

At the start of the week, I was sent this video. It’s from a group of first-year undergraduates (first-year undergraduates!) at Imperial College in London, who wrote a version of Star Fox from scratch for the Pi, in 5900 lines of ARM assembly language. This is so good that when Lance saw it, his immediate reaction was that it must be a port. It’s not.

They’ve got everything you need in under 6000 lines: a rasteriser in software, 2d elements and 3d objects, DMA sound, a utility and maths library, and input from a NES controller.

You’ll find all the source code on GitHub – along with useful stuff like a pinout for the NES controller.

If Team PiFox are interested in taking things a little further (or if someone else fancies forking their repo), we’d encourage them in the direction of using the Pi’s GPU as a hardware rasteriser, which would allow for an HD remix. If you need pointers, it’s still early days for Eric Anholt’s full Mesa/Gallium graphics stack on the Pi, but he’s adding to it all the time and there’s already a lot of meat in there. The VideoCore IV graphics documentation that Broadcom released back in February makes it possible to use the GPU as a “dumb” 2d polygon rasteriser as in Scott Mansell’s example.

If you make the attempt, please let us know; we’d love to see what you come up with.