Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

GBA- DMA question...

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Arek the Absolute   Members   

350
Like
Likes
Like

Posted 18 March 2002 - 10:38 AM

Anyone know a way to copy a part of an array with DMA? I''m using the function from the PERN Project, but in case you''re not familiar with it, here it is.
  
void DMA_Copy(u8 channel, void* source, void* dest, u32 WordCount, u32 mode)
{
	switch (channel)
	{
		case 0: 
			REG_DMA0SAD = (u32)source;
			REG_DMA0DAD = (u32)dest;			
			REG_DMA0CNT = WordCount | mode;
			break;
		case 1:
			REG_DMA1SAD = (u32)source;
			REG_DMA1DAD = (u32)dest;
			REG_DMA1CNT = WordCount | mode;
			break;
		case 2:
			REG_DMA2SAD = (u32)source;
			REG_DMA2DAD = (u32)dest;
			REG_DMA2CNT = WordCount | mode;
			break;

		case 3:
			REG_DMA3SAD = (u32)source;
			REG_DMA3DAD = (u32)dest;
			REG_DMA3CNT = WordCount | mode;
			break;

	}
}

  
Anyway, my question is this. I have a large array containing the image data for a number of different frames of animation. The first 512 items are the first frame, etc. Can I use DMA to copy just the data in, for example, the third frame? Meaning, can I tell it to start at array[1024] and progress from there? If so, how? Any advice would be, in a word, keen. -Arek the Absolute

#2 Arek the Absolute   Members   

350
Like
Likes
Like

Posted 18 March 2002 - 02:27 PM

Oh well. I think I solved the problem anyway. For anyone interested, just manually adjust the position of the pointer. Something like:
DMA_Copy(3,(void*)array+0x400,(void*)OAMData,amount,rate);
Of course, the specifics change on how much you''re skipping, but it does seem to work.

-Arek the Absolute

#3 outRider   Members   

852
Like
Likes
Like

Posted 18 March 2002 - 03:45 PM

You can do it that way, or also &Array[1024].

------------
- outRider -

#4 meh   Members   

375
Like
Likes
Like

Posted 20 March 2002 - 12:19 AM

Not really a DMA issue but for faster code you''d be better of using a macro rather than a function especially if your transfering small amounts of data as often the overhead of the function call may be more than that of the transfer. :D




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.