gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Question about using DMA to copy a tile to VRAM

#12991 - codered - Wed Dec 03, 2003 1:32 am

hey everybody...

so here's my problem:

Instead of copying my whole tileMap using DMA like :

Code:

DMA_Copy(3,(void*)house2Map.tiledata,(void*)CharBaseBlock(0),house2Map.tileDataSize/4,DMA_32NOW);


i'm trying to load my tile data tile by tile using this code to add in each of the 279 tiles:

Code:

for(u32 loop=0;loop<279;loop++)
    {
        for(u32 loop2=0;loop2<64;loop2++)
        {
            SubtileData[loop2] = house2Map.tiledata[loop2+(loop*64)];
        }
        DMA_Copy(3,(void*)SubtileData,(void*)(0x6000000+(loop*64)),32,DMA_32NOW);
    }


for now i'm just using a temp array "SubtileData" to keep each tile in till I can reformat my tileData arrays.

It kinda works, the only thing is that every other verticle line is nothing(black).

any help would be helpfull...

thanx

~CODE-RED~

#12993 - sajiimori - Wed Dec 03, 2003 4:53 am

Quote:

i'm trying to load my tile data tile by tile

What was wrong with using DMA? Why do you use the CPU to copy a tile to a temporary buffer and then use DMA to copy the tile to VRAM? Why not just copy straight to VRAM?

Anyway, what are the types of SubtileData and house2Map.tiledata? If they are arrays of (or pointers to) elements of different sizes, that might cause your problem.