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.

Beginners > simple silly question

#23611 - underthesun - Fri Jul 16, 2004 4:20 am

Hi, newbie has a few questions:

I was just reading somewhere that says DMA has a limit to 1000 kilobit for copying?

then DMA wouldn't be able to copy an array of 38400 shorts (my buffer for graphics) into the output buffer? in the vblank time?

if not, then i'm wondering how people manage to put graphics out in vblank time (if the memory writing to videobuffer is done while its not vblank, "blitting" seems to happen)

is sprites the answers?

Thanks in advance!
_________________
I am just a gba noob. be gentle :p

#23613 - Darmstadium - Fri Jul 16, 2004 5:19 am

mm, i don't think that there's a limit to how much you can transfer at a time, except that you only have so many bits in REG_DMxCNT to specify how many words you want copied. I'm sure that you can copy as much as you would ever want.

sprites are fairly small images that you can move around on the screen and rotate and do other stuff to. You should look at a tutorial for more info. I suggest gbajunkie's at www.gbajunkie.co.uk. It's a lot better than the PERN project tutorial. You should start with gbajunkie's and then move to the PERN project.

good luck!

#23617 - underthesun - Fri Jul 16, 2004 8:08 am

oh thanks. I never actually thought of making a wrapper function that dmacopies 1000 bits by 1000 bits... :S.

thanks for the pointer. did look at the pern project, but guess i'll now be @ gbajunkie tutorial. thanks again!
_________________
I am just a gba noob. be gentle :p

#23654 - sajiimori - Sat Jul 17, 2004 5:28 am

Single DMA transfers are neither limited to 1000 kilobits nor 1000 bits. You can fill all of EWRAM in one go if you want.

#23657 - underthesun - Sat Jul 17, 2004 10:25 am

sajiimori wrote:
Single DMA transfers are neither limited to 1000 kilobits nor 1000 bits. You can fill all of EWRAM in one go if you want.


I did my first ever dma transfer yesterday, and it really is fast (good for making boxes on bitmap mode? :D, with fixed source on a colour).

But the thing is, isn't the bits on the dma control register.. isn't there only 7 bits for the wordcounts, which leaves about.. 2^7 = 128 * 4 bytes? or am I getting my maths wrong?

how do ou actually transfer 1000 kbits on a single (or three-liner more likely) call, which involves setting source register, dest register and activating it?

thanks again
_________________
I am just a gba noob. be gentle :p

#23659 - poslundc - Sat Jul 17, 2004 2:16 pm

underthesun wrote:
I did my first ever dma transfer yesterday, and it really is fast (good for making boxes on bitmap mode? :D, with fixed source on a colour).


DMA is actually slower than software copying if the source is fixed, because the DMA has to re-read the source for every iteration. Consider using the CPUFastSet SWI call instead.

Quote:
But the thing is, isn't the bits on the dma control register.. isn't there only 7 bits for the wordcounts, which leaves about.. 2^7 = 128 * 4 bytes? or am I getting my maths wrong?


There are actually 16 bits for the wordcounts... but the number you can use depend on the DMA. DMA0-2 recognize numbers up to 16384 (14 bits, with 0 representing 16384) and DMA3 recognizes numbers up to 65535 (16 bits, with 0 representing 65536).

Quote:
how do ou actually transfer 1000 kbits on a single (or three-liner more likely) call, which involves setting source register, dest register and activating it?


Your use of kilobits is a bit awkward... you are better off working in bytes on the GBA. If you wanted to transfer 125 kilobytes (the equivalent of 1000 kilobits), well, first of all you'll have to transfer 126 if you're using 16-bit DMA or 128 if you're using 32-bit DMA. If you're using 16-bit DMA then set the wordcount to 63; if you're using 32-bit DMA set the wordcount to 32.

Keep in mind that large DMA transfers are a bad idea if you've got time-critical interrupts firing regularly because interrupts will be delayed while the DMA is running. Just something to keep in the back of your head.

Dan.