#150940 - krozen - Fri Feb 15, 2008 4:10 pm
Hi guys,
I'm just trying to get my head around the operation of the dma. I have a single 8 x 8 sprite in 16 colour mode, which is 32 bytes. I wish to copy this into VRAM. So, I was just trying out different mechanisms to copy in the data. So far Ive tried:
Option 1:
u32* spriteMem = (u32*)SPRITE_GFX;
u32* spot = (u32*)example_bin;
u32 i;
for (i = 0;i<8;i++)
spriteMem[i] = spot[i];
Option 2:
u16* spriteMem = (u16*)SPRITE_GFX;
u16* spot = (u16*)example_bin;
u32 i;
for (i = 0;i<16;i++)
spriteMem[i] = spot[i];
Option 3:
memcpy(spriteMem,spot,32);
Option 4:
dmaCopy(spot,spriteMem,32);
Now, all work fine, but my question is - why does dmaCopy require 32 as the third parameter, when it's copying 16 bits at a time? I would have thought Option 4 is just a faster version of Option 2?
I'm just trying to get my head around the operation of the dma. I have a single 8 x 8 sprite in 16 colour mode, which is 32 bytes. I wish to copy this into VRAM. So, I was just trying out different mechanisms to copy in the data. So far Ive tried:
Option 1:
u32* spriteMem = (u32*)SPRITE_GFX;
u32* spot = (u32*)example_bin;
u32 i;
for (i = 0;i<8;i++)
spriteMem[i] = spot[i];
Option 2:
u16* spriteMem = (u16*)SPRITE_GFX;
u16* spot = (u16*)example_bin;
u32 i;
for (i = 0;i<16;i++)
spriteMem[i] = spot[i];
Option 3:
memcpy(spriteMem,spot,32);
Option 4:
dmaCopy(spot,spriteMem,32);
Now, all work fine, but my question is - why does dmaCopy require 32 as the third parameter, when it's copying 16 bits at a time? I would have thought Option 4 is just a faster version of Option 2?