#174351 - gusano - Wed Jun 02, 2010 6:10 pm
Hi,
I searched this forum and found that you can draw a 2D image from vram banks H & I. Those banks add up to 48k, enough to cover 256x192. I tried the following code and it worked on both the emulator and the DS hardware:
But I tried to add the code to an existing project and it didn't work on the DS hardware (it DID work on the emulator). My existing project has the line:
// Turn on all 2D hardware on the DS
REG_POWERCNT = (unsigned char)POWER_ALL;
This causes the previous code to fail... any ideas why? AFAIK, I need to power everything because I'm trying to render 3D on the main screen, and also this image on the subscreen.
EDIT: I've tried several combinations of the POWER options and still it fails on the DS hardware. I'm not sure what could be the problem.
I searched this forum and found that you can draw a 2D image from vram banks H & I. Those banks add up to 48k, enough to cover 256x192. I tried the following code and it worked on both the emulator and the DS hardware:
Code: |
// Include DS hardware access class #include <nds.h> #include "logo.h" //--------------------------------------------------------------------------------- int main(void) { //--------------------------------------------------------------------------------- videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE ); vramSetBankH(VRAM_H_SUB_BG); // 32k bank vramSetBankI(VRAM_I_SUB_BG_0x06208000); // 16k bank int bg3 = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0,0); dmaCopy(logoBitmap, bgGetGfxPtr(bg3), 256*192); dmaCopy(logoPal, BG_PALETTE_SUB, 256*2); // Game loop while(1) { swiWaitForVBlank(); } return 0; } |
But I tried to add the code to an existing project and it didn't work on the DS hardware (it DID work on the emulator). My existing project has the line:
// Turn on all 2D hardware on the DS
REG_POWERCNT = (unsigned char)POWER_ALL;
This causes the previous code to fail... any ideas why? AFAIK, I need to power everything because I'm trying to render 3D on the main screen, and also this image on the subscreen.
EDIT: I've tried several combinations of the POWER options and still it fails on the DS hardware. I'm not sure what could be the problem.