Programming Pi Games With Bare Metal Assembly

pifoxWhile the most common use for a Raspberry Pi is probably a media center PC or retro game emulator, the Pi was designed as an educational computer meant to be an easy-to-use system in the hands of millions of students. Team 28 at Imperial College London certainly living up to the Raspberry Pi Foundation’s expectations with their bare metal assembly clone of Star Fox, aptly titled PiFox.

This isn’t the first time a college course has taken up the task of developing software for the Pi without an operating system; a few years ago, Cambridge University started that off with a series of bare metal tutorials for the Pi that included drawing graphics on the screen and playing around with USB keyboards. PiFox greatly expands on what those early tutorials could do, reading an NES joystick from the GPIO pins, sound with DMA, and rendering 3D objects.

If you’d like to build PiFox for yourself, or better yet, expand on the existing build, all the code is up on Github. There’s also a Raspberry Pi emulator for Linux, just in case you have an ARM assembly bug you just can’t scratch with a Raspberry Pi.

22 thoughts on “Programming Pi Games With Bare Metal Assembly

  1. Damm, If I found out this was written while riding a bear into battle against an army of undead alligators I honestly wouldn’t be surprised. This has pegged my badass meter.

  2. Why of all things Assembly? Assembly is SLOOOW. Java is FAST! Java is faster than C/C++ ASM and more current, so the optimal solution for speed, would be to have it booting a java interpreter, running on a java interpreter, running on a java interpreter all written in java. More recursion == more speed!

    I’ll bet this takes like 3 weeks to boot, while the java version would boot in like 3us.

        1. This is a FINE EXAMPLE of WHY

          this site would be better with NO COMMENTS AT ALL, the bad ones and their responses eat up all the space, by the time you are done reading them you wish you had your life back

        2. As some one who has interest in computer programming but doesn’t know anything about computer langauge, I say, no that was not a joke. Well, sort of. You’ve made an exarggeration on the timeframe, but hadn’t not been for that, I would have no choice but to take into consideration on your words. You might as well go to pycon, put a sticker on your shirt that says “Hello, my name is: Guido van Rossum” and say “java is a shitty langauge, and I’m not joking” and then get circle-jerked-up by a crowd of nerds who gets it, while leaving me alone without any rationale or whatsoever in the dark. I would argue that all computer langauges have their own different purposes, but no, you would know that. Beyond that piece of boyscout fundamental, I have no idea what’s going on, and that’s something years of googling and reading the boring manual(RTBM) that I can’t do, all just to comphrehend how “shitty” java is.

          I’m sorry that anyone who wasted their time reads this whiney post, but I’m out of the computer-programming-master-race circlejerk. For now on, all of you are arguing about 1s and 0s. And if you like to make something so little into something complex, check out the church of the helix follix, you could get along with them.

  3. I find it interesting that they created their own rasterizer, using an interleaved image/depth framebuffer it seems. I wonder why they didn’t use the GPU, is it not possible to have some OpenGL API without some kind of binary blob perhaps ?

    1. some more info on this ‘postman’/’mailbox’ for communicating with the GPU would be nice! Besides sending framebuffers, does this interface support hardware acceleration too ?

    2. OpenGL is a layer that is present in your operating system. Drivers translate the common API into something that works with the vendor specific architecture. They would have to write a whole OpenGL implementation to use OpenGL – assuming you mean instead why don’t they just use the hardware acceleration capabilities of the chip, then they would have to track down the chip vendor’s documentation. I hear GPU vendors like to give that to just anybody.

      On the other hand, writting a rasterizer like that is something you can do as a weekend hack, and there is plenty of documentation to explain various different algorithms for rasterization.

      1. Except that Pi Foundation finally open-sourced their gfx chip.
        I don’t if it includes everything but I hope this kind of initiative “bare metal” coding will push the foundation further.

        Would be nice to revive the Amiga/Atari’s era.

  4. I’ve been debating getting a Pi since it came out, and this might finally push me off the fence… I’m not really an assembly programmer, but I like to learn a bit about the instruction set and architecture of systems I develop on, both as an aid to debugging, and for the odd inline asm function to speed things up.

    I wonder, though… Do the Team 28 folks know that they could have used a Super NES pad (or even a Virtual Boy pad, for that matter) using the same wiring by changing one integer constant in their code? I haven’t read the code, so maybe the support is already there, but they only had the older pad on-hand.

    I also wonder if “Team 28″ is a reference to the (also British) game studio “Team 17″, famous for the “Worms” game series.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s