GBA- Waiting for DMA

Started by
11 comments, last by Arek the Absolute 22 years ago
The black/white pixel problem can probably be solved by making color an u32 instead of an u16 and assigning it the value 0xFFFFFFFF (two pixels at a time). Or did you already do that? I thought 32 bits DMA to VRAM is possible but I''m no expert

Then on to the problem of the duration of the DMA. It seems nearly impossible to solve. One 32 bits transfer takes at a standard of 2 cycles plus the wait states of the memory you''re reading from and writing to.

You should make sure the color variable is in IWRAM (zero wait states) rather than EWRAM (2 cycles) but GCC might already do that (if not I don''t know how to do it). Make sure it isn''t defined as a constant and residing in ROM (lots of wait states). The wait states to video memory are variable so I don''t really know how much time they take but I''ll assume it''s about 2 cycles (same as EWRAM).

So the optimal 32 bit transfer takes standard + read + write = 2 + 0 + 2 = 4 cycles. You''ll need 240 * 160 / 2 = 19200 transfers, which mean 76800 cycles to fill the whole screen. Seeing that you have 83776 you should be able to make it in theory (!= practice). It does how leave you with very little time to do anything else...

You might want to consider switching to mode 4 or 5 where you have a backbuffer so you don''t have to worry too much about filling the screen in time. Or create a backbuffer for mode 3 in EWRAM, but that''s a lot of pain and effort. Other than that I really don''t know what to do. Well, that''s about it from me. Good luck,

Jasper
Advertisement
Thanks for your help! I don''t know if I''ll ever be able to deal with Mode 3, but thanks for helping me with that. At least I know what''s going wrong, if not any way to solve it. I guess, however, if I ever figure things out I''m honor bound to write a tutorial, right? Don''t get your hopes up. I''ll probably be going to Mode 4 soon enough. Heh. Thanks, and BTW, I did get the u32 color[] = {0xFFFFFFFF}; thing, and copying does now work properly. Thanks!

-Arek the Absolute
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig
There was some stuff about this on the GBADev mailing list (www.gbadev.org) a while ago. If I remember correctly it was eventually decided it wasn''t possible to DMA an entire 15bpp screen in the vblank period. You could however transfer the new in image line by line in the hblank period (at the end of each line) much in the same way as the GBC worked with the camera.

This topic is closed to new replies.

Advertisement