CSpect vsync

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

howprice
Posts: 3
Joined: Sun Sep 27, 2020 8:17 pm

CSpect vsync

Postby howprice » Tue Oct 27, 2020 8:53 am

CSpect vsync

I am having trouble getting a smooth frame update rate with CSpect (V2.12.36).

I have written a simple assembly language program that moves sprites from left-to-right the screen 1 pixel per frame, but I can't get it to run smoothly under CSpect. The sprites seem to move smoothly for several frames, then slow down for several frames. This results in a pulse-like motion. Please see attached repro containing .nex and source.

As per the CSpectReadme.txt I am disabling sound with the -sound command line option to try to smooth things out, but it always end up with a pulse-like jerky frame rate. I have tried all combinations of -60 -vsync along with -sound

CSpect.exe -zxnext -sound -w3 -r -tv AnimatedSprite.nex ; Oscillates between smooth and slow (about 1 second) and fast and jerky (about 2 seconds)
CSpect.exe -zxnext -sound -vsync -w3 -r -tv AnimatedSprite.nex ; Similar to above with more irregular oscillation
CSpect.exe -zxnext -sound -60 -w3 -r -tv AnimatedSprite.nex ; Mainly slow, with fast bursts
CSpect.exe -zxnext -sound -vsync -60 -w3 -r -tv AnimatedSprite.nex ; Similar to above

Unfortunately, I don't have access to real hardware to test this program works as expected outside of emuation.

I tried running the CSpect beast.nex sample out-of-the-box and it looks to be a bit jerky too.

Is this a known issue, or is there a way to fully vsync CSpect so it runs exactly one frame of emulation per host PC display refresh cycle?

Intel i7 PC is connected to a monitor with a refresh rate of 60Hz

Many thanks for any advice.
Attachments
cspect-jerky-repro.7z
(12.08 KiB) Downloaded 97 times

Ped7g
Posts: 256
Joined: Mon Jul 16, 2018 7:11 pm

Re: CSpect vsync

Postby Ped7g » Wed Oct 28, 2020 7:27 am

I have 60Hz display on notebook, so the 50Hz classic ZX is obviously slightly jerky and your NEX file running at 50Hz looks just like I would expect.

But when running with -60, it gets illogically jerky quite a bit on my notebook... but I'm running it in linux through mono with Intel integrated graphics card, so I guess there are too many weak spots where this may be failing to sync 1:1 with my display.

Overall it never occurred to me to expect the emulator to be this level of smooth, I'm glad it even [mostly] works, especially at 28MHz with multiple layers the CSpect does perform really well (compared to ZEsarUX, although lately after testing ZEsarUX at Ryzen 7 notebook with abundance of power I have new suspicion there's some extra bug in ZEs making it more jerky than it has to be, because the difference between 14MHz and 28MHz mode feels wrong, the PC seems to have enough leeway even at 28, but the emulators get really jerky, way beyond what I'm observing with your demo and CSpect at 60Hz).

Unfortunately I'm currently on the road so I can't try on real Next for you, but I'm 99.9% sure your code is correct and the real Next would be silky smooth, it's always like this, especially with 50Hz Next modes, the real thing is just solid as rock, while emulators never feel completely right. I wouldn't stress myself over that too much, the emulators have also other bugs in emulation which will derail development more, if you are not aware of them or testing with real HW from time to time.

seedy1812
Posts: 91
Joined: Tue May 30, 2017 11:31 am

Re: CSpect vsync

Postby seedy1812 » Wed Oct 28, 2020 9:01 am

Your code runs fine on real hardware :) I have seen it glitch on CSpect but for me 99.9% of the time its fine ( CSpect2_12_36)

howprice
Posts: 3
Joined: Sun Sep 27, 2020 8:17 pm

Re: CSpect vsync

Postby howprice » Wed Oct 28, 2020 6:45 pm

@Pad7g Thanks very much Yes I'm glad the emulator works as well as it does. I guess I was expecting 60Hz mode to just lock with my display. I'll look forward to receiving the real hardware next year.

@seedy1812 Thanks for testing it out. Very jealous. Are you saying that the animation in CSpect is smooth for you 99.9% of the time? I've tried on both my desktop and laptop and it is very offputting on both. I have a simple game up and running and unfortunatley it's not much fun to play in the emulator for me.

seedy1812
Posts: 91
Joined: Tue May 30, 2017 11:31 am

Re: CSpect vsync

Postby seedy1812 » Mon Nov 02, 2020 1:01 pm

Saying you have an i7 is like me asking how much sugar there is in this bottle cola i am drinking - its Coke but how big is it , is it diet etc.

I was running your program on my home PC which is a 6 core ( 12 thread ) with a base speed of 3.5 ghz running at 2.84Ghz with 32 gig of memory yet my works PC i7 is 8 core ( 16 threads ) 3.6GHz running at 4.7 Ghz with 64 gig of memory.

I would expect your laptop not to run it as smoothly as your desktop PC . What specs are your PC's ?

User avatar
sol_hsa
Posts: 273
Joined: Fri Jun 02, 2017 10:10 am
Location: Finland
Contact:

Re: CSpect vsync

Postby sol_hsa » Mon Nov 02, 2020 8:03 pm

When emulating stuff, threads don't usually matter much, because it's pretty difficult to offload the tasks to several threads.

What you're looking for are cpu single thread perf and pipeline length, as emulators tend to trash the pipeline a lot (so, a p4 would be worse than p3, as unintuitive as it is, because p4 had a very, very long pipeline).

howprice
Posts: 3
Joined: Sun Sep 27, 2020 8:17 pm

Re: CSpect vsync

Postby howprice » Sun Nov 15, 2020 1:40 pm

I've been keeping an eye on this since I last posted and I have noticed that on my laptop the slowdowns only happen when it is plugged in. When the laptop is not plugged in, and running off the battery, the frame rate is almost smooth, with only occasional small stutters.

The laptop is a Dell XPS 9350, Intel Core i7-6560U CPU @2.20GHz, 16GB RAM running Windows 10.


Who is online

Users browsing this forum: No registered users and 6 guests