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

OPN: fixed behavior of F-Num2(registers 0xa4,0xac) #29

Closed hyano closed 2 years ago

hyano commented 2 years ago

This patch fixes the behavior of registers A4-A6h and AC-AEh in OPN. In real chip, there is one latch for each of A4-A6h and AC-AEh.

In some games, if this behavior is not reproduced, a bug in the sound driver causes incorrect pitch.

Although this patch is little bit redundant, it uses unused registers for latching as same as the original implementation. Please modify, if you have better idea.

aaronsgiles commented 2 years ago

Thanks for this PR. Can you point me to some examples I can look at to see this behavior?

hyano commented 2 years ago

@aaronsgiles Thanks for your reply.

I know "The Castle" for PC-8801mkIISR (Japanese retro PC) is one of the examples which has a potential bug in sound driver. It uses register A4h for all FM channels by BUG.

Sound pitch is not corrupted on the real PC88. But on the emulator which doesn't emulate the behavior this PR mentions, pitch becomes incorrect. I think major FM sound engines including fm.c support this.

hyano commented 2 years ago

Attach is a vgm file of "The Castle" for PC-88. thecastle_vgm.zip You can check ths sound with it.

And, you can compare with the following captured video from real HW. https://www.youtube.com/watch?v=i6UmloQvhRQ

Other references:

aaronsgiles commented 2 years ago

Ok, thank you for the documentation and VGM example. I think this fix is good.