Mercurial > repos > rhope
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ds_main.c Tue Apr 28 23:06:07 2009 +0000 @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------- + + $Id: main.c,v 1.5 2007/10/23 00:46:29 wntrmute Exp $ + + Simple console print demo + -- dovoto + +---------------------------------------------------------------------------------*/ +#include <nds.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include "saveload.h" +#include "structs.h" +#include "interp.h" + +//--------------------------------------------------------------------------------- +int main(void) { +//--------------------------------------------------------------------------------- + touchPosition touchXY; + program * prog; + + irqInit(); + + videoSetMode(0); //not using the main screen + videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text + vramSetBankC(VRAM_C_SUB_BG); + + SUB_BG0_CR = BG_MAP_BASE(31); + + BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255 + + //consoleInit() is a lot more flexible but this gets you up and running quick + consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); + + fatInitDefault(); + + prog = load_program("/program.vistxt"); + + interp_start(-1,TRUE, 0, NULL, prog); + + while(1) { + + touchXY=touchReadXY(); + iprintf("\x1b[10;0HTouch x = %04X, %04X\n", touchXY.x, touchXY.px); + iprintf("Touch y = %04X, %04X\n", touchXY.y, touchXY.py); + + swiWaitForVBlank(); + } + + return 0; +}