You are not logged in.

Read the FAQ and Knowledge Base before posting.
WiFi not emulated and not supported!!
We won't make a 3DS/2DS emulator.



#1 2010-10-06 20:42:06

defusix
Member
Registered: 2010-10-06
Posts: 2

My homebrew program not working since desmume version 9.6

Hi!
I have a simple test program that shows a tiled "text" background. It worked as expected in Desmume 9.5, but since 9.6 it just shows a black screen on the screen where the graphics should be.
I use libnds and DevkitArm and normal C code.
When I run my program in the NO$GBA emulator, it behaves like desmume 9.6. So I assume I'm doing something wrong, but since it worked with 9.5 I'm curious whether somebody here knows what I'm doing wrong.

#include "nds.h"

int main(){
    //setting the control registers
    REG_DISPCNT = MODE_0_2D | DISPLAY_BG0_ACTIVE;
    VRAM_A_CR = VRAM_ENABLE | VRAM_A_MAIN_BG_0x06000000;
    REG_BG0CNT = BG_32x32 | BG_COLOR_256 | BG_PRIORITY_0 | BG_TILE_BASE(2) | BG_MAP_BASE(0);

    //setting the palette    
    BG_PALETTE[0] = RGB15(0,0,0);
    BG_PALETTE[1] = RGB15(31,0,0);
    BG_PALETTE[2] = RGB15(0,31,0);

    //setting the tiles
    u8* tiles_p = (u8*)BG_TILE_RAM(2);
    *(tiles_p + 64*0 + 0 + 8*0) = 1; //change pixel 0,0 from tile 0 to color 1(red)
    *(tiles_p + 64*1 + 2 + 8*3) = 2; //change pixel 2,3 from tile 1 to color 2(green)

    //setting the map
    u16* map_p = BG_MAP_RAM(0);
    map_p[1] = 1; //the second tile on the screen is a little different
    map_p[2] = 1; //the third tile on the screen is a little different

    for(;;){} //an endless loop
}

Last edited by defusix (2010-10-06 20:43:31)

Offline

#2 2010-10-06 21:49:37

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 4,663

Re: My homebrew program not working since desmume version 9.6

you can't write bytes into vram. desmume 0.9.5 emulated that incorrectly by letting you do it. write u16 instead of u8

Offline

#3 2010-10-06 23:41:15

defusix
Member
Registered: 2010-10-06
Posts: 2

Re: My homebrew program not working since desmume version 9.6

It works perfectly now.
Thanks zeromus !!!

Offline

Board footer

Powered by FluxBB