Debian Codegraph @

port/ds/dsmain.cpp

raw
1 #ifdef main
2 #undef main
3 #endif
4 #define main gba_main
5
6 #include "../../main.cpp"
7
8 #undef main
9
10 #include <nds.h>
11
12 int main()
13 {
14 // Before we call our main and crash, we try a toy NDS example.
15
16 irqInit();
17 // irqSet(IRQ_VBLANK, Vblank);
18 // irqEnable(IRQ_VBLANK);
19 videoSetMode(0); //not using the main screen
20 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
21 vramSetBankC(VRAM_C_SUB_BG);
22 // vramSetBankA(VRAM_A_MAIN_BG);
23 vramSetBankA(VRAM_A_LCD);
24
25 SUB_BG0_CR = BG_MAP_BASE(31);
26
27 int i;
28 for (i = 0; i < 255; i++)
29 {
30 BG_PALETTE_SUB[i] = RGB15(0,0,0);
31 }
32
33 BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255
34
35 //consoleInit() is a lot more flexible but this gets you up and running quick
36 consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
37
38 // Push the cursor to the bottom so stuff seems to scroll out of
39 // the top of the play window.
40 for (int i = 0; i < 30; i++)
41 {
42 iprintf("\n");
43 }
44
45 iprintf(" POWDER\n");
46 iprintf(" www.zincland.com/powder\n");
47
48 #if 0
49 while(1) {
50 swiWaitForVBlank();
51 }
52
53 #endif
54
55 // We want the main window to be on the bottom as that is most useful
56 // for all stylus actions. It also ensures that text scrolls as expected.
57 lcdMainOnBottom();
58
59 // Call our main.
60 gba_main();
61
62 return 0;
63 }
64