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
121 stars 22 forks source link

Why does jt10_acc.v discard FM data for channels 0 and 4? #74

Open kunichiko opened 1 year ago

kunichiko commented 1 year ago

I used this core in 6-channel mode (by setting .num_ch(6)), but I noticed that the sound of some channels was slightly different from the real chip.

Upon further investigation, I came across the following comment:

https://github.com/jotego/jt12/blob/42b19189044e079a9d93a9d728f67e64fbd0326f/hdl/jt10_acc.v#L78

At this line, there is a comment stating uses channels 0 and 4 for ADPCM data, throwing away FM data for those channels.

However, I wanted to utilize all 6 FM channels, so I commented out lines 82 to 103, and it seems to be working fine now.

Could you please explain why jt10_acc.v discards some FM data?"

jotego commented 1 year ago

As the comment says, the original Yamaha chip did that. I am not sure about YM2608 you're looking at. Maybe that one used all six channels. Review carefully Yamaha's documentation before assuming the behavior was different.

kunichiko commented 1 year ago

@jotego Thank you for your response.

I've reviewed the comment written in the source code, but I couldn't find any reference to that behavior in the YM2610 application manual. Could you kindly provide the source of your information?

Additionally, I believe your intention is that the jt10 acts as a YM2610, not a YM2610B. It's worth noting that the YM2610 has four FM channels, while the YM2610B has six.

Based on my understanding, I would like to propose the following idea:

When the parameter .num_ch(4) is passed, it should function as a YM2610. When the parameter .num_ch(6) is passed, it should function as a YM2610B.

Please let me know your thoughts on this suggestion.

kunichiko commented 1 year ago

To organize my thoughts, I have created the following table for the DT/MULTI register:

Port0 (A1=0)
        Jt12      YM2610    YM2610B(YM2608)
REG$30  op0:ch0   N/A       OP1:CH1
REG$31  op0:ch1   OP1:CH1   OP1:CH2
REG$32  op0:ch2   OP1:CH2   OP1:CH3
REG$33  N/A       N/A       N/A
REG$34  op2:ch0   N/A       OP3:CH1
REG$35  op2:ch1   OP3:CH1   OP3:CH2
REG$36  op2:ch2   OP3:CH2   OP3:CH3
REG$37  N/A       N/A       N/A
REG$38  op1:ch0   N/A       OP2:CH1
REG$39  op1:ch1   OP2:CH1   OP2:CH2
REG$3A  op1:ch2   OP2:CH2   OP2:CH3
REG$3B  N/A       N/A       N/A
REG$3C  op3:ch0   N/A       OP2:CH1
REG$3D  op3:ch1   OP4:CH1   OP4:CH2
REG$3E  op3:ch2   OP4:CH2   OP4:CH3
REG$3F  N/A       N/A       N/A
Port1 (A1=1)
        Jt12      YM2610    YM2610B(YM2608)
REG$30  op0:ch4   N/A       OP1:CH4
REG$31  op0:ch5   OP1:CH3   OP1:CH5
REG$32  op0:ch6   OP1:CH4   OP1:CH6
REG$33  N/A       N/A       N/A
REG$34  op2:ch4   N/A       OP3:CH4
REG$35  op2:ch5   OP3:CH3   OP3:CH5
REG$36  op2:ch6   OP3:CH4   OP3:CH6
REG$37  N/A       N/A       N/A
REG$38  op1:ch4   N/A       OP2:CH4
REG$39  op1:ch5   OP2:CH3   OP2:CH5
REG$3A  op1:ch6   OP2:CH4   OP2:CH6
REG$3B  N/A       N/A       N/A
REG$3C  op3:ch4   N/A       OP2:CH4
REG$3D  op3:ch5   OP4:CH3   OP4:CH5
REG$3E  op3:ch6   OP4:CH4   OP4:CH6
REG$3F  N/A       N/A       N/A

This is an example of the table for the DT/MULTI register, and there are other similar registers like that.

Regarding the current implementation, the case statement you wrote discards FM data only at op0:ch0 and op0:ch4. Therefore, I believe the other operators of ch0 and ch4 are still valid (e.g., op1:ch0, op2:ch4, etc.).

Therefore when I use all of the six FM channels, YM2608(YM2610B)'s CH1 and CH4 produces odd sound.