1

Hi;

I write to the REG_VRAMMOD register to write the tile data.

I set it to one, and then draw all the background tile data with it.
But I see weird glitches on the screen if I don't set if for each sprite, for example I set it to one, and write tile data for 20 sprites, I get tile glitches, like wrong tile data was written.

But If I set it for each sprite I write, there is no issues.

I was wondering if there is something that affect it?
avatar

2

As far as I know the modulo should stay the same once you set it - unless you have a piece of code or interrupt routine that changes it and you aren't aware of it.

There are timing restrictions on writes to VRAM and it might be that when you set the modulo after setting the address - that you are actually introducing a delay before you write data to the VRAM which gives the graphics chip time to find the right tile.

- You need to leave 12 CPU cycles after every VRAM write. If you don't leave enough time - it's possible it won't have updated (using the modulo) to the next address in time

Check out the way it's done in the DevKit if you are unsure

Here are the timings from the Dev Wiki : https://wiki.neogeodev.org/index.php?title=VRAM

sbREB30.jpg

Hope that helps

3

Hi CosmicR;

Could you link the Devkit that has the examples please?
avatar

4

Yes sure - you can download the dev kit from here : http://sebastianmihai.com/neogeo-neo-thunder.html

Look at the file "video.s" for the source code to the sprite functions

Also here is the official Neo Geo Hardware Specification manual : https://www.neogeodev.org/NG.pdf It has some examples for VRAM access timing in it (Page 10)

BTW have you tried reading the REG_VRAMMOD register to see if the modulo is set correctly still? Would be good to eliminate that as the cause

5

CosmicR (./4):
Yes sure - you can download the dev kit from here : http://sebastianmihai.com/neogeo-neo-thunder.html

Look at the file "video.s" for the source code to the sprite functions

Also here is the official Neo Geo Hardware Specification manual : https://www.neogeodev.org/NG.pdf It has some examples for VRAM access timing in it (Page 10)

BTW have you tried reading the REG_VRAMMOD register to see if the modulo is set correctly still? Would be good to eliminate that as the cause
Thank you very much CosmicR.
No, I didn't good idea, will test it out.
avatar