#101202 - racarate - Sun Sep 03, 2006 8:55 pm
Hi,
I am wondering how to display sprites in the least amount of lines possible. This is what I have so far:
#define OVRAM_1 (unsigned short*)0x06010000
#define SPRITEPALRAM (unsigned short*)0x05000200
#define REG_DISPCNT (unsigned short*)0x04000000
int main( void )
{
//tile data
memcpy( (void*)OVRAM_1, (void*)cykillSpriteTiles, cykillSpriteTilesLen );
//tile palette
memcpy( (void*)SPRITEPALRAM, (void*)cykillSpritePal, cykillSpritePalLen );
//turn on sprite layer, flip bit C
*REG_DISPCNT = 0x1000;
while( 1 );
return 0;
}//int main( void )
I think this should work since the BIOS clears all RAM to zeros.
My assumptions are:
DISPCNT starts at all zeros, meaning the graphics mode is mode zero.
OAM is full of zeros, meaning it points to the beginning of the sprite data area. It also holds the coordinates at (0,0) putting my sprite in the top left of the screen. Finally, it believes the size to be (8x8).
Are there any assumptions I am missing here? I am trying to see the minimum amount of work required to display a sprite.
Thanks,
Nick
_________________
Neko: I love meow-tain climbing!
Need anything? I'll even save your game!
I am wondering how to display sprites in the least amount of lines possible. This is what I have so far:
#define OVRAM_1 (unsigned short*)0x06010000
#define SPRITEPALRAM (unsigned short*)0x05000200
#define REG_DISPCNT (unsigned short*)0x04000000
int main( void )
{
//tile data
memcpy( (void*)OVRAM_1, (void*)cykillSpriteTiles, cykillSpriteTilesLen );
//tile palette
memcpy( (void*)SPRITEPALRAM, (void*)cykillSpritePal, cykillSpritePalLen );
//turn on sprite layer, flip bit C
*REG_DISPCNT = 0x1000;
while( 1 );
return 0;
}//int main( void )
I think this should work since the BIOS clears all RAM to zeros.
My assumptions are:
DISPCNT starts at all zeros, meaning the graphics mode is mode zero.
OAM is full of zeros, meaning it points to the beginning of the sprite data area. It also holds the coordinates at (0,0) putting my sprite in the top left of the screen. Finally, it believes the size to be (8x8).
Are there any assumptions I am missing here? I am trying to see the minimum amount of work required to display a sprite.
Thanks,
Nick
_________________
Neko: I love meow-tain climbing!
Need anything? I'll even save your game!