Mercurial > repos > rhope
view ds_main.c @ 121:1af91ceaaf49
Fixed memory leak when an output is only attached to a single null input
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 Oct 2010 21:04:12 -0400 |
parents | 76568becd6d6 |
children |
line wrap: on
line source
/*--------------------------------------------------------------------------------- $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; }