aaronsgiles / ymfm

BSD-licensed Yamaha FM sound cores (OPM, OPN, OPL, and others)
BSD 3-Clause "New" or "Revised" License
259 stars 40 forks source link

YM2151 Timer B information #24

Closed ghost closed 2 years ago

ghost commented 2 years ago

Not sure where to put this, but there were some comments on Mametesters regarding slow music in some Konami games, and how the FPGA implementations dealt with that.

https://mametesters.org/view.php?id=8146

I encountered this slow music bug on a number of Konami games even when attempting to get both Iron Horse (which uses the YM2203 rather than the YM2151) and Jackal working on an FPGA. It seems the origin of this issue is an error in the timer behavior of both OPM and OPN family FM chips. With the YM2151, it's specifically timer B which appears to have an issue as the lower 4 bits are supposed to be free-running. If these bits aren't free-running in MAME, it's likely the root cause of slow music in a number of Konami games with the YM2151. For reference, Jose Tejada's JT51 is what I used for Jackal and this is how the timers are modeled after being fixed to correct the slow music problem: https://github.com/jotego/jt51/blob/master/hdl/jt51_timers.v He also has his own FPGA clone of Contra which has the correct music speed after this fix. Hope this helps.

gzaffin commented 2 years ago

I read somewhere about Yamaha YM2151 (OPM) and brother Yamaha YM2164 (OPP) regarding timer B, for instance here . Maybe it is matter of re-checking whichever of these two behaviours should be implemented.

aaronsgiles commented 2 years ago

Attempted a fix in the MAME copy of this library to see if it lines up better: https://github.com/mamedev/mame/pull/8988 WIll wait on feedback there before including it in ymfm.

aaronsgiles commented 2 years ago

Ok, fix in the MAME side seems to indicate it is working. Commit bb59eb042d6455dc6de31bfa01e7f2e50df2eb94 should take care of it here.