Peter J. B. Lewis' Braindump

GameBoy

by Peter on Jul.25, 2005, under Programming, Unrelated

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 Comments for this entry

Leave a Reply

Journal Categories