Bug Sonic 2

AamirM's Regen forum

Moderator: AamirM

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Bug Sonic 2

Post by mickagame » Tue Apr 14, 2009 9:09 pm

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]

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Wed Apr 15, 2009 1:46 pm

Thanks for the report. Will have to check this out later. (not kinda doing MD stuff these days :P ).

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Wed Apr 15, 2009 4:46 pm

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.

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Wed Apr 15, 2009 6:22 pm

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.
Last edited by mickagame on Thu Apr 16, 2009 4:13 pm, edited 1 time in total.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Apr 16, 2009 8:28 am

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

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Thu Apr 16, 2009 8:33 am

Would be interesting if someone can confirm ...

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Thu Apr 16, 2009 4:02 pm

mickagame wrote:Would be interesting if someone can confirm ...
It doesn't happen on real hardware.

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Thu Apr 16, 2009 4:15 pm

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?

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Thu Apr 16, 2009 6:00 pm

Here is a video of Sonic 2 2 player mode. I can't see the bug. Thanks to Puto for the video ;) .

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Apr 16, 2009 8:08 pm

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

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Thu Apr 16, 2009 9:40 pm

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?

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Fri Apr 17, 2009 7:29 am

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

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Fri Apr 17, 2009 7:35 am

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.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Fri Apr 17, 2009 9:41 am

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)

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Fri Apr 17, 2009 10:27 am

This would confirm that all register modification takes effect only next "column" :-)

Post Reply