GameBoy

I couldn’t sleep last night so I had a stab at some GameBoy Advance programming. I found some old C++ code that I’d written for it ages ago and I realised that it was probably the best code I’ve ever written. However, it was not optimised and despite working very well, it did not work very fast.

I started a new project and twiddled a few things, set up some #defines and typedefs, etc. I then started writing a memcpy() clone. Now I could write this in C in 2 or 3 lines, but I thought I’d have a go at it in inline assembly. I discovered a few things:

  • This site (GBA Dev.net) really helps. I recommend it.
  • GCC’s inline assembly format is disgusting. However, it forces you to provide all the information that the compiler needs to reduce the risk of crashing and for optimisation. But the drawback is that it’s really horrible to work with.
  • The ARM7 instruction set is more expansive than I once thought it was. It actually has operations like “mvr”, which means “move reverse”. This copies memory but also inverts the bits as it goes. Interesting.

To be honest, I did not get any sleep so anything I did find out yesterday wasn’t investigated in the depth that it should have been. I will try and make up for this later. I’m thinking of trying the DS instead, but if I did that I’d probably stick to C. Seeing the objective is to learn more about the ARM7 instruction set that’s an idea I dismissed quite quickly.

The current plan of action is to do a bit more investigating and try and make a little game out of it. Something cheap and nasty probably, like another Pong clone. Or maybe “Dangerous Dave in ‘Nintendo Nightmare’”.

2 Responses to “GameBoy”

  1. Luke Says:

    I like assembly. It’s a bit like PacMan. Takes like 10 minutes to learn, but your entire life to master.

  2. Peter Lewis Says:

    Aptly put, as always )

    Do you write in all Assembly and link with C, or do you do inline? If so, do you use GCC?

Leave a Reply

You must be logged in to post a comment.