I don't know if anyone here is interested in using the Thumb instruction set... but I've packed my tinylife down to 412 bytes by converting most of it.
http://www.glost.eclipse.co.uk/gfoot/gp2x/thumblife.zip
The functionality is the same, and some of the optimizations would probably have applied to the ARM code too, but even before trying too hard, using the Thumb instruction set did tend to reduce code size quite a bit.
If you want to learn Thumb, there are quick reference cards on www.arm.com, but beware - the mnemonics they list are based on a later version of the architecture and assembler than what we seem to be using, so even the instructions which are supported by the GP2X are not listed correctly. The main difference is that all the 's' suffixes shouldn't be there. I found this documentation of the ARM assembler to be a better reference overall, as the GNU assembler understands the mnemonics used here:
http://www.arm.com/pdfs/DUI0068B_ADS1_2_Assembler.pdf
Switching to/from thumb mode is easy enough - see the macros at the top of thumblife.S. It costs a bit of space, though, so you don't want to do it much - I just used the toggling to convert tinylife a piece at a time.
The Thumb instruction set is odd after ARM - on the one hand, the bits of ARM assembler which seem clever (optionally setting flags, conditional execution, the barrel shifter, and updating base registers after/before indirect addressing) are no longer available, but on the other hand, because the instructions are half as wide, you can get pretty much the same thing done in the same space by just writing out the shifts in full. Even ARM code which I thought was making good use of these features ended up smaller when I converted it to Thumb.
Obviously, Thumb is useless if you care about speed rather than size, and that's probably most often the case. All these instructions split into two cost twice as much as the compound instructions ARM supports. Still, it's been fun to try it out - not sure if I'll ever need to use it again, but you never know!
tinylife.gp2xe: 512 bytes
tinylife.gp2xe.gz: 449 bytes
thumblife.gp2xe: 412 bytes <= better than gzip!
thumblife.gp2xe.gz: 377 bytes <= not including unpacking overhead
http://www.glost.eclipse.co.uk/gfoot/gp2x/thumblife.zip
The functionality is the same, and some of the optimizations would probably have applied to the ARM code too, but even before trying too hard, using the Thumb instruction set did tend to reduce code size quite a bit.
If you want to learn Thumb, there are quick reference cards on www.arm.com, but beware - the mnemonics they list are based on a later version of the architecture and assembler than what we seem to be using, so even the instructions which are supported by the GP2X are not listed correctly. The main difference is that all the 's' suffixes shouldn't be there. I found this documentation of the ARM assembler to be a better reference overall, as the GNU assembler understands the mnemonics used here:
http://www.arm.com/pdfs/DUI0068B_ADS1_2_Assembler.pdf
Switching to/from thumb mode is easy enough - see the macros at the top of thumblife.S. It costs a bit of space, though, so you don't want to do it much - I just used the toggling to convert tinylife a piece at a time.
The Thumb instruction set is odd after ARM - on the one hand, the bits of ARM assembler which seem clever (optionally setting flags, conditional execution, the barrel shifter, and updating base registers after/before indirect addressing) are no longer available, but on the other hand, because the instructions are half as wide, you can get pretty much the same thing done in the same space by just writing out the shifts in full. Even ARM code which I thought was making good use of these features ended up smaller when I converted it to Thumb.
Obviously, Thumb is useless if you care about speed rather than size, and that's probably most often the case. All these instructions split into two cost twice as much as the compound instructions ARM supports. Still, it's been fun to try it out - not sure if I'll ever need to use it again, but you never know!
tinylife.gp2xe: 512 bytes
tinylife.gp2xe.gz: 449 bytes
thumblife.gp2xe: 412 bytes <= better than gzip!
thumblife.gp2xe.gz: 377 bytes <= not including unpacking overhead