Wednesday, October 21, 2009

You're gonna die! Dieee() Hahahaaa }:-D

First step into a more complete development environment on the DS: a small die() function that will play the role of a top-level exception catching for both C++ and hardware exceptions. You'll learn more about it in future posts. Of course, it relies on a modification of arm9/gurumeditation.c in libnds:



static void defaultHandler() {
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);

SUB_BG0_CR = BG_MAP_BASE(31);

BG_PALETTE_SUB[0] = RGB15(31,0,0);
BG_PALETTE_SUB[255] = RGB15(31,31,31);

consoleInitDefault(...);

iprintf("\x1b[5CGuru Meditation Error!\n");

// ... here comes registers extraction, and stuff.

die("guru",0);
}

No comments: