Page 1 of 1

Y U confuse me about VSync

Posted: Thu Oct 17, 2013 3:03 pm
by r57shell
VSync for me... it is such point in time, when you can do things invisible.
So, it is time, when you need to make fast changes on screen, and after such changes, you can do long calculations.

For example, WAIT_VSYNC in DirectDraw means wait period when you can fast blit screen, and it will be invisible.

So, this period is VBLANK. And for me, VDP_waitVSync() must wait VBLANK.
But in code in SGDK... I see opposite. It's wait for VBLANK OFF.

It is your sgdk, so do what you wanna do. Bug in my code is found.

Posted: Thu Oct 17, 2013 5:29 pm
by Stef
I think you get it wrong, this is the code of the wait_VSync():

Code: Select all

    while (*pw & VDP_VBLANK_FLAG);
    while (!(*pw & VDP_VBLANK_FLAG));
Actually the first line is here in case you were already in VBlank when you called the method. What it does is that it actually wait until the end of VBlank then the second line is actually waiting until active period end and so you are sure to have a complete VBlank period when the method bring hand back to you.
waitVSync() is a very primitive method, i guess having it wrong in SGDK would end in many troubles in SGDK based codes (even in the SGDK samples) !

Posted: Thu Oct 17, 2013 5:46 pm
by r57shell
my bad. such a shame :).
remove thread, don't confuse anyone else :D.
I found another bug.
I'm making test rom, for testing vdp emulation and for hardware research, because noone has answers for my questions :).

Posted: Fri Oct 18, 2013 10:21 pm
by r57shell
Offtop: why joytest sample does not working under Exodus? :S

Posted: Fri Oct 18, 2013 10:53 pm
by Stef
The last time i tested it on real hardware it was working but i may have broken something :-/ Need to test that.