I'm not sure what's causing these problems but DMA is giving me a lot
of headaches. Basically, consecutive DMAs seem to be screwing up.
Using Mappy I can see that DMAs are firing, but sometimes they don't
transfer the right info. For example, I have a function LoadMapData
(), it takes a pointer, a word count, and a destination to load the
tile map into. I call it twice, the first time I fill the map with
info for layer0, the second time for layer1... I look in memory and I
see at both blocks in memory the info from layer1.
This seems like such an elementary problem, but I have no idea why it
is happening. As near as I can tell when I do consecutive DMAs the
DMA doesn't start for a bit, and when it does start I've already
changed the source and/or dest regs with the addresses for the next
transfer.
I have no idea how to prevent this... I really can't do unrelated
stuff between this unless I invent some useless code to stick in. I
have the calls to DMA wrapped in functions, but this doesn't seem to
introduce a delay. For each DMA I set the source, dest, control +
enable, and lastly word count regs in that order, but that doesn't
seem to introduce the desired delay.
If I'm doing something wrong or if anyone has a tried and tested
function of theirs for DMA that works I'd appreciate having a look at
it. If you think that my problem is something else, by all means,
chime in.
Thanks.