This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

My game's music skips a frame in Nestopia

My game's music skips a frame in Nestopia
by on (#40129)
Several seconds after starting my game, there's a single frame where the music seems to pop/skip. I've run the game on Nestopia, Nintendulator and FCEU, but the anomaly only crops up on Nestopia.

According to the wiki, reading PPUSTATUS at the exact start of NMI can cause the program to lose frames, but AFAIK I'm not doing that.

...Or am I?

Sorry I don't have more detailed info than that. Any ideas?

by on (#40130)
Quote:
...Or am I?

Well, usually you don't read $2002 in the main programm except when waiting for sprite zero hits, and when you do that you know a VBlank isn't going to be triggered. So I guess you aren't, but I can't guarantee that.

Are you sure your emulator runs at full speed ? This may simply be due to lag if your computer isn't powerfull enough, altough it's not likely that it will happen at a predictable time.

You also should make sure you (or the music engine you use) don't assume any values in RAM. Usually you'd want to clear $000-$7ff with zeroes manually. Nestopia is one of the only emulators to fill the RAM with garbage instead of full clean $00s.

by on (#40133)
Bregalad wrote:
Are you sure your emulator runs at full speed ? This may simply be due to lag if your computer isn't powerfull enough, altough it's not likely that it will happen at a predictable time.

At first I thought it might be lag, but the skip always occurs at the same time on my computer, regardless of whether or not other programs are running in the background.


Bregalad wrote:
You also should make sure you (or the music engine you use) don't assume any values in RAM. Usually you'd want to clear $000-$7ff with zeroes manually. Nestopia is one of the only emulators to fill the RAM with garbage instead of full clean $00s.

I clear out $000-$7ff with zeroes in the reset handler, except for sprite OAM, which I fill with $fe.

by on (#40150)
I get occasional single-frame lags in Nestopia all the time, in every game, probably as a result of it running slightly slower than my screen's refresh rate. The easiest way to see if it's emulator-related (if your computer's fast enough) is to turn on the NTSC filter, disable field merging, enable Vsync, and make sure you're running a 60Hz video mode. If the NTSC flickering "hiccups" at the same time your sound lags, then it's an emulator issue.

Another thing you could do is put a sprite somewhere onscreen that alternates between black and white each frame. That would be easier to catch than an NTSC hiccup.