APU bug - SMB coin box "po-ling"

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
APU bug - SMB coin box "po-ling"
by on (#242912)
Hi guys,

I still have a bug in my APU, and don't know what the culprit is. In SMB, when hitting a coin box, it's only a single sound, decreasing in volume. Not the Po-Ling it should be. Apparently, it is supposed to have T=104 for a short amount, then T=78 for the longer phase of the 'pling'. I only get the T=104 value, but never change to T=78. Mesens APU debugger suggests that the T=78 is not set by length counter, nor by sweep?! :\

I don't have IRQ implemented yet, but (again) Mesen APU debugger tells me it's not used. Maybe there is something else I forgot to implement?

It would be great if someone could give me a hint where to search!

Thanks!
Re: APU bug - SMB coin box "po-ling"
by on (#242913)
Are writes to the period/frequency taking effect immediately? They should.

If you're holding the low bits write ($4002) in a buffer waiting for a write to the high bits ($4003) to complete the period, don't do that. The low bits take effect as soon as they are written.

Most games will only write the high bits of period at the start of the note, or maybe even only when they change. Mostly that's to avoid the sudden phase reset it causes, which creates a nasty pop when used in the middle of a tone.
Re: APU bug - SMB coin box "po-ling"
by on (#242914)
That was it! Very precise suggestion, awesome, thank you so much! :)

I thought this is going to take me ages, but now it finally sounds just like the original :)