jotego / jt12

FM sound source written in Verilog, fully compatible with YM2612, YM3438 (JT12), YM2203 (JT03) and YM2610 (JT10)
GNU General Public License v3.0
120 stars 22 forks source link

Change clr_flag to not mute adpcm channels. #67

Closed greyrogue closed 2 years ago

greyrogue commented 2 years ago

This change assumes that this line from neogeodev is incorrect: "Flags must be manually cleared, playing a new sample on the channel won't clear it and the channel will stay silent." In the third party source ymfm_opn used in MAME, the last phrase ("and the channel will stay silent") is not implemented. This change attempts to match the behavior of ymfm_opn.

greyrogue commented 2 years ago

This change appears to fix stereo in the Neo Geo core for Xeno Crisis.

greyrogue commented 2 years ago

Oh. I may not have started from latest with this change. The changes in jt12_top and jt12_mmr look like they accidentally undid some changes. The changes should have only been these: https://github.com/MiSTer-devel/NeoGeo_MiSTer/commit/9021bfc15c0e5a411f84874a88fd19ee250302be

jotego commented 2 years ago

Why do you register flag_mask instead of just using ~flag_ctl instead? I think it will be cleared not to produce a new signal. It would also be cleaner not to make operations on port assignments (ie only connect signals).

Did you try this with several games? It's common to fix one thing here and break another there, as you know.

greyrogue commented 2 years ago

The separate values for flag_mask and flag_ctl are too match the behavior of ymfm_opn, which goes flag_mask can always be read high once it's triggered until it's cleared by the Z80, unlike the flag_ctl, which is only a trigger. At least, that's how I understand the code in ymfm_opn.

It might be possible to write a simple program to test if ADPCMB samples are played if the flag isn't cleared first to verify this behavior.

I've tried this change with all the games I've had issues with before, and none of them seem to have regressions.

jotego commented 2 years ago

Thank you