#35006 - kareemjg - Sat Jan 29, 2005 7:29 am
Okay I've been dreading sending this post.. I've been going over this for about two days and while my mistakes have taught me a lot in that time I still have not managed to solve my problem. The main premise is i'm building an rpg engine for learning sake and I've been doing some hard core disecting of the various turtoial sources. Now my problem lies in my displaying the map onto the screen. Which normally should be a easy task. I have verifed the tiles are in the right memory locations along with the maps. I can see the information in the right address via VBA so I think the problems lies with the code that I have displaying the map memory register.
Here are my header references in case you are wondering
#define REG_BG0CNT (*(volatile u16*)0x4000008)
#define BGPaletteMem ((volatile u8*)0x5000000)
static u16* theScreenPalette = (u16*)BGPaletteMem;
#define BGTileMem ((u16*)0x6004000)
static u16* theTileMemory = (u16*)BGTileMem;
#define VideoBuffer ((volatile u16*)0x6000000)
---
Now from what I see on the VBA my tiles are loading in properly, and my map seems to be there also but the tiles are not right. I included a picture of what I'm seeing also a link to the full zip code that includes the tiles files with rom. Thanks for taking the time to look at this. I'm thinking the problem is at my tile loop. The loop is 272 because that is the number in my tiles array.. plus it shows up good when viewing tiles in VBA. I was trying to avoid having to ask for guidance on something that should be so routine.
http://www.khova.com/prjsite/downloads/RPGEngine012905.zip
http://www.khova.com/prjsite/downloads/RPGEngine.png
http://www.khova.com/prjsite/downloads/RPGEngine.elf
Thanks
-kareem
Code: |
int main() { //Looping variables int loop,x,y; //Background 0 REG_BG0CNT = BIT02 | BIT07; //Mode 0, BG0 SetMode(MODE_0 | BG0_ENABLE); //Load the palette into background palette memory for (loop = 0; loop < MaxPalColor; loop++) theScreenPalette[loop] = map_demo000PAL[loop]; //Load the tiles into background memory ***HRMM for (loop = 0; loop < 272; loop++) theTileMemory[loop] = map_demo000TILE[loop]; //Load the map into the VideoBuffer for (y=0;y<32;y++) { for (x=0;x<32;x++) { theVideoBuffer[y*32+x]=map_demo000[y*32+x]; } } }//end main |
Here are my header references in case you are wondering
#define REG_BG0CNT (*(volatile u16*)0x4000008)
#define BGPaletteMem ((volatile u8*)0x5000000)
static u16* theScreenPalette = (u16*)BGPaletteMem;
#define BGTileMem ((u16*)0x6004000)
static u16* theTileMemory = (u16*)BGTileMem;
#define VideoBuffer ((volatile u16*)0x6000000)
---
Now from what I see on the VBA my tiles are loading in properly, and my map seems to be there also but the tiles are not right. I included a picture of what I'm seeing also a link to the full zip code that includes the tiles files with rom. Thanks for taking the time to look at this. I'm thinking the problem is at my tile loop. The loop is 272 because that is the number in my tiles array.. plus it shows up good when viewing tiles in VBA. I was trying to avoid having to ask for guidance on something that should be so routine.
http://www.khova.com/prjsite/downloads/RPGEngine012905.zip
http://www.khova.com/prjsite/downloads/RPGEngine.png
http://www.khova.com/prjsite/downloads/RPGEngine.elf
Thanks
-kareem