Beispiel #1
0
void Render::ChangeGUI(int index)
{
	switch (index)
	{
		case 1:
			dmaCopyHalfWords(DMA_CHANNEL,
                     gui_btn1Bitmap, 
                     (uint16 *)BG_BMP_RAM_SUB(9), 
                     gui_btn1BitmapLen);
			break;
		case 2:
			dmaCopyHalfWords(DMA_CHANNEL,
                     gui_btn2Bitmap, 
                     (uint16 *)BG_BMP_RAM_SUB(9), 
                     gui_btn2BitmapLen);
			break;
		case 3:
			dmaCopyHalfWords(DMA_CHANNEL,
                     gui_btn3Bitmap, 
                     (uint16 *)BG_BMP_RAM_SUB(9), 
                     gui_btn3BitmapLen);
			break;
		case 4:
			dmaCopyHalfWords(DMA_CHANNEL,
                     gui_btn4Bitmap, 
                     (uint16 *)BG_BMP_RAM_SUB(9), 
                     gui_btn4BitmapLen);
			break;
	}
}
Beispiel #2
0
void ApuPrepareStateAfterReload() {
/*    APU_MEM[APU_COUNTER0] &= 0xf;
    APU_MEM[APU_COUNTER1] &= 0xf;
    APU_MEM[APU_COUNTER2] &= 0xf;*/

	int i=0;
    for (i = 0; i < 4; i++) PORT_SNES_TO_SPC[i] = APU_MEM[0xF4 + i];

	// archeide
	APU2->TIM0 = 0;
	APU2->TIM1 = 0;
	APU2->TIM2 = 0;	

	apuShowRom = APU_MEM[APU_CONTROL_REG] >> 7;
    if (apuShowRom) {
		//for (int i=0; i<=0x3F; i++) APU_MEM[0xFFC0 + i] = iplRom[i];
		//ori: memcpy(APU_MEM+0xFFC0, iplRom, 0x40);
		dmaCopyHalfWords(2,(const void*)iplRom, (void *)(APU_MEM+0xFFC0), 0x20); //half
			
	} else {
		//for (int i=0; i<=0x3F; i++) APU_MEM[0xFFC0 + i] = APU_EXTRA_MEM[i];
		//memcpy(APU_MEM+0xFFC0, APU_EXTRA_MEM, 0x40);
		dmaCopyHalfWords(2,(const void*)APU_EXTRA_MEM, (void *)(APU_MEM+0xFFC0), 0x20); //half

	}
}
Beispiel #3
0
void ApuWriteControlByte(u8 byte) {
    u8 orig = APU_MEM[APU_CONTROL_REG];
    if ((orig & 0x1) == 0 && (byte & 0x1) != 0) {
        APU2->TIM0 = 0;
        APU_MEM[APU_COUNTER0] = 0;
	}
    if ((orig & 0x2) == 0 && (byte & 0x2) != 0) {
        APU2->TIM1 = 0;    	
        APU_MEM[APU_COUNTER1] = 0;
	}
    if ((orig & 0x4) == 0 && (byte & 0x4) != 0) {
        APU2->TIM2 = 0;    	
        APU_MEM[APU_COUNTER2] = 0;
	}

	if (byte & 0x10) {
		// Clear port 0 and 1
		APU_MEM[0xF4] = 0;
		APU_MEM[0xF5] = 0;
        PORT_SNES_TO_SPC[0] = 0;
        PORT_SNES_TO_SPC[1] = 0;
//        PORT_SPC_TO_SNES[0] = 0;
//        PORT_SPC_TO_SNES[1] = 0;
	}
	if (byte & 0x20) {
		// Clear port 0 and 1
		APU_MEM[0xF6] = 0;
		APU_MEM[0xF7] = 0;
        PORT_SNES_TO_SPC[2] = 0;
        PORT_SNES_TO_SPC[3] = 0;
//        PORT_SPC_TO_SNES[2] = 0;
//        PORT_SPC_TO_SNES[3] = 0;
	}

	if (byte & 0x80) {
		if (!apuShowRom) {
			apuShowRom = 1;
			//ori: memcpy(APU_MEM+0xFFC0, iplRom, 0x40);
			dmaCopyHalfWords(2,(const void*)iplRom, (u8*)(APU_MEM+0xFFC0), 0x20); //half
			
			//for (int i=0; i<=0x3F; i++) APU_MEM[0xFFC0 + i] = iplRom[i];
		}
	} else {
		if (apuShowRom) {
			apuShowRom = 0;
			//ori: memcpy(APU_MEM+0xFFC0, APU_EXTRA_MEM, 0x40);
			dmaCopyHalfWords(2,(const void*)APU_EXTRA_MEM, (void *)(APU_MEM+0xFFC0), 0x20); //half
			
			//for (int i=0; i<=0x3F; i++) APU_MEM[0xFFC0 + i] = APU_EXTRA_MEM[i];
		}
	}
}
Beispiel #4
0
void setupGraphics(void){
	// setup de vram
	vramSetBankE( VRAM_E_MAIN_BG );
	vramSetBankF( VRAM_F_MAIN_SPRITE ); 
	// generate the first blank tile by clearing it to zero
	int n;
	for( n = 0; n < 16; n++ )
		BG_GFX[n] = 0;
	
	//Cargar sprites
	dmaCopyHalfWords( 3, gfx_stage1Tiles, tile2bgram(1), gfx_stage1TilesLen );

	// Copiar paleta a la memoria
	dmaCopyHalfWords( 3, gfx_stage1Pal, pal2bgram(1), gfx_stage1PalLen );

	// set backdrop color
	BG_PALETTE[0] = backdrop_colour;

	// libnds prefixes the register names with REG_
	REG_BG0CNT = BG_MAP_BASE(1);

    for( n = 0; n < 1024; n++ )
        bg0map[n] = 0;
	
	int i, j;
	// cargamos desde j=4 ya que los tiles de antes contienen basura
	// por razones desconocidas
	for ( i = 0; i < 32; i++)
		for (j=4; j<29; j++)
			bg0map[ i + j*32 ] = (i+j*32+1) | 1 << 12;


	// Si reducimos este valor la imagen baja y aparecen pixeles de basura
	// que no deberían estar. Si se hace algún tipo de elevación vertical
	// habra que tener cuidado.
	REG_BG0VOFS = 40;
	
	//Cargar sprites
	dmaCopyHalfWords( 3, gfx_ballTiles, tile2objram(tiles_ball), gfx_ballTilesLen );

	// Copiar paleta a la memoria
	dmaCopyHalfWords( 3, gfx_ballPal, pal2objram(pal_ball), gfx_ballPalLen );

	// deshabilitar sprites
	for( n = 0; n < 128; n++ )
			sprites[n].attr0 = ATTR0_DISABLED;

	videoSetMode( MODE_0_2D | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D_LAYOUT );

}
Beispiel #5
0
void updateOAM(OAMTable * oam) {
    DC_FlushAll();
    dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
                     oam->oamBuffer,
                     OAM,
                     SPRITE_COUNT * sizeof(SpriteEntry));
}
Beispiel #6
0
void Render::DisplayBlankSub() {
    dmaCopyHalfWords(DMA_CHANNEL,
                   blankBitmap, /* This variable is generated for us by
                                       * grit. */
                     (uint16 *)BG_BMP_RAM_SUB(9), /* Our address for sub
                                               * background 3 */
                     blankBitmapLen);
}
Beispiel #7
0
void Render::DisplayTeamLogo() {
    dmaCopyHalfWords(DMA_CHANNEL,
                   teamLogoBitmap, /* This variable is generated for us by
                                       * grit. */
                     (uint16 *)BG_BMP_RAM(0), /* Our address for 
                                               * background 3 */
                     teamLogoBitmapLen);
}
Beispiel #8
0
void displaySplash() {
    dmaCopyHalfWords(DMA_CHANNEL,
                     splashBitmap, /* This variable is generated for us by
                                    * grit. */
                     (uint16 *)BG_BMP_RAM_SUB(0), /* Our address for sub
                                                   * background 3 */
                     splashBitmapLen); /* This length (in bytes) is generated
                                        * from grit. */
}
Beispiel #9
0
void displayPlanet() {
    dmaCopyHalfWords(DMA_CHANNEL,
                     planetBitmap, /* This variable is generated for us by
                                    * grit. */
                     (uint16 *)BG_BMP_RAM(8), /* Our address for main
                                               * background 2 */
                     planetBitmapLen); /* This length (in bytes) is generated
                                        * from grit. */
}
Beispiel #10
0
void displayStarField() {
    dmaCopyHalfWords(DMA_CHANNEL,
                     starFieldBitmap, /* This variable is generated for us by
                                       * grit. */
                     (uint16 *)BG_BMP_RAM(0), /* Our address for main
                                               * background 3 */
                     starFieldBitmapLen); /* This length (in bytes) is
                                           * generated from grit. */
}
Beispiel #11
0
void setupGraphics(void){
	// setup de vram
	vramSetBankE( VRAM_E_MAIN_BG );
	vramSetBankF( VRAM_F_MAIN_SPRITE ); 
	// generate the first blank tile by clearing it to zero
	int n;

	for( n=0; n<16; n++)
		BG_GFX[n] = 0;

	consoleDemoInit();
	
	//Cargar sprites
	dmaCopyHalfWords( 3, gfx_tilesetTiles, tile2bgram(bg0), gfx_tilesetTilesLen );

	// Copiar paleta a la memoria
	dmaCopyHalfWords( 3, gfx_tilesetPal, pal2bgram(pal_bg0), gfx_tilesetPalLen );

	// set backdrop color
	BG_PALETTE[0] = backdrop_colour;

	// libnds prefixes the register names with REG_
	REG_BG0CNT = 1 << 14 | 1 << 8; /** IMPORTANTE */

    	for( n = 0; n < 2048; n++ )
        	bg0map[n] = 0; /** IMPORTANTE */
	
	int i, j;
	// Suelo
	// Bloque 1: 	8  9
	//		10 11
	// Bloque 2:	12 13
	//		14 15
	for ( i = 0; i < 32; i++){
		for (j=25; j<29; j+=2)
			if ( (i+j-1)%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+8+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+12+i%2) | pal_bg0 << 12;
		for (j=26; j<29; j+=2)
			if ( (i+j-1)%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+10+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+14+i%2) | pal_bg0 << 12;

	}

	// Plataforma
	// 4 5
	// 6 7
	for ( i = 0; i < 32; i++){
		bg0map[ i + 23*32 ] = (bg0+4+i%2) | pal_bg0 << 12;
		bg0map[ i + 24*32 ] = (bg0+6+i%2) | pal_bg0 << 12;
	}

	// Rocas
	// Roca 1:	16 17
	// 		18 19
	// Roca 2:	20 21
	// 		22 23
	for ( i = 0; i < 8; i++){
		for (j=19; j<23; j+=2)
			if ( i%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+16+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+20+i%2) | pal_bg0 << 12;
		for (j=20; j<23; j+=2)
			if ( i%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+18+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+22+i%2) | pal_bg0 << 12;

	}

	for ( i = 0; i < 4; i++){
		for (j=15; j<19; j+=2)
			if ( i%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+16+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+20+i%2) | pal_bg0 << 12;
		for (j=16; j<19; j+=2)
			if ( i%4 < 2 )
				bg0map[ i + j*32 ] = (bg0+18+i%2) | pal_bg0 << 12;
			else
				bg0map[ i + j*32 ] = (bg0+22+i%2) | pal_bg0 << 12;

	}

	// Escaleras
	// 24 25
	for ( i = 0; i < 2; i++){
		for (j=0; j<15; j++)
			bg0map[ i + j*32 ] = (bg0+24+i%2) | pal_bg0 << 12;
	}

	for( n = 1024; n < 2048; n++ )
        	bg0map[n] = (bg0+24) | pal_bg0 << 12;	

	REG_BG0VOFS = 40;
	
	//Cargar sprites
	dmaCopyHalfWords( 3, gfx_ballTiles, tile2objram(tiles_ball), gfx_ballTilesLen );

	// Copiar paleta a la memoria
	dmaCopyHalfWords( 3, gfx_ballPal, pal2objram(pal_ball), gfx_ballPalLen );

	// deshabilitar sprites
	for( n = 0; n < 128; n++ )
			sprites[n].attr0 = ATTR0_DISABLED;

	videoSetMode( MODE_0_2D | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D_LAYOUT );

}
Beispiel #12
0
void createSprite(OamState * oam, SpriteInfo *spriteInfo, const void* spriteName_Pal, uint32 spriteName_Pal_Len,
          const void* spriteName_Tiles, uint32 spriteName_Tiles_Len,int OAM_ID, bool isMainScreen,int width, int height, int angle, int x, int y, int size)
{

	/* Create the sprite. */
    assert(OAM_ID < SPRITE_COUNT);
    spriteInfo = &spriteInfo[OAM_ID];
    SpriteEntry * spriteEntry = &oam->oamMemory[OAM_ID];
	
	/* Initialize spriteEntry */
    spriteInfo->oamId = OAM_ID;
    spriteInfo->width = width;
    spriteInfo->height = height;
    spriteInfo->angle = angle;
    spriteInfo->entry = spriteEntry;
	//spriteInfo->gfx = oamAllocateGfx(oam, SpriteSize_32x32, SpriteColorFormat_16Color);
	
	/*
     *  Configure attribute 0. 
     *
     *  OBJCOLOR_16 will make a 16-color sprite. We specify that we want an
     *  affine sprite (via isRotateScale) here because we would like to rotate
     *  the ship.
     */
    //spriteEntry->y = SCREEN_HEIGHT / 2 - spriteInfo->height;
	spriteEntry->y = y;
    spriteEntry->isRotateScale = true;
    /* This assert is a check to see a matrix is available to store the affine
     * transformation matrix for this sprite. Of course, you don't have to have
     * the matrix id match the affine id, but if you do make them match, this
     * assert can be helpful. */
    assert(!spriteEntry->isRotateScale || (spriteInfo->oamId < MATRIX_COUNT));
    spriteEntry->isSizeDouble = false;
    spriteEntry->blendMode = OBJMODE_NORMAL;
    spriteEntry->isMosaic = false;
    spriteEntry->colorMode = OBJCOLOR_16;
    spriteEntry->shape = OBJSHAPE_SQUARE;
	
    /*
     *  Configure attribute 1.
     *
     *  rsMatrixId refers to the loation of affine transformation matrix. We
     *  set it to a location computed with a macro. OBJSIZE_32, in our case
     *  since we are making a square sprite, creates a 32x32 sprite.
     */
    //spriteEntry->x = SCREEN_WIDTH / 2 - spriteInfo->width * 2 +
    //                spriteInfo->width / 2;
	spriteEntry->x = x;
    spriteEntry->rotationIndex = spriteInfo->oamId;
    
	if (size == 32)
		spriteEntry->size = OBJSIZE_32;
	if (size == 64)
		spriteEntry->size = OBJSIZE_64;

    /* 
     *  Configure attribute 2.
     * 
     *  Configure which tiles the sprite will use, which priority layer it will
     *  be placed onto, which palette the sprite should use, and whether or not
     *  to show the sprite.
     */
	if(isMainScreen) 
	{
		spriteEntry->gfxIndex = nextAvailableTileIdxMain;
		nextAvailableTileIdxMain += spriteName_Tiles_Len / BYTES_PER_16_COLOR_TILE;
	}
	if(!isMainScreen)
	{
		spriteEntry->gfxIndex = nextAvailableTileIdxSub;
		nextAvailableTileIdxSub += spriteName_Tiles_Len / BYTES_PER_16_COLOR_TILE;
	}
	
    spriteEntry->priority = OBJPRIORITY_1;
    spriteEntry->palette = spriteInfo->oamId;

    /* Rotate the sprite */
    RotateSprite(&oam->oamRotationMemory[spriteInfo->oamId],
                 spriteInfo->angle);


	if(isMainScreen == true)
	{
		/* Copy over the sprite palettes */
		dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
						 spriteName_Pal,
						 &SPRITE_PALETTE[spriteInfo->oamId *
										 COLORS_PER_PALETTE],
						 spriteName_Pal_Len);
						 
		/* Copy the sprite graphics to sprite graphics memory */
		dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
						 spriteName_Tiles,
						 &SPRITE_GFX[spriteEntry->gfxIndex * OFFSET_MULTIPLIER],
						 spriteName_Tiles_Len);
	}
	else
	{
		/* Copy over the sprite palettes */
		dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
						 spriteName_Pal,
						 &SPRITE_PALETTE_SUB[spriteInfo->oamId *
										 COLORS_PER_PALETTE],
						 spriteName_Pal_Len);
						 
	/* Copy the sprite graphics to sprite graphics memory */
		dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
						 spriteName_Tiles,
						 &SPRITE_GFX_SUB[spriteEntry->gfxIndex * OFFSET_MULTIPLIER_SUB],
						 spriteName_Tiles_Len);
	}
}
Beispiel #13
0
void Render::DisplayStory7()
{
	dmaCopyHalfWords(DMA_CHANNEL, story7Bitmap, (uint16 *)BG_BMP_RAM(0), story7BitmapLen);
}
Beispiel #14
0
void Render::DisplayLevelSeven()
{
	dmaCopyHalfWords(DMA_CHANNEL, level7Bitmap, (uint16 *)BG_BMP_RAM(0), level7BitmapLen);
}
Beispiel #15
0
void Render::DisplayHelpScreen()
{
	dmaCopyHalfWords(DMA_CHANNEL, helpscreenBitmap, (uint16 *)BG_BMP_RAM_SUB(9), helpscreenBitmapLen);
}
Beispiel #16
0
void initSprites(OAMTable * oam, SpriteInfo *spriteInfo) {
    /*  Define some sprite configuration specific constants.
     *
     *  We will use these to compute the proper index into memory for certain
     *  tiles or palettes.
     *
     *  OFFSET_MULTIPLIER is calculated based on the following formula from
     *  GBATEK (http://nocash.emubase.de/gbatek.htm#dsvideoobjs):
     *      TileVramAddress = TileNumber * BoundaryValue
     *  Since SPRITE_GFX is a uint16*, the compiler will increment the address
     *  it points to by 2 for each change in 1 of the array index into
     *  SPRITE_GFX. (The compiler does pointer arithmetic.)
     */
    static const int BYTES_PER_16_COLOR_TILE = 32;
    static const int COLORS_PER_PALETTE = 16;
    static const int BOUNDARY_VALUE = 32; /* This is the default boundary value
                                           * (can be set in REG_DISPCNT) */
    static const int OFFSET_MULTIPLIER = BOUNDARY_VALUE /
                                         sizeof(SPRITE_GFX[0]);

    /* Keep track of the available tiles. */
    int nextAvailableTileIdx = 0;

    /* Create the ship sprite. */
    static const int SHUTTLE_OAM_ID = 0;
    assert(SHUTTLE_OAM_ID < SPRITE_COUNT);
    SpriteInfo * shuttleInfo = &spriteInfo[SHUTTLE_OAM_ID];
    SpriteEntry * shuttle = &oam->oamBuffer[SHUTTLE_OAM_ID];

    /* Initialize shuttleInfo */
    shuttleInfo->oamId = SHUTTLE_OAM_ID;
    shuttleInfo->width = 64;
    shuttleInfo->height = 64;
    shuttleInfo->angle = 3186;
    shuttleInfo->entry = shuttle;

    /*
     *  Configure attribute 0.
     *
     *  OBJCOLOR_16 will make a 16-color sprite. We specify that we want an
     *  affine sprite (via isRotateScale) here because we would like to rotate
     *  the ship.
     */
    shuttle->y = SCREEN_HEIGHT / 2 - shuttleInfo->height;
    shuttle->isRotateScale = true;
    /* This assert is a check to see a matrix is available to store the affine
     * transformation matrix for this sprite. Of course, you don't have to have
     * the matrix id match the affine id, but if you do make them match, this
     * assert can be helpful.
     */
    assert(!shuttle->isRotateScale || (shuttleInfo->oamId < MATRIX_COUNT));
    shuttle->isSizeDouble = false;
    shuttle->blendMode = OBJMODE_NORMAL;
    shuttle->isMosaic = false;
    shuttle->colorMode = OBJCOLOR_16;
    shuttle->shape = OBJSHAPE_SQUARE;

    /*
     *  Configure attribute 1.
     *
     *  rotationIndex refers to the loation of affine transformation matrix. We
     *  set it to a location computed with a macro. OBJSIZE_64, in our case
     *  since we are making a square sprite, creates a 64x64 sprite.
     */
    shuttle->x = SCREEN_WIDTH / 2 - shuttleInfo->width * 2 +
                    shuttleInfo->width / 2;
    shuttle->rotationIndex = shuttleInfo->oamId;
    shuttle->size = OBJSIZE_64;

    /*
     *  Configure attribute 2.
     *
     *  Configure which tiles the sprite will use, which priority layer it will
     *  be placed onto, which palette the sprite should use, and whether or not
     *  to show the sprite.
     */
    shuttle->gfxIndex = nextAvailableTileIdx;
    nextAvailableTileIdx += orangeShuttleTilesLen / BYTES_PER_16_COLOR_TILE;
    shuttle->priority = OBJPRIORITY_0;
    shuttle->palette = shuttleInfo->oamId;

    /* Rotate the sprite */
    rotateSprite(&oam->matrixBuffer[shuttleInfo->oamId],
                 shuttleInfo->angle);

    /*************************************************************************/

    /* Create the moon sprite. */
    static const int MOON_OAM_ID = 1;
    assert(MOON_OAM_ID < SPRITE_COUNT);
    SpriteInfo * moonInfo = &spriteInfo[MOON_OAM_ID];
    SpriteEntry * moon = &oam->oamBuffer[MOON_OAM_ID];

    /* Initialize moonInfo */
    moonInfo->oamId = MOON_OAM_ID;
    moonInfo->width = 32;
    moonInfo->height = 32;
    moonInfo->angle = 0;
    moonInfo->entry = moon;

    /*
     *  Configure attribute 0.
     *
     *  OBJCOLOR_16 will make a 16-color sprite. We won't specify that we want
     *  an affine sprite here because we don't want one this time.
     */
    moon->y = SCREEN_WIDTH / 2 + moonInfo->height / 2;
    moon->isRotateScale = false;
    /* This assert is a check to see a matrix is available to store the affine
     * transformation matrix for this sprite. Of course, you don't have to have
     * the matrix id match the affine id, but if you do make them match, this
     * assert can be helpful. */
    assert(!moon->isRotateScale || (moonInfo->oamId < MATRIX_COUNT));
    moon->isHidden = false;
    moon->blendMode = OBJMODE_NORMAL;
    moon->isMosaic = false;
    moon->colorMode = OBJCOLOR_16;
    moon->shape = OBJSHAPE_SQUARE;

    /*
     *  Configure attribute 1.
     *
     *  OBJSIZE_32 will create a sprite of size 32x32, since we are making a
     *  square sprite. Since we are using a non-affine sprite, attribute 1
     *  doesn't have an rotationIndex anymore. Instead, it has the ability to
     *  flip the sprite vertically or horizontally.
     */
    moon->x = SCREEN_WIDTH / 2 + moonInfo->width + moonInfo->width / 2;
    moon->hFlip = false;
    moon->vFlip = false;
    moon->size = OBJSIZE_32;

    /*
     *  Configure attribute 2.
     *
     *  Configure which tiles the sprite will use, which priority layer it will
     *  be placed onto, which palette the sprite should use, and whether or not
     *  to show the sprite.
     */
    moon->gfxIndex = nextAvailableTileIdx;
    nextAvailableTileIdx += moonTilesLen / BYTES_PER_16_COLOR_TILE;
    moon->priority = OBJPRIORITY_2;
    moon->palette = moonInfo->oamId;

    /*************************************************************************/

    /* Copy over the sprite palettes */
    dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
                     orangeShuttlePal,
                     &SPRITE_PALETTE[shuttleInfo->oamId *
                                     COLORS_PER_PALETTE],
                     orangeShuttlePalLen);
    dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
                     moonPal,
                     &SPRITE_PALETTE[moonInfo->oamId * COLORS_PER_PALETTE],
                     moonPalLen);

    /* Copy the sprite graphics to sprite graphics memory */
    dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
                     orangeShuttleTiles,
                     &SPRITE_GFX[shuttle->gfxIndex * OFFSET_MULTIPLIER],
                     orangeShuttleTilesLen);
    dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
                     moonTiles,
                     &SPRITE_GFX[moon->gfxIndex * OFFSET_MULTIPLIER],
                     moonTilesLen);
}