Page 1 of 2

Bug Sonic 2

Posted: Tue Apr 14, 2009 9:09 pm
by mickagame
I found a bug in Regen with sonic 2:

Image

It seems that dma finish too early so one blue line is missing at bottom of the blue bar.[/img]

Posted: Wed Apr 15, 2009 1:46 pm
by AamirM
Thanks for the report. Will have to check this out later. (not kinda doing MD stuff these days :P ).

Posted: Wed Apr 15, 2009 4:46 pm
by mickagame
After somes test it seems that problem is not DMA.
Here is screenshot from Fusion :

Image

As you can see the DMA timings seems good because the display is switched off at the correct line.

Posted: Wed Apr 15, 2009 6:22 pm
by mickagame
I success to reproduce the bug in my emulator.
In fact, when display is switched ON, you probably render the line again.
But the sprite have already been parsed for line N+1 so you render the line with incorrect parsed sprite data.

EDIT : I don't know if it's correct but if you do this when display is switched ON/OFF :

Code: Select all

renderer->parseSatb(0x80 + line);
renderer->renderLine(line);
renderer->parseSatb(0x81 + line);
It works for me.

Posted: Thu Apr 16, 2009 8:28 am
by Eke
I remember I compared emulator output with megadrive 2 output on my TV when trying to improve original video mode emulation and I *think* similar glitch was occuring above the two first rings in the bottom screen (disappears if you collect the rings)

But I'm not sure anymore...

the following comment is correct though: in my case, sprites for the next line are indeed already parsed when rendering the line again, which is incorrect

thanks

Posted: Thu Apr 16, 2009 8:33 am
by mickagame
Would be interesting if someone can confirm ...

Posted: Thu Apr 16, 2009 4:02 pm
by AamirM
mickagame wrote:Would be interesting if someone can confirm ...
It doesn't happen on real hardware.

Posted: Thu Apr 16, 2009 4:15 pm
by mickagame
Eke wrote:I remember I compared emulator output with megadrive 2 output on my TV when trying to improve original video mode emulation and I *think* similar glitch was occuring above the two first rings in the bottom screen (disappears if you collect the rings)

But I'm not sure anymore...

the following comment is correct though: in my case, sprites for the next line are indeed already parsed when rendering the line again, which is incorrect

thanks
Do you have the same bug in genesis plus?

Posted: Thu Apr 16, 2009 6:00 pm
by AamirM
Here is a video of Sonic 2 2 player mode. I can't see the bug. Thanks to Puto for the video ;) .

Posted: Thu Apr 16, 2009 8:08 pm
by Eke
mickagame wrote: Do you have the same bug in genesis plus?
yep, and I was aware of it but for unknown reason I thought this was supposed to be like this :oops:

well, it's now confirmed to be a bug, so thanks
I must find another way to fix it though, parsing the sprite table 3 times consecutively is gonna be slowwwww

Posted: Thu Apr 16, 2009 9:40 pm
by mickagame
Thank you for this video !!!
I notice the last line of blue bar is flickering.
It shows that display is switched on during active area :-)

EDIT : Is the blue line at the top and bottom of the screen the v blanking area?

Posted: Fri Apr 17, 2009 7:29 am
by Eke
These are the vertical borders: there are actually 243 visible lines but only 224 of them are "active", the rest being filled with the border color (top border being a little "higher" than bottom border)

in PAL Mode, there are 288 visible lines, with only 224 (or 240 depending on the display size) being active

Those areas are generally hidden by the TV edges but not always, depends on TV specification as well as video connection;

see this threadfor more details

Posted: Fri Apr 17, 2009 7:35 am
by mickagame
Thank you Eke !!!
I note that on real hardware, DMA seems to be switched ON during active AREA.
Perhaps this can help to ajust timings?
On my emulator, the DMA is switched ON during blanking area approx. at cycle 640.

Posted: Fri Apr 17, 2009 9:41 am
by Eke
As we already discussed in other threads, Sonic 2 only check the HBLANK flag before switching the display OFF then ON, so this has something to do with HBLANK flag occurence period regarding to the real blanking area...

It might be that the last VDP status read occurs as the very end of the blanking area or maybe that the flag is cleared after the active area started (we know it is supposed to be cleared at Hcount=0x07 but still don't know the relation with hblank/hdisplay)...

What "seems" to happen is that the register write (used to switch display ON) is sometime processed after some visible pixels have already been drawn, resulting in a wider left border (and flickering as it does not happen on every frame, indicating the timings are really tight).

It would be interesting to see if the width of the additional border color part is always the same (I bet it could be a multiple of 16 pixels)

Posted: Fri Apr 17, 2009 10:27 am
by mickagame
This would confirm that all register modification takes effect only next "column" :-)