comparison ds_main.c @ 0:76568becd6d6

Rhope Alpha 2a source import
author Mike Pavone <pavone@retrodev.com>
date Tue, 28 Apr 2009 23:06:07 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:76568becd6d6
1 /*---------------------------------------------------------------------------------
2
3 $Id: main.c,v 1.5 2007/10/23 00:46:29 wntrmute Exp $
4
5 Simple console print demo
6 -- dovoto
7
8 ---------------------------------------------------------------------------------*/
9 #include <nds.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include "saveload.h"
14 #include "structs.h"
15 #include "interp.h"
16
17 //---------------------------------------------------------------------------------
18 int main(void) {
19 //---------------------------------------------------------------------------------
20 touchPosition touchXY;
21 program * prog;
22
23 irqInit();
24
25 videoSetMode(0); //not using the main screen
26 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
27 vramSetBankC(VRAM_C_SUB_BG);
28
29 SUB_BG0_CR = BG_MAP_BASE(31);
30
31 BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255
32
33 //consoleInit() is a lot more flexible but this gets you up and running quick
34 consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
35
36 fatInitDefault();
37
38 prog = load_program("/program.vistxt");
39
40 interp_start(-1,TRUE, 0, NULL, prog);
41
42 while(1) {
43
44 touchXY=touchReadXY();
45 iprintf("\x1b[10;0HTouch x = %04X, %04X\n", touchXY.x, touchXY.px);
46 iprintf("Touch y = %04X, %04X\n", touchXY.y, touchXY.py);
47
48 swiWaitForVBlank();
49 }
50
51 return 0;
52 }