#10525 - cooky - Sun Sep 07, 2003 11:29 am
I'm using the gbajunkie tutorial 6 as a base for a mode 0 game. I'm trying to display a 256 x 256 background and I carn't see a problem with the code out of GBA junkie for putting the data in memory although when it appears on screen there are tiles missing and the others that are there are out of place. I carn't help thinking there is a difference between how you input a text backgrounds data and how you do a rotation background data (as the gbajunkie tutorial focuses on rotation backgrounds) . Hear is the code where I think the problem is:
temp = (u16*)fireworld1;
for(loop = 0; loop < 32*32/2; loop++)
bg1.mapData[loop] = temp[loop];
fireworld1 is a u8 constant array coppied into a u16 temp hense the divide by 2. (If it makes a difference)
#10526 - tepples - Sun Sep 07, 2003 3:00 pm
You are correct that the two kinds of maps have different data formats. Rotation map data is 8 bits per tile while "text" background map data is 16 bits per tile. Please read the CowBite spec for details.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#10540 - antysix - Mon Sep 08, 2003 9:18 am
Don't use GbaJunkie's method for displaying text-backgrounds. Do it like this:
- Set the correct bits directly in REG_BGxCNT.
- Load your background palette.
- Load your background tiles.
- Load your background map.
- Make sure the correct background(s) are enabled in REG_DISPCNT.
If you don't understand fully just say so and I can give you my header file which contains all the needed functions :).
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age
Currently developping: Project ~ [ Phail ]
#10544 - cooky - Mon Sep 08, 2003 11:22 am
I have done 2,3,4 and 5 of your instructions correctly (I think) as the tiles it is desplaying are correct in that they are not corrupted by memory over lap and they are correct colour wise so the palette is correct. I cannot be 100% certain I have done 4 right but I carn't possibly see where I am going wrong Everything shuld work fine (from my point of veiw, remember I am assuming the code is the same for rotation as it is for text). And 5 I'm deffinitely sure I've got right by checking the map viewer in visual boy (Background 0 requested in Mode 0).
Why set the bits directly to REG_BGxCNT? But from my logic this must be the place I'm going wrong.
The header would be useful as It would point out where the problem is.
#10559 - cooky - Mon Sep 08, 2003 7:36 pm
Wow the cowbite tutorial is realy helpful however I have never realy understood how you map to memory. It's just like number alocation isn't it? But surley it's more complicated than that.
#10580 - antysix - Tue Sep 09, 2003 3:15 pm
Quote: |
Why set the bits directly to REG_BGxCNT? |
Why not? I just think it's a lot easier doing it that way than the GBAJunkie's way with first putting everything into a temporary variable and then calling EnableBackground().
An example for a simple 256x256 text background:
Code: |
REG_BG0CNT = CHAR_MEM(0) | SCREEN_MEM(31) | BG_COLOR_256 | TEXTBG_SIZE_256x256)
|
Quote: |
The header would be useful as It would point out where the problem is.
|
Please give me your email-adress and I'll send it to you and I don't have to thrash this post with it.
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age
Currently developping: Project ~ [ Phail ]
#10634 - cooky - Thu Sep 11, 2003 9:57 am
antysix wrote: |
Please give me your email-adress and I'll send it to you and I don't have to thrash this post with it. |
Thanks. I'll give you it now.
REG_BG0CNT = CHAR_MEM(0) | SCREEN_MEM(31) | BG_COLOR_256 | TEXTBG_SIZE_256x256)
This makes allot of sence now I've read Cowbite thanks again.