Is DMA useful ?
Moderators: BigEvilCorporation, Mask of Destiny
Is DMA useful ?
Hi you all.
I'm wondering a silly question : is DMA useful ?
I'm talking about DMA 1 : transfer data from ROM/RAM to VRAM, not DMA-fill or DMA-copy.
Charles McDonalds says the 68000 is frozen until the DMA is finished. So, when you're DMAing, that's the only thing you do, and that's the only thing you can do. Got it.
So, what's the interest of DMA upon software transfer (ie move, dbra) ? You'd answered speed, and you'd be right. DMA is all about speed. It won't allow you to do quite multi-processor, 68k computing and VDP DMAing.
I say software transfer is around 700kB/s, while DMA could theorically be up to 16MB/s. Got it too.
You can tranfer up to 2^24 = 16MB. The cartrige isn't bigger than 4MB (except SSF2). But the VRAM is only 64kB. You will feed the VRAM in 91ms (less than 3 frames) with software, and 4ms (nearly 0 frame) with DMA.
But when do you need such a speed ?
- In the beginning of the level, to load all level data ? Actually, it's not very CPU intensive, most starts of level begin with fade in. You could drop 3 frames and transfer all this data with software.
- in the middle of a level, to change the background for example. Remeber Silkworm on Amiga/ST ? The action didn't stop while loading and that was great for the time. But it was on disks !! Such slower than cartrige. Being slower, software transfer is yet quite fast.
- in the middle of a frame (Sonic 2). I agree. You have to be very fast to copy while Hblank. But is the amount of memory you copy (128 bytes for CRAM) enough to go through DMA ? Isn't the setting of the DMA slower than copying directly ?
In these 3 cases, I only see DMA as useless.
You have a bigger experience than I. So tell me. In what case is DMA transfer useful ?
I'm wondering a silly question : is DMA useful ?
I'm talking about DMA 1 : transfer data from ROM/RAM to VRAM, not DMA-fill or DMA-copy.
Charles McDonalds says the 68000 is frozen until the DMA is finished. So, when you're DMAing, that's the only thing you do, and that's the only thing you can do. Got it.
So, what's the interest of DMA upon software transfer (ie move, dbra) ? You'd answered speed, and you'd be right. DMA is all about speed. It won't allow you to do quite multi-processor, 68k computing and VDP DMAing.
I say software transfer is around 700kB/s, while DMA could theorically be up to 16MB/s. Got it too.
You can tranfer up to 2^24 = 16MB. The cartrige isn't bigger than 4MB (except SSF2). But the VRAM is only 64kB. You will feed the VRAM in 91ms (less than 3 frames) with software, and 4ms (nearly 0 frame) with DMA.
But when do you need such a speed ?
- In the beginning of the level, to load all level data ? Actually, it's not very CPU intensive, most starts of level begin with fade in. You could drop 3 frames and transfer all this data with software.
- in the middle of a level, to change the background for example. Remeber Silkworm on Amiga/ST ? The action didn't stop while loading and that was great for the time. But it was on disks !! Such slower than cartrige. Being slower, software transfer is yet quite fast.
- in the middle of a frame (Sonic 2). I agree. You have to be very fast to copy while Hblank. But is the amount of memory you copy (128 bytes for CRAM) enough to go through DMA ? Isn't the setting of the DMA slower than copying directly ?
In these 3 cases, I only see DMA as useless.
You have a bigger experience than I. So tell me. In what case is DMA transfer useful ?
Sorry to say that (snif snif) but the DMA ROM>VRAM doesn't appear to be so fast... Only 192 tiles during a VBLANK (in PAL, 240 in NTSC).
VRAM access seems quite slow, even DMA (and even slower during VBUSY)... (thx Steve & Stef for the info).
However, 192*32 = 6KB... And i'm not sure that 68K can transfers 6KB per frame during VBLANK...
My advice:
-For EXTRA-SHORT transfers (like 4tiles), use 68K
-For MEDIUM transfers, use DMA
Also, DMA can be used to reload scroll or CRAM during active display... It is quite usefull to prevent most glitches.
However, if you code cleverly, you can preload most data in VRAM at start of level and just DMA/68K one sprite.
VRAM access seems quite slow, even DMA (and even slower during VBUSY)... (thx Steve & Stef for the info).
However, 192*32 = 6KB... And i'm not sure that 68K can transfers 6KB per frame during VBLANK...
My advice:
-For EXTRA-SHORT transfers (like 4tiles), use 68K
-For MEDIUM transfers, use DMA
Also, DMA can be used to reload scroll or CRAM during active display... It is quite usefull to prevent most glitches.
However, if you code cleverly, you can preload most data in VRAM at start of level and just DMA/68K one sprite.
Thanx da Fonz.
BTW, great work on EQNox.
It confirms what I'm thinking : Genny DMA isn't that intersting.
[edit]I've made a mistake. It was the Z80, and not the DMA (!!!) that was cut from the Genny 3 !!![/edit]
BTW, great work on EQNox.
It confirms what I'm thinking : Genny DMA isn't that intersting.
[edit]I've made a mistake. It was the Z80, and not the DMA (!!!) that was cut from the Genny 3 !!![/edit]
Last edited by ob1 on Wed Dec 06, 2006 11:44 am, edited 1 time in total.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
As said Fonzie, DMA isn't that fast at all and it freezes your CPU when operating. Futhermore you have to take care to use it only during Vblanking (or anysort of VDP inactivity) or it'll be a lot slower.
The VDP access VRAM during drawing and leave very few time to others part for accessing it. Generally doing VRAM access during non blanking period is insane. Another bad point of DMA is that interrupt Z80 processing (because the main BUS is used) so if the Z80 is used to play digitalized sound, the quality will be really degraded. It's the main reason of the bad digitalized voices on the genesis, because almost games use them and use DMA at same time. When i'll have sometime, i'll try to play some samples from the Z80 without any interrupts, i'm pretty sure the quality will be really improved.
Anyway note that if you have to transfert a lot of data to VRAM (sprites tiles and sprites list almost time) the best way is still the DMA since it's 3 to 4 times faster than software... that's definitly not useless.
The Genesis 3 does have DMA as the Genesis 3 does have a Z80. Without them you don't have a genesis so genesis games can't work.
The VDP access VRAM during drawing and leave very few time to others part for accessing it. Generally doing VRAM access during non blanking period is insane. Another bad point of DMA is that interrupt Z80 processing (because the main BUS is used) so if the Z80 is used to play digitalized sound, the quality will be really degraded. It's the main reason of the bad digitalized voices on the genesis, because almost games use them and use DMA at same time. When i'll have sometime, i'll try to play some samples from the Z80 without any interrupts, i'm pretty sure the quality will be really improved.
Anyway note that if you have to transfert a lot of data to VRAM (sprites tiles and sprites list almost time) the best way is still the DMA since it's 3 to 4 times faster than software... that's definitly not useless.
The Genesis 3 does have DMA as the Genesis 3 does have a Z80. Without them you don't have a genesis so genesis games can't work.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Z80 is a MUST component, as almost every game uses it as SFX/BGM engine while 68K does game/GFX therefore it is in Genny 3I've made a mistake. It was the Z80, and not the DMA (!!!) that was cut from the Genny 3 !!!
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 615
- Joined: Thu Nov 30, 2006 6:30 am
Depending on the situation, DMA can be useful for transfers as small as 16 bytes (8 CRAM entries). There's a fair bit of setup involved in preparing a DMA transfer; however, in some situations you can prepare the DMA transfer during a non-critical time and then just trigger it when the time comes. For instance, if you're doing Raster F/X for color changes you can prepare the DMA transfer during the active period of the line and then trigger the transfer once you're in VBlank.ob1 wrote: Your advise is to use 68k for 4 tiles (128 bytes). But the CRAM is 128 bytes. So, to reload CRAM during active display, I could use 68k, couldn't I ?
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I did my 512 and 960 color test without DMA. Results are good on emu but suck on real thing. Maybe DMA helps... source for 960 color demo available on request.
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
That always interets meTmEE co.(TM) wrote:I did my 512 and 960 color test without DMA. Results are good on emu but suck on real thing. Maybe DMA helps... source for 960 color demo available on request.
I think we should have a section to post member's creations in the forum
One important thing to know :
Kega Fusion is more accurate than Gens on VRAM access time. Kega emulates the VRAM/VDP latency during refresh when Gens simply ignores that part.
If you want to test only some CPU related stuff Gens is instead more accurate...
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I do my testing on the real hardware now, I specially built a SRAM cartridge for such purpose (pics on my site). 256KB of unlimited rewrites, programs in 5 secs, 3 in pure DOS. Program with my MPCP (damn, off topic).Stef wrote:If you want to test only some CPU related stuff Gens is instead more accurate...
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Impressive you did your own sram-cartTmEE co.(TM) wrote:I do my testing on the real hardware now, I specially built a SRAM cartridge for such purpose (pics on my site). 256KB of unlimited rewrites, programs in 5 secs, 3 in pure DOS. Program with my MPCP (damn, off topic).Stef wrote:If you want to test only some CPU related stuff Gens is instead more accurate...
I'm also testing on real hardware, it's why i can affirm the previous notes
I've a 64 MB flashcart, the guy from tototek just offered me it. I admit am really indebted for him for that
Last edited by Stef on Tue Dec 19, 2006 7:54 am, edited 3 times in total.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Its not a Flash cart, its SRAM, it uses RAMs not ROMs. Anyway it is great thing to test out stuff. BTW your spinning cube works great on real hardware !!!
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen