// Initialize SNES
consoleInit();
// Copy tiles to VRAM
bgInitTileSet(0, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
bgInitTileSet(1, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette), BG_4COLORS, 0x1000);
// Copy Map to VRAM
bgInitMapSet(0, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
bgInitMapSet(1, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
// Now Put in 16 color mode and put cloud on top of screen
setMode(BG_MODE1, BG3_MODE1_PRORITY_HIGH); bgSetDisable(2);
// Set BG3 SubScreen and
bgSetEnableSub(1);
// enable Subscreen Color ADD/SUB and Color addition on BG1 and Backdrop color
setColorEffect(CM_SUBBGOBJ_ENABLE, CM_MSCR_BACK | CM_MSCR_BG1);
// Initialize SNES
consoleInit();
// Copy tiles to VRAM
bgInitTileSet(0, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
bgInitTileSet(1, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette), BG_4COLORS, 0x1000);
// Copy Map to VRAM
bgInitMapSet(0, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
bgInitMapSet(1, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
// Now Put in 16 color mode and put cloud on top of screen
setMode(BG_MODE1, BG3_MODE1_PRORITY_HIGH); bgSetDisable(2);
// Set BG3 SubScreen and
//bgSetEnableSub(1);
// enable Subscreen Color ADD/SUB and Color addition on BG1 and Backdrop color
//setColorEffect(CM_SUBBGOBJ_ENABLE, CM_MSCR_BACK | CM_MSCR_BG1);
..
bgInitTileSet(1, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
bgInitTileSet(0, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette), BG_4COLORS, 0x1000);
// Copy Map to VRAM
bgInitMapSet(1, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
bgInitMapSet(0, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
..
while(1) {
...
...
if (move) bgSetScroll(0, scrX,scrY);
//this is refreshing oam memory?
oamSet(0, mychar.x, mychar.y, mychar.priority, mychar.direcionSpriter, 0, sprTiles[mychar.positionOffSetSpriter], 0);
WaitForVBlank();
}
setMode(BG_MODE2,0);
Layer 0
Sprite
Layer 1
mychar.priority = 0;
//Init spite
oamInitGfxSet(&gfxpsrite, (&gfxpsrite_end - &gfxpsrite), &palsprite, 0, 0x0000, OBJ_SIZE32);
oamSet(0, mychar.x, mychar.y, mychar.priority, 0, 0, 0, 0);
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);
//Init Map
bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), 16*2, BG_16COLORS, 0x6000);
bgInitMapSet(0, &map, (&map_end - &map), SC_64x64, 0x5000);
mychar.priority = 0;
mychar.priority = 1;
mychar.priority = 2;