Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video updating is not synchronized with 9900 #3

Closed
eswartz opened this issue Jul 5, 2015 · 4 comments
Closed

Video updating is not synchronized with 9900 #3

eswartz opened this issue Jul 5, 2015 · 4 comments

Comments

@eswartz
Copy link
Owner

eswartz commented Jul 5, 2015

V9t9 video updating is being done at times and rates totally different from what the emulated machine expects, so effects like scrolling can become obvious in V9t9. These updates should track the emulated VDP interrupt instead.

From @endlos99 's report in #2:

"Well, what is "smooth"? To me, it feels choppy in that the Parsec ship jumps and/or keeps moving after I release the key, and the landscape scrolling looks "wobbly", i.e., the scenery often grows and shrinks during scrolling -- not very profound, but noticeable. There are no such effects in MESS."

From me:

I agree about the landscape choppiness. V9t9 tries to avoid eating up CPU by making video updates to the entire screen according to arbitrary host CPU timing, whereas a game like Parsec assumes the video is being updated row-by-row at a given rate and the top row starts being updated in lockstep with the video interrupt, thus giving it time to scroll the landscape "before" the monitor shows the changes. I think MESS tries the row-by-row approach, but it's much more CPU-intensive, and my goal (as you've noticed) is that an emulator asking like an ancient machine will actually use less CPU than a modern machine. ;)

That's just a long-winded way to say, I guess I need to pay some more attention to doing that video synchronization more correctly.

@eswartz
Copy link
Owner Author

eswartz commented Jul 5, 2015

Part of this was due to the aforementioned missynchronization between video updates and emulated VDP interrupts. Once I got all that in line, though, I see that Parsec can't possibly do all these updates in 1/60 s anyway, so my changes won't actually result in seamless scrolling.

The choppiness is actually caused by the attempt to keep the emulated CPU executing at a consistent rate. For some reason a while ago I decided to switch the implementation of how this was done to use semaphores instead of a sleep, but this appears to degrades the client performance in this choppy way. I will try switching that back.

@eswartz
Copy link
Owner Author

eswartz commented Jul 6, 2015

OK, I remembered that the use of a Semaphore was needed to get cassette reading/writing to work properly. And that code is not actually responsible for this behavior.

BTW, I was able to reproduce the same jumpy scrolling even in v9t9 v6.0 for DOS. So it's not a new bug.

Instead, it seems Parsec cannot by design actually scroll the landscape in a smooth way. The code is not at all bound to a timer (e.g. the VDP interrupt). If I change the CPU speed (lower-left menu) then everything goes faster, proving this point. Given this, it seems that either the Parsec code was tightly tuned to exact TI-99/4A instruction, memory, VDP redraw, and clock timings to give the appearance of never scrolling inconsistently -- which seems unlikely, since the redraw loop has interrupts enabled, which would defeat such an optimization -- or, MESS is doing something to compensate for this.

I will publish a fix for the video updating, though, to have redraws that are less likely to introduce "tears" if code is actually synced to the VDP interrupt.

@eswartz eswartz closed this as completed Jul 6, 2015
@eswartz
Copy link
Owner Author

eswartz commented Jul 6, 2015

Will leave this open until a release...

@eswartz eswartz reopened this Jul 6, 2015
eswartz added a commit that referenced this issue Jul 6, 2015
@eswartz
Copy link
Owner Author

eswartz commented Jul 21, 2015

Fixed in 2015/07/21 release.

@eswartz eswartz closed this as completed Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant