SourMesen / Mesen-S

Mesen-S is a cross-platform (Windows & Linux) SNES emulator built in C++ and C#
GNU General Public License v3.0
415 stars 100 forks source link

GB: square channels missing duty position advance on NRx3/NRx4 writes #143

Open redacted173 opened 4 years ago

redacted173 commented 4 years ago

The duty position, _state.DutyPos, should be advanced by 1 when NRx3/NRx4 are written to update frequency under some conditions. This temporarily increases the frequency which causes a ringing effect during the timer countdown in Super Mario Land after finishing a level. Other games use this, too.

https://github.com/SourMesen/Mesen-S/blob/master/Core/GbSquareChannel.cpp#L194

redacted173 commented 4 years ago

Also, r-type 1 (GB, not GBC) doesn't initialize WAV RAM before using it. The power-on value is something other than $00's. Some sensible values depending on what you are trying to model should be used out of reset.

SourMesen commented 4 years ago

Thanks for the information/reports! Improving the APU's accuracy is one of the next things I'm planning on working on, so this is very helpful.