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.

Coding > DMA Question

#10506 - sgeos - Sat Sep 06, 2003 7:30 pm

I have a few DMA questions. Why have a fixed destination? What specifically does increment/reload do? What is the game pak DRQ bit used for?

-Brendan Sechter

#10515 - DekuTree64 - Sat Sep 06, 2003 10:11 pm

Fixed dest is useful for stuff like setting new scrolling values on HBlank to make a wavy effect, changing window settings for iris out, etc. where you have an array of register values in memory and DMA them in on HBlank. Then if the increment/reload mode you're talking about is BIT05|BIT06, it's for things like the mode7 effect where you need to copy in more than one value each scanline, so you do need to increment the dest address after each word/halfword copied, but then it resets it back to where it started for the next line.

And what's a DRQ? Do you mean the gamepak IRQ? That happens when you yank the cart out of the system while it's still turned on, the IRQ is used so you can disable sound so it doesn't make scrambly noise and stuff. I think you can also use it to make like a multi-cart game, where you just pull out one cart, put another in and continue. Or just so if you pull the cart out by accident you can put it back in and not have to reset it.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#10517 - sgeos - Sat Sep 06, 2003 10:37 pm

DekuTree64 wrote:
Fixed dest is useful for stuff like setting new scrolling values on HBlank to make a wavy effect, changing window settings for iris out, etc. where you have an array of register values in memory and DMA them in on HBlank.


That makes sense. I was only thinking moving large chuncks of memory, not a member of an array each scanline.

Quote:
Then if the increment/reload mode you're talking about is BIT05|BIT06, it's for things like the mode7 effect where you need to copy in more than one value each scanline, so you do need to increment the dest address after each word/halfword copied, but then it resets it back to where it started for the next line.


That is what I'm talking about. Without increment/reload set, I'm assuming that the next copy will start where the last one left off?

Quote:
And what's a DRQ? Do you mean the gamepak IRQ?


See bit 11 of DMAxCNT_H (0x040000BA, 0x040000C6, 0x040000D2, 0x040000DE).
http://www.work.de/nocash/gbatek.htm#dmatransfers

Quote:
That happens when you yank the cart out of the system while it's still turned on, the IRQ is used so you can disable sound so it doesn't make scrambly noise and stuff. I think you can also use it to make like a multi-cart game, where you just pull out one cart, put another in and continue. Or just so if you pull the cart out by accident you can put it back in and not have to reset it.


I don't think that's what bit 11 is used for, but I may be wrong. It would be kind of neat to see something like this: "Reinsert cart and press start to continue."

-Brendan Sechter

#10519 - tepples - Sat Sep 06, 2003 11:03 pm

DekuTree64 wrote:
I think you can also use it to make like a multi-cart game, where you just pull out one cart, put another in and continue.

Not likely. The Game Boy Player doesn't allow pak-swapping because it resets the system every time you use the "swap carts" function from its Z-button menu, and if you pak-swap without using "swap carts" function from its Z-button menu, it crashes the GameCube with an error message.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.