Nintendo DS Programming

I was just learning some C++ syntax the other day and figured I should give Nintendo DS programming a go since I’ve got a flashcard and it’s always fun to see your result on an actual device instead of an emulator.

I started out with a guide on GBAtemp which, although pretty limited at the moment, gives you enough info to get some basics done. User input checking (both touchscreen and buttons) and displaying a simple message is always a fun way to get started with things. Here’s the code I wrote:

#include <nds.h>
#include <stdio.h>
u16 Pressed;
u16 Held;
u16 Released;
touchPosition TouchStructure;
int main(void) {
	iprintf("Hello World!\n\n");
		Pressed = keysDown();
		Held = keysHeld();
		Released = keysUp();
		int xPos = TouchStructure.px;
		int yPos =;
		if(xPos > 0 || yPos > 0)
			iprintf("Position of touch is (%d, %d)\n", xPos, yPos);
		if(KEY_A & Pressed)
			iprintf("You pressed the A button!\n");

This code snippet will display a classic Hello World along with some info whether you pushed the A button or tapped the touchscreen somewhere.

It’s not much but I’ve just got started with it, let’s see how far I get!