- Demonstrate some sprites and how to move them around
- Demonstrate tile backgrounds
- Display text in the lower DS pane
- Enable state to be saved
I’ve now achieved that goal. It’s taken a while as I found it hard to find good tutorials on writing DS code on the internet. There are many partial tutorials and lots of full blown games, but very little in between. The attached example consists of bits of code taken from the devKitPro examples and elsewhere. We display three rotating squares with the middle square (in the initial position and z-order) under the control of the direction keys. A counter value is displayed in the lower window. Pressing "A" saves the counter to the (R4) memory card and pressing "B" restores the saved value.
The code works on top of the devKitPro development environment that can be downloaded here. To build it, take the code from here, unzip it and in the msys window type make. This will produce the files CTPlay2.nds (the game) and ctplay.txt (the file storing the state) which need to be transferred onto an R4 card’s micro SD card which is the only thing I have tried it on for real. During development I tested on the DeSmuMe simulator, though the saving doesn’t work on the version of the simulator that I have, though it does work on the full DS.
Total cost to play with this kind of thing is just 25 UK pounds for the R4 chip and some micro SD cards. Now I just need to improve my C programming skills and get a clone version of PacMan written.