jsgroth / jgenesis

Sega Genesis / Sega CD / SNES / Master System / Game Gear emulator
MIT License
40 stars 3 forks source link

OutRunners (USA).md black dots on screen #118

Open benderscruffy opened 1 week ago

jsgroth commented 1 week ago

This bug is summarized here: https://gendev.spritesmind.net/forum/viewtopic.php?p=7059#p7059

It seems like due to poor programming, the game will corrupt the first word in VRAM if the routine at PC=$008712 executes before the 68000 handles that frame's vertical interrupt.

This is probably a VDP DMA timing issue - the game works correctly if I decrease the VDP DMA transfer rate from 205 bytes/line (actual hardware's rate) to 204 bytes/line.

jsgroth commented 1 week ago

So, there have been tests performed on actual hardware that show that Sega's official documentation is wrong on this (surprise). The VDP DMA transfer rate during VBlank and forced blanking is actually 204 bytes/line in H40 mode and 166 bytes/line in H32 mode: https://gendev.spritesmind.net/forum/viewtopic.php?p=20921#p20921

Implementing this plus a small extra overhead on every memory-to-VRAM DMA (1 extra access slot required) fixes OutRunners. The glitch still sometimes occurs if I decrease the transfer rate from 205 to 204 without the extra overhead - the 68000 would sometimes execute the instruction at $008712 only 1 or 2 instructions before the VINT triggered.

outrunners