Sprite table to VRAM with or without DMA?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
Manveru
Very interested
Posts: 85
Joined: Wed Sep 05, 2012 3:30 pm

Sprite table to VRAM with or without DMA?

Post by Manveru » Thu Dec 03, 2015 9:42 am

Hi guys!

I am reading some info about sending the sprite table without DMA because DMA can cause some glitches for this operation. Is that right? Do you know the reason for that?

Thanks!
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Sprite table to VRAM with or without DMA?

Post by TmEE co.(TM) » Thu Dec 03, 2015 10:36 am

You can get problems when you update sprite table during active frame regardless of using CPU or DMA to do the transfer.
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

BigEvilCorporation
Very interested
Posts: 209
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Re: Sprite table to VRAM with or without DMA?

Post by BigEvilCorporation » Thu Dec 03, 2015 1:22 pm

I've recently gone down the DMA route and it's working just fine for me.

Previously I was setting individual sprite properties (X, Y, flip flags) by reading bytes from the VDP, setting values and writing them back, but this slowed my game down to a crawl.

Now I keep a local copy of the entire sprite table in RAM, and DMA it across in the vertical interrupt routine. Works a treat!
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

Manveru
Very interested
Posts: 85
Joined: Wed Sep 05, 2012 3:30 pm

Re: Sprite table to VRAM with or without DMA?

Post by Manveru » Thu Dec 03, 2015 2:01 pm

BigEvilCorporation wrote:Now I keep a local copy of the entire sprite table in RAM, and DMA it across in the vertical interrupt routine. Works a treat!
I usually do that, but in some wikis say that DMA works fine but the cache should not be completely update, causing some problems with the drawn sprites. I have some random sprite disappearing (not because a known reason) and the problem should be DMA writing. I see that SGDK did not use DMA also for that stuff, so i think it should be a good reason.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Sprite table to VRAM with or without DMA?

Post by TmEE co.(TM) » Thu Dec 03, 2015 2:17 pm

The cache not updating happens when your DMA (or CPU transfer) reaches active frame. When your update happens and finishes in the blanking/border there will not be problems.
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

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sprite table to VRAM with or without DMA?

Post by Stef » Thu Dec 03, 2015 4:12 pm

Next SGDK version will use DMA for sprites update. Definitely use it if you can, it's a lot faster than updating sprites independently and from 68K.

Manveru
Very interested
Posts: 85
Joined: Wed Sep 05, 2012 3:30 pm

Re: Sprite table to VRAM with or without DMA?

Post by Manveru » Thu Dec 03, 2015 5:55 pm

Ok i understand. Thanks guys!!!
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

Post Reply