New info!
Using
MIDIbox Quad Genesis and the test modes, I have confirmed the internal order of calculation of operators and channels.
These tests were performed on hardware (DIP) YM3438s, which is what I have in my synth. You may say this isn't helpful, as this is neither YM2612 nor whatever's in the VDP. But I haven't found any differences between the YM3438 and what's described here for the YM2612, even on undocumented features like the test bits and SSG-EG mode.
The tests were performed as follows:
- Turn on read data mode ($21:6 = 1).
- Select MSB or LSB of read data ($21:7 = 0 for MSB, 1 for LSB--this may be new information)
- Select the signal that appears on bit 14 of the output ($21:0, and it does seem to make a difference, but I still don't know what the two signals are)
- Select whether to read operator or channel outputs ($2C:4 = 0 for operators, 1 for channels)
- Set up to read data from the OPN2 (as if checking whether it's busy). Every OPN2 internal clock cycle, capture a new byte from the bus, for 24 cycles.
- Print the 24 bytes from the synth to a terminal.
The data format is:
Code: Select all
Channel output:
(MSB) SX00000C CCCCCCCC (LSB)
Operator output:
(MSB) SXPPPPPP PPPPPPPP (LSB)
where S is the SYNC signal (see below),
X is the unknown signal selected with $21:0,
C is the 9-bit channel output,
P is the 14-bit operator output
(I just stuck with reading the MSB all the time, since the LSB doesn't have any timing information so you just get random values. In the case of channel outputs, at least you get one bit of it, so the value is negative half the time and you can see where the 1s are.)
I was hoping/expecting that bit 15 (S) would be some sort of sync pulse so I could see where the beginning of the cycle was (and therefore be able to identify every byte subsequently). The results were close to this, but a little confusing.
Code: Select all
Operator output:
111111111100000000000000
Channel output:
111110111000000000000000
Just resetting the chip and setting up the test mode results in each of those patterns on the S signal for the 24 cycles. (Of course, in testing the pattern starts at an arbitrary place in the 24 captured bytes, and wraps around, since I have no idea when in the cycle I start capturing). In addition, during or after playing a note on any channel but channel 4, these patterns are maintained. However, as soon as a single operator of channel 4 starts playing, the S signal changes, and it doesn't change back to this pattern even after the note is keyed off and dies out completely. The new S signal looks like the old one, but with random bits among the first 10 bits, and then all zeros for the remaining 14. Frequently there's only three or four 1s, and they're often spaced out, but they never span more than 10 bits. So it looks like there's some sort of internal sync signal here, which is getting logical-ANDed with some other signal dependent on channel 4. I have NO idea what this is all about--I will do my best to trace this signal on the die.
So the S signal can be used as a sync pulse assuming you never played anything on channel 4. Based on that, I could always align the results, and so I measured all the other operators on the other channels, and filled in the blanks according to the pattern for where channel 4 must be (since I couldn't measure it). (For clarity, operator numbers are the ones from the OPNA datasheet, not the Sega docs. The numbering is such that in algorithm 0, the four operators modulate each other in the order 1->2->3->4, and the registers are in the order 1-3-2-4.)
Code: Select all
Operator output:
S 111111111100000000000000
Ch 456123456123456123456123
Op 444111111333333222222444
Channel output:
S 111110111000000000000000
Ch 226666444411115555333322
or if the S signal should actually be one more step right
S 011111011100000000000000
Ch 222666644441111555533332
(though from some attempts at measuring channel 4 output, I believe it's probably the first one)
So, in English: for operator processing, it's in the order 1324, with all channels' same operator processed next to each other, and the channels in the order 123456. This makes the most sense, and matches the registers, but it had to be confirmed. For channel output, it's in the order 153264 (which was found earlier by someone else by measuring the output with a scope).
There's more work for me to do here, but I figured I'd post what I've found so far.