I investigated why Macro Leal’s Pac-Man port for the Spectrum caused problems with my Pico ZX Spectrum project, and how emulator timing affected its display. The experiment exposed a tradeoff between running the emulator fast enough and preserving the timing Pac-Man expects. This connects to my broader emulator performance work.
I ran the experiment to understand exactly what the great Pac-Man port for the Spectrum by Macro Leal was doing exactly, because it created problems with my Pico ZX Spectrum project.
To run @FlohOfWoe’s emulator fast enough on the Spectrum, I changed z80.h to make it no longer cycle accurate, gaining “2x speed improvement more or less.” This compromise required changing the scaline period.
After the timing and emulation changes, Pac-Man flickered in a very odd way, while the other games still worked more or less fine, although some game timing might differ.
I said, “I'm still calling the vertical blank interrupt,” while the Pac-Man flicker remained unexplained.
Pac-Man updates sprite positions on vblank and starts counting so it can begin deleting old sprites near the end lines, before the interrupt is called.
I said that, in this rare case alongside demoscene work, cycle accuracy is wanted: the time to refresh the screen should match a given number of clock or specific sequence of instructions timings.
I said, “I will fix it with an hack,” but did not describe the implementation.
I compared that timing-sensitive case with Jetpac’s different screen-update strategy. It is a useful contrast to the timing and rendering behavior I explored in spectrum video and raster rendering and the broader accuracy tradeoffs in emulator speed and accuracy tradeoffs.
I considered Jetpac’s approach more elegant: it updates the screen without trying to sync with the CRT refresh.
I praised Jetpac’s in-place sprite update because it updates one row after the other.
This example leaves my earlier point intact: cycle accuracy can matter for cases such as demoscene work, even though Jetpac shows a screen-update method that does not synchronize with the CRT refresh.