#108160 - Lupi - Mon Nov 06, 2006 1:07 am
In my proyect, I'm loading into VRAM BANK E some sprites:
-> 30 32*32 sprites
-> 3 64*64 sprites
I have a few questions:
1. Can I load all that in VRAM BANK E? Is there any space left if I load all that?
2. What happens if I accidentally try to load beyond the limits of the VRAM BANK?
3. I use git to covert backgrounds and sprites, is there any difference if I covert to u8, u16 or u32?
4. I would be very grateful if someone could help me understanding how to load a sprite in a specific place of the VRAM
I'm asking this because I'm having so wierd problems with the sprites, and I think it may be the lack of space.
Thanks in advance =)
#108173 - tepples - Mon Nov 06, 2006 4:22 am
Lupi wrote: |
In my proyect, I'm loading into VRAM BANK E some sprites:
-> 30 32*32 sprites
-> 3 64*64 sprites |
How many colors? 16 (4-bit), 256 (8-bit), or 32,768 (16-bit)?
Quote: |
3. I use git to covert backgrounds and sprites, is there any difference if I covert to u8, u16 or u32? |
Converting to u32 will guarantee that the fastest copying methods remain available.
Quote: |
4. I would be very grateful if someone could help me understanding how to load a sprite in a specific place of the VRAM |
Have you done this on the Game Boy Advance before?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#108183 - Lupi - Mon Nov 06, 2006 8:52 am
Sorry my fault.
Images are 256 colour (8 bit)
And the problem is that I've never coded in GBA, I have tried figuring out how to load in a specific place in the VRAM, but sometimes I succeed, sometimes I fail :s
#108185 - Payk - Mon Nov 06, 2006 11:12 am
I think 8bit sprites arent maped like a bitmap- They are tiled afaik (i dont use 2d much). With a converter its easy to get right datas loaded. But if you want to load it from a u8 buffer + pal ...you will need to tille that data...
#108214 - Lupi - Mon Nov 06, 2006 7:43 pm
When I convert with git, I set so it converts the image to tiles.
I'm loading the folowing sprites
Three sets of 10 32*32 sprites like this (different colours)
[Images not permitted - Click here to view it]
Three sprites like this (different colours)
[Images not permitted - Click here to view it]
I load them in this order (numbers are the 10 32*32 sprites and the circles are the 64*64)
Blue Numbers -> Blue circle -> Red numbers -> Red circle -> Green numbers -> Green circle
That would be a total of:
((32*32)*10)*3) + ((64*64)*3) bytes = 43008 bytes = 42 kbytes
right?
Problem:
when I try to load the last sprites (the green ones), I get a sprite composed of tiles from the first sprites in memory (the blue ones)
What am I doing wrong? :S:S
#108236 - tepples - Mon Nov 06, 2006 10:47 pm
If you want to use all the sprite cel VRAM, you need to set the 2D core's sprite engine to use a larger unit for sprite cel addressing. By default, each core uses 32-byte units like on the GBA and can address the first 32 KiB of a bank. But if you're using only 256-color sprite cels, or you're using only sprite cels larger than 8x8 pixels, then you can get away with using 64- or 128-byte units and address 64 or 128 KiB of a bank. You can change each core's sprite cel addressing unit through through bits 21-20 of the core's respective DISPCNT.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#108329 - Lupi - Tue Nov 07, 2006 8:54 pm
Thanks for the tips tepples. Now I really understand the 1D mapping. It's working.
Sorry for the noob question :P