I tought my sweep unit was ok, but after testing "Excitebike" in a real NES when the bike "jumps" a platform and use sweep unit my emulator is not correctly emulating it.
I can only assume that your problem is that it doesn't sound quite right - assuming that the "add" parameter is to handle the difference between the two sweep units (i.e. where one uses two's complement negation while the other uses one's complement negation), you should only be including that when subtracting, NOT when adding.
If that isn't the problem, then you need to provide more information.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
if (Apu.Square.Len.counter && Apu.Square.Sweep.dac && Apu.Square.Duty.dac)
if (Apu.Square.Env.env_disable)
out += Apu.Square.Env.env_volume;
else
out += Apu.Square.Env.out;
if (Apu.Square.Len.counter && Apu.Square.Sweep.dac && Apu.Square.Duty.dac)
if (Apu.Square.Env.env_disable)
out += Apu.Square.Env.env_volume;
else
out += Apu.Square.Env.out;
isn't that correct?
I don't think so...the DAC value isn't an "input" to whether or not the channel is silenced, if I recall.