# Notes on SpritesMind thread 386, part 2 (posts p6288 to p8556, 2008-09-20 to 2009-04-19) Source: `reference/scratch/t386-part2.txt` (pages t386-180 to t386-450), every line read. Post URL form: https://gendev.spritesmind.net/forum/viewtopic.php?p=NNNN#pNNNN (thread t=386). Only what the posts say. "How known" uses: measured on hardware / from manual / from emulator X / die analysis / speculation. Code blocks marked VERBATIM were copied mechanically from the text file (Nemesis's own emulator code and formulas, which he presents as his results). Most of this part is discussion of recordings and console revisions. The solid material is: p7967 (Nemesis, 2009-02-22: envelope generator and SSG-EG corrections, INT line, CSM), p7512 to p7537 (Nemesis, 2009-02-01: multiplexed output, oscilloscope), p7673/p7733 (address latch), p7490 (LFO frozen, still applied), p8025/p8032/p8037 (SSG-EG reasoning), p8406/p8447 (YM3438 application manual found). --------------------------------------------------------------------------------------------- ## 1. Register map / bus interface 1.1 **One address latch for both parts, storing 9 bits (address + part).** p7673, Nemesis, 2009-02-04. Measured on hardware (his test; console not named in this post; p7733, 2009-02-09: "I have now. The behaviour is the same on both" MD1 and MD2). - "not only do parts 1 and 2 not have a separate address register, they don't even have a separate data port." - "writing to an address register stores both the written address, and the part number of the address register you wrote to. You can then write to either the data port at $A00001, or the data port at $A00003, and the write will go to the register number you wrote, within the part of the address register you wrote to. This means you can, for example, write an address to $A00000, then write the data to $A00003, and the data will in fact be written to the part 1 register block, not the part 2 register block." - "Writing to the address register stores 9 bits of data, indicating both the target register address, and the part number." - (Nemesis writes $A00000..$A00003; HardWareMan p7704 and Snake p7719 note the real addresses are $A04000..$A04003.) - Snake p7696: "I knew the address register thing, but I never tried the data port thing." 1.2 **Reading any of the four ports gives status.** p7719, Snake, 2009-02-08. Stated from memory, no test given: "As is probably well known, reading any of the ports will give you the YM status - but there was a 32X bulletin that warned you not to do that because it causes weird bus timing problems." 1.3 **Upper 4 bits of the SSG-EG registers do nothing.** p8037, Nemesis, 2009-02-27. Measured on hardware (test ROMs with an incrementing counter left recording "over a day once", plus specific tests forcing all upper bits set): "I can quite confidently say they do absolutely nothing." Snake p8034 believed the same. 1.4 **Register changes take effect immediately** (see 3.5): TL, Detune, Multiple, Key Scale, AMS, PMS, Left/Right, Block, Fnum, rates, SL, SSG-EG. p7967. --------------------------------------------------------------------------------------------- ## 2. Phase generator 2.1 **Phase counter reset to 0 on key-on.** p7967 item 4, Nemesis, 2009-02-22. Measured on hardware (his re-test). "when key-on occurs, the internal phase counter in the phase generator is reset to 0. This of course also includes key-on events triggered by CSM mode." 2.2 **Phase counter held at 0 in SSG-EG** when SSG-EG enabled, HLD=0 and ALT=0, and internal attenuation >= 0x200 (patterns 08 and 0C). Really held, not just set once. p7967. Measured on hardware. See the verbatim code in section 4. 2.3 **Phase increment / detune underflow ("detune bug", Battletech track 12, Comix Zone track 5).** Only emulator talk in this part: - p6448 AamirM: made the phase increment 17-bit, did not fix Battletech track 12. - p6519 Eke (2008-10-10): describes his Genesis Plus change so that a negative increment wraps as 17 bits: "according to what Nemesis found, we indeed got: -1 = 0x1FFFF". From emulator (Genesis Plus GX); the two code lines he quotes were seen, see Slips. - p6594 Eke: both tracks "use the exact same instrument settings, the only difference being the incriminated operator RR & TL values(0x00 in Battletech, 0x0e in Comix Zone)". Not resolved by register width. - p7967 end and p8020 Nemesis: the cause of the different sound of Battletech track 12 between consoles is NOT digital: "The cause of the difference is in the analog domain, and it is triggered by high frequency tones... it's specifically the effect of volume changes on a high frequency tone... The MD2 has an imperfect output which causes these volume changes to produce an audible waveform, when they should in fact not be audible at all." Promised detailed write-up not in this part. - p7998 Snake: his picture gen1-gen2.png: same frequencies on Genesis 1 and 2, different filter ripple; "The 5th note played is, I believe, the one used by Battletech." 2.4 Nemesis p7443 (2009-01-30): "All the stuff I've posted about the phase generator and operator unit stands. The latest information I provided about those areas is all correct to the best of my knowledge." (Those posts are in part 1.) --------------------------------------------------------------------------------------------- ## 3. Envelope generator (non-SSG) — p7967, Nemesis, 2009-02-22 How known: measured on hardware, by digital sampling. "Increased understanding of the phase generator, operator unit, and the test register, now allows me to obtain pure, digital samples of the output data from the envelope generator." Method (p8037): Tototek flash cart; test ROMs dump data to RAM; Pro Action Replay reads RAM back. Audio: E-MU card, recordings at 96 kHz. Main test console (p7492): MD1 "YM2612+SEGA 315-5313, board IC BD M5 PAL VA4". The post is a list of corrections to his earlier description at viewtopic.php?p=5716#5716 (part 1): "Unless I specifically amend or correct a piece of information I provided in my previous description, the previous information still stands." 3.1 **EG update clock.** CORRECTION of his earlier "EG Clock = External Clock / 351" (ratio 1:2.4375): "This information was incorrect. In fact, the envelope generator is updated once every 3 fm update cycles, which was the existing behaviour in the MAME core." (earlier correction at viewtopic.php?p=6224#6224). - p7998 Snake (speculation): "I believe the reason why it's 3 cycles is that the YM2203 updates the envelopes for channel 1 on the first cycle, channel 2 on the second cycle... The YM2612 probably does one channel from each 'half' every cycle." p8020 Nemesis: "You're probably right. I'll do some tests for this." (no result in this part). 3.2 **No output inversion in attack.** CORRECTION: "SSG-EG has an output inversion flag, but it is not shared by the attack phase. The attack phase does not use output inversion, nor does any function of the envelope generator outside of SSG-EG mode." 3.3 **Attack curve.** CORRECTION. Earlier (wrong) formula: ``` operator.attenuation += attenuationIncrement * (((1024 - operator.attenuation) / 16) + 1) ``` Correct formula (verbatim): ``` newAttenuation += (~newAttenuation * attenuationIncrement) >> 4 ``` "This is the same as the existing update calculation used in the MAME core." 3.4 **Key-on resets the phase counter** (see 2.1). 3.5 **When register changes apply.** CORRECTION of "rate stored on entering each phase": "The rate value is calculated each update cycle of the envelope generator. As such, changes to the various rate parameters for an operator, as well as changes to the rate key-scale value, can cause an immediate change in the effective rate for the current phase of the ADSR envelope." "changes to all other parameters for an operator or channel, including TL, Detune, Multiple, Key Scale, AMS, PMS, Left/Right, Block, Fnum, etc, also all take effect immediately." - **SL**: "Changes to SL do take effect immediately, including during the decay phase, but note that once the decay phase of the envelope reaches SL, the transition from decay to sustain is a one-way operation... Once the transition is made from the decay phase to the sustain phase, changes to SL will not have any effect." 3.6 **No clamping to SL; SL values; max increments.** - "The sustain level can only be set in 16 increments of 0x20, from 0x0 to 0x1E0, with the special case that when it is set to max, it is forced to the maximum attenuation level (0x3FF)." - "The decay phase always begins from an attenuation value of 0, since the attack phase does not terminate until this value is reached." - "Without SSG-EG mode active, the largest increment value which can be applied to the attenuation value in a single update cycle is 8." With SSG-EG the multiplier is 4x (not 6x): max step 8*4 = 0x20. - "we have confirmed that the decay phase can be forced to "skip over" SL in both normal and SSG-EG modes. In the case where the decay phase moves past SL, the sustain phase begins on the next cycle, but the attenuation value is not clamped to SL." - Attenuation is 10 bits, 0x000..0x3FF (max attenuation 0x3FF). From 0x3FF an attack at increment 8 takes 10 update steps to reach 0 (stated in 3.8). - p8025: "The decay phases include a limiter on the update step to clamp the maximum attenuation at 0x3FF." No "off" state is needed (Nemesis's view; p8019 Snake: "It's highly probable nothing ever really 'stops'"). 3.7 **Key on/off evaluated every FM update cycle (every sample), not every EG update.** CORRECTION: "key-on changes are processed every fm update cycle. This becomes important when CSM mode is in use, since timer A overflows every fm update cycle." - p8020 Nemesis confirms for Eke that the EG output is computed every sample, so a change of attenuation by key-on with AR 62/63, or a TL write, shows in the next sample even with no EG update due: "Yes. Try using CSM mode with really quick timer periods (IE, one less than minimum) and you'll see this is true for key on/off changes. I can't say I've tested this for TL changes specifically, but I can say it is true for TL anyway, since TL is applied after output inversion, and I confirmed that output inversion happens every sample". 3.8 **Attack with effective rate 62 or 63.** - "With no special case handling, rate values of 62 and 63 would be the same as rate values 60 and 61, namely, there would be an 8x increment value applied to the attack curve update process, and from a starting attenuation level of 0x3FF, it would take 10 update steps to achieve minimum attenuation." - "for the attack phase, there is special case handling to force the attenuation level directly to 0 when the attack phase is entered, if the calculated rate value is 62 or 63. Note that this happens immediately when the key-on event is processed, so it doesn't even have to wait for the next full envelope generator update cycle. This behaviour also occurs when the SSG-EG envelope loops". - **Stall**: "If you begin an attack phase with a slow rate value..., then change the attack rate settings to switch to an effective rate value of 62 or 63 during the attack phase, the attack phase will NOT finish in the next update cycle. In fact, it won't advance at all... The attenuation value will be locked at its current value, and will no longer advance until the attack rate is modified again to something less than 62, at which time, it will resume advancing from its current position, or until key-off occurs." - His emulation: compute effective attack rate on entering attack; if >= 62 force attenuation to 0; in the normal update, if attack rate >= 62 do not advance the attack curve. "This emulates the behaviour of the YM2612, but it probably isn't emulating the exact way this special case behaviour is implemented." - p8010 Eke (from emulator, his own choice): uses the rate-0 (no change) increments when attack rate is 62/63, and jumps to decay on key-on. p8049 Snake (speculation): the rate table "never goes higher than 8, which means an immediate attack is impossible", so it is special-cased; "the attack phase simply doesn't happen at all when the rate is >=62". - p7999 Snake answering Eke (from memory, not a stated test): AR 62/63 → next update uses decay parameters; SL=0 → decay skipped, straight to sustain; both → "level set to zero, followed by sustain". 3.9 **Key-on when the envelope is not at silence**: p7999 Snake (from memory): "Nothing happens, the level continues from where it was." (i.e. attack starts from the current attenuation.) Consistent with Nemesis p8037: keying on an SSG-EG envelope "if the current attenuation level is over 0x200". 3.10 **Rate clamp** from the YM3438 manual (p8447, Paul Jensen translating page 28 / PDF page 30): "'Rate' has a maximum value of 63. When a calculated value is higher than 63, the value becomes 63." and "Rate" = 2R + Rks is how he glosses it — his words: '"Rate" = 2R (for example, the attack rate) * Rks (the key-scaling value)' [sic, he wrote "*"]. From manual. Snake p8469: already known. 3.11 **Order of TL, AM, inversion**: SSG-EG inversion "occurs before TL is added to the output attenuation, and before amplitude modulation is applied." p7967. p8019 Snake: "TL is done independantly of the env anyway". 3.12 Open (Eke p8045, unanswered): fast key-off/key-on at the very start of decay with attenuation still 0 — does the EG restart straight in decay? --------------------------------------------------------------------------------------------- ## 4. SSG-EG — p7967 (Nemesis, 2009-02-22), with p8025, p8032, p8037 How known: measured on hardware ("after a solid month of testing involving hundreds of tests"), digital samples of EG output; recordings from "a PAL MD1600" at 96 kHz. 4.1 **Multiplier is 4x, not 6x**, in decay, sustain AND release. CORRECTION. Wrong: `operator.attenuation += 6 * attenuationIncrement`. Correct: ``` operator.attenuation += 4 * attenuationIncrement ``` "This was the existing update behaviour in MAME, with the exception that MAME did not apply any multiplication factor in the release phase under SSG-EG mode... this 4x multiplication factor should indeed be applied during the release phase under SSG-EG mode". p7672: toggling SSG-EG on/off during release switches at once between normal and accelerated decay: "the SSG-EG enable bit is checked each update cycle to determine whether the attenuation increment value is multiplied." 4.2 **Threshold is 0x200, not 0x3FF.** CORRECTION: "When the internal attenuation level reaches 0x200 under SSG-EG mode, a variety of special operations are performed". 4.3 **Output inversion formula** (verbatim): ``` attenuation = 0x200 - attenuation; attenuation &= 0x3FF; ``` "it's a full, proper two's compliment inversion. The inversion is actually "centered" at 0x200. MAME does the output inversion by performing a simple XOR operation with 0x1FF, which is incorrect. This produces an output which is off by 1... 0x001 should invert to 0x1FF, 0x110 should invert to 0xF0, 0x250 should invert to 0x3B0, etc." 4.4 **Where it runs.** "the envelope generator is updated once for every 3 times the phase generator is updated... its output is used every cycle... this output cycle is where virtually all the SSG-EG processing steps are implemented." Order when an EG update falls on the sample: ``` 1. The SSG-EG output cycle update steps are performed 2. The envelope generator update cycle runs 3. The output from the envelope generator is calculated ``` "Where an envelope generator update cycle doesn't occur on the current output cycle, only steps 1 and 3 occur... In the case where the attenuation level reaches 0x200 in SSG-EG mode, a single output sample is generated at this attenuation level before the envelope loops back to the attack phase." 4.5 **The per-sample SSG-EG step** (VERBATIM, Nemesis's own emulator code, "taken directly from my core"): ``` //If SSG-EG is enabled, and the current internal attenuation level of the //envelope generator is greater than or equal to 0x200, we need to run some //special SSG-EG update steps. Note that hardware tests have proven that //these operations occur each time the output of the envelope generator is //calculated (IE, each sample), not just each time the envelope generator //is updated. The output inversion and phase counter reset steps in particular //are easily measurable, and have been shown to occur each sample. Note that //hardware tests have also shown that this update process occurs before the //normal envelope generator update steps in the case where both run on the //same cycle. This can allow a single sample to be output at an attenuation //level of 0x200 before these update steps are applied. OperatorData* state = &operatorData[channelNo][operatorNo]; if(GetSSGEnabled(channelNo, operatorNo, accessTarget) //SSG-EG mode is enabled && (state->attenuation >= 0x200)) //The internal attenuation value has reached the magic 0x200 threshold { if(GetSSGAlternate(channelNo, operatorNo, accessTarget) //SSG-EG is set to an alternating pattern && (!GetSSGHold(channelNo, operatorNo, accessTarget) || !state->ssgOutputInverted)) //Hold mode is disabled, or the current inversion state matches the initial inversion state at key-on { //Toggle the current inversion state of the envelope generator //output. Note that extensive hardware tests have been performed //on SSG-EG output inversion. This implementation has been shown //to always produce the correct output, even under unusual //circumstances such as when an attack phase is present, and/or //changes are made to the SSG-EG mode at critical points. state->ssgOutputInverted = !state->ssgOutputInverted; //Note that if the hold bit is set, the inversion state is //only toggled if the current inversion state matches the //initial inversion state. Under normal circumstances, this //prevents the inversion state from being toggled more than //once when the hold bit is set. This matches the confirmed //behaviour of the real chip. This behaviour is vital, as the //internal attenuation value finishes on 0x200 after each //decay phase. Without this test, once hold mode begins, the //inversion state would be toggled each sample. Note that the //envelope generator does not maintain a separate flag which //tracks whether the output has been inverted since key-on, //as changes to the SSG-EG mode after key-on can cause the //output to be inverted more than once under hold mode. } if(!GetSSGAlternate(channelNo, operatorNo, accessTarget) && !GetSSGHold(channelNo, operatorNo, accessTarget)) { //Hardware tests have shown that the phase counter is held at 0 //in cases where SSG-EG is enabled, both the hold bit and //alternate bit are unset, and the internal envelope generator //attenuation value is greater than or equal to 0x200. Once any //of these conditions change, the phase counter will resume //counting up from 0. This causes the phase of the output wave //to restart on each repetition of patterns 08 and 0C, which //occurs on the real hardware. Note that the phase counter //really is held at 0, not simply set to 0 at a particular point //in time. This can create silence gaps between repetitions of //the SSG-EG envelope where an attack phase exists. state->phaseCounter = 0; } if(state->phase != OperatorData::ADSR_ATTACK) { if((state->phase != OperatorData::ADSR_RELEASE) && !GetSSGHold(channelNo, operatorNo, accessTarget)) { //If SSG-EG is enabled, we're in either the decay or sustain phase, //and the hold bit is not set, now that we've reached an attenuation //level of 0x200, we need to loop back to the attack phase and begin //the ADSR envelope again. //Switch back to the attack phase SetADSRPhase(channelNo, operatorNo, OperatorData::ADSR_ATTACK); //Note that we've confirmed that the attenuation is not clamped //to 0x200 in SSG-EG mode when the ADSR envelope loops. By //toggling DR during the decay phase, we've proven that the final //attenuation value is allowed to move past 0x200 before looping. //If an attack curve follows, it begins its decay from this final //attenuation value. Don't uncomment the line below, it is //incorrect. It is only provided as an example of what NOT to do. //state->attenuation = 0x200; } else if((state->phase == OperatorData::ADSR_RELEASE) || !(state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) //If the output is not currently inverted { //If the output is not currently inverted, and we've reached an //internal attenuation level of 0x200 in one of the decay phases //(either the decay, sustain, or release phase), but the envelope //is not looping back to the attack phase, we need to force the //internal attenuation value to 0x3FF. This emulates the behaviour //of the YM2612 when entering a low-hold state in SSG-EG mode, and //when the release phase reaches 0x200. In both cases, the internal //attenuation value is forced directly to 0x3FF. This has been //confirmed through hardware tests. Note that this step occurs after //the inversion state has been toggled. Performing these steps the //wrong way around would break SSG-EG pattern 0xB, where both the //hold and alternate bits are set, and the attack bit is clear. //Force the internal attenuation value to 0x3FF state->attenuation = 0x3FF; //Note that this behaviour can be observed when switching from an //inverted hold pattern to a low-hold pattern, then back again after //the hold sequence has begun. When the inverted hold pattern resumes, //the digital output will be 0x001F instead of 0x1FE8, as the internal //attenuation value has been forced from 0x200 to 0x3FF, which becomes //0x201 when it is inverted, outputting a value of 0x001F. This effect //can also be observed when reading the decay sequence under the //release phase when SSG-EG mode is active. With an increment value of //1, the digital output from the operator unit can be observed to jump //directly from 0x0021 to 0, indicating the output attenuation value //from the envelope generator skipped from a known value of 0x1FC from //the decay sequence, to a value greater than 0x33F. } } } ``` 4.6 **EG output calculation** (VERBATIM): ``` //If SSG-EG is enabled and the output is inverted, invert the output data. Note that //extensive testing has been performed on the hardware to build this implementation. //This test is performed exactly as shown each time the attenuation value is used. //Note the way the attack bit is combined with the inversion state. This is known //to be correct, and is essential in order to deal with cases where the SSG-EG state //is changed after key-on. A change in the state of the attack bit will result in an //immediate inversion of the output. Also note the calculation performed to derive //the "inverted" data. This calculation has been proven to be binary-accurate. if(GetSSGEnabled(channelNo, operatorNo, accessTarget) && (state->phase != OperatorData::ADSR_RELEASE) && (state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) { attenuation = 0x200 - attenuation; attenuation &= 0x3FF; } ``` "this code snippet is being performed on a copy of the attenuation value, not the internal attenuation value itself... This inversion of the output also occurs before TL is added to the output attenuation, and before amplitude modulation is applied." 4.7 **Decay/sustain/release update** (VERBATIM): ``` //Advance the linear decay for the decay, sustain, or release phase. Note //that if SSG-EG is enabled for this operator, the decay phase runs at 4x //the normal speed. if(GetSSGEnabled(channelNo, operatorNo, accessTarget)) { //If the current internal attenuation value is below 0x200, advance the //decay phase. In most cases when the attenuation level reaches 0x200, //the envelope will move back to the attack phase, or the attenuation //level will be forced to 0x3FF anyway. One case where neither of these //changes occur, and we need this check here to ensure the attenuation //level isn't permitted to advance any further, is when we enter an //inverted hold phase. Hardware tests have conclusively shown that in //these cases, if the internal attenuation level is greater than or equal //to 0x200, the attenuation level remains unchanged. This is true even in //cases where the internal attenuation level has been offset from a //multiple of 4, and the precise value of 0x200 is skipped over by an //SSG-EG increment. if(newAttenuation < 0x200) { newAttenuation += (int)(4 * attenuationIncrement); } } else { newAttenuation += (int)attenuationIncrement; } ``` 4.8 **On key-off** (VERBATIM): ``` //If SSG-EG is enabled and the output is currently inverted, convert the //current attenuation value into an equivalent non-inverted value. This //emulates the release mode behaviour when SSG-EG is active. Note that we do //not alter the output inversion flag here. Output inversion is ignored //during the release phase. The output inversion flag is cleared when key-on //occurs. if(GetSSGEnabled(channelNo, operatorNo, accessTarget) && (state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) { state->attenuation = Data(attenuationBitCount, 0x200) - state->attenuation; } ``` 4.9 **On key-on** (VERBATIM): ``` //Reset the SSG-EG output inversion flag state->ssgOutputInverted = false; ``` 4.10 **Bit names used**: SSG-EG enabled, Attack (ATT), Alternate (ALT), Hold (HLD). Patterns are referred to by the 4-bit value: 08 and 0C (ALT=0,HLD=0: phase restart each repetition), 0xA and 0xE (ALT=1,HLD=0), 0xB (HLD=1,ALT=1,ATT=0), 0xF with attack (Barcelona Olympics splash). The bit layout itself is in part 1. 4.11 **Consequences stated in prose** - Attack bit: "A change to the attack bit always causes an immediate inversion of the output" (p8025); the flag "tracks whether the output has been inverted from the starting value"; effective inversion test: `(phase != release) && (ATT ^ inversionBit)` (p8025, verbatim). - "Output inversion is always disabled during the release phase"; "toggling the ATT bit during the release phase doesn't cause output inversion to kick in" (p8025). - Not clamped to 0x200 on loop: "By toggling DR during the decay phase, we've proven that the final attenuation value is allowed to move past 0x200 before looping. If an attack curve follows, it begins its decay from this final attenuation value." (code comment) - Digital observations quoted in the comment: after switching inverted-hold → low-hold → back, "the digital output will be 0x001F instead of 0x1FE8, as the internal attenuation value has been forced from 0x200 to 0x3FF, which becomes 0x201 when it is inverted"; in release with SSG-EG and increment 1 "the digital output from the operator unit can be observed to jump directly from 0x0021 to 0, indicating the output attenuation value from the envelope generator skipped from a known value of 0x1FC ... to a value greater than 0x33F." - With AR < 0x1F and a looping pattern (p8037): "the attenuation decays until it reaches 0x200. When this happens, if AR was 0x1F, the attenuation would be forced back to 0. Since this isn't the case, what happens is the attenuation sits on 0x200 until the attack phase advances. When it does advance, it will drop the attenuation to 0x1DF." Samples generated while sitting at 0x200 invert every sample. - Patterns 0x0A and 0x0E with a slow attack (p7967): "The inversion state may toggle between repetitions of the wave. In the "noise spike" between each repetition, the inversion state is actually being toggled each sample, since the internal attenuation level during the slow attack phase remains above 0x200 for an extended period of time... The exact sample on which the attenuation level drops below 0x200 determines what the inversion state is set to for the remainder of that repetition." - At first key-on with AR < 0x1F and attenuation > 0x200 (p8037): toggling each sample; "a "dead patch" ... where the attenuation level is around 0x300, and 0x300 inverted is still 0x300". "This constantly toggling inversion state just after the key-on event is what causes the initial state of the ATT bit to be overridden." - Inversion toggling each sample = a wave at half the sample rate: "The native output of the YM2612 in the Mega Drive is around 52847Hz. With the output being inverted each sample, that creates a wave with a frequency of around 26423.5Hz" (p8032). (PAL console figure.) - Unverifiable on hardware (p8025): whether the invert flag keeps toggling during release, and whether the phase counter is held during release at >= 0x200: "there's no way to verify what the real chip does, it also doesn't matter, since there's no way any of this can have any effect on the output." - Rationale (p8025, speculation): "Sacrificing one bit of resolution from the attenuation value and using the upper bit of the attenuation as a flag for the SSG-EG update steps". - Nemesis's review of Eke's rewrite (p8032): in release with SSG-EG, "the attenuation level is still forced directly to 0x3FF when the release phase reaches 0x200". - Yamaha's documentation says AR must be 0x1F with SSG-EG (p7998 Snake, p8020 Nemesis: "the mandate was to set the attack rate to 0x1F"). Games that break the rule: "Beavis & Butthead chainsaw sound effect, Barcelona Olympics water diving splash sound" (p7967); Barcelona uses "pattern 0xF with attack" (p7672). 4.12 Doubt recorded: Snake (p8019, p8027, p8034) was "not yet convinced" of the per-sample toggle from his own 44.1 kHz samples (thought to be from an MD2, AR=0x0A); Nemesis explained them by the recording rate (p8032, p8037) and Snake accepted the reasoning (p8038) without a re-test. --------------------------------------------------------------------------------------------- ## 5. Operator unit 5.1 **Sine and power (exp) tables** p6741, Nemesis, 2008-11-03, commenting on the OPL2/OPL3 decap article (Matthew Gambrell and Olli Niemitalo, link in section 12). Die analysis of OPL chips by others, compared with his YM2612 measurements: "Those tables they provided confirm a lot about how I believed the operator unit worked internally. Both the sin and pow tables have 256 entries, and the sin table is a perfect match for the data my algorithm generates." "The power table is a little different however. Since the entries in the power table effectively run from 0x7FA-0x400, they didn't need to include bit 10, since it's always fixed to 1, so the entries in the real physical table run from 0x3FA-0x0." yehar (Olli) p6767: "I got the impression that the sine table was sign-inverted, and that the exp table was as expected, the opposite of your analysis." 5.2 **Two operators run in parallel; operator order 1,3,2,4; previous-sample input.** p6289 Eke quoting an earlier post (author not shown in the quote; part 1): "There are two, running in parallel... This is the reason for the 'odd' operator numbering (1,3,2,4) in the registers. It also means that in most algorithms, an operator may need input from another one that's running parallel with it, and thus not ready yet. And so... it uses the previous output of that operator. This is what all the MEM stuff in Mame is all about, and it's correct." From emulator MAME / assertion; no test in this part. 5.3 **Self-feedback averages the last two outputs.** p6288-era quote of Nemesis (in p6289, p6333): "MAME adds the last two samples together to build the self-feedback modulation value. This seems to be correct, but I can't figure out why". Snake p6333: "it's correct", "it's the way Yamaha have always done it". From emulator MAME, endorsed; Nemesis had "not started doing any serious testing of self-feedback" (see the FMDocs file). 5.4 **Carriers per algorithm** p7512, Nemesis: "Algorithms 0, 1, 2, and 3 have 1 carrier. Algorithm 4 has 2. Algorithms 5 and 6 have 3. Algorithm 7 has 4." Image: http://nemesis.hacking-cult.org/MegaDrive/Documentation/operators.png 5.5 **Real YM2612 sine asymmetry** p6581/p7567 TmEE: "real YM2612 has its sine a bit shifted on half periods... one half its 1 step up, other half not"; "MD2 ASIC has perfect sine". Measured on hardware (recordings MD_Sine.rar, 27.5 Hz single operator, TL 0 upward, MD1 and MD2). This is the ladder effect seen on one operator (see 9). --------------------------------------------------------------------------------------------- ## 6. LFO 6.1 **LFO disabled: AM (and PM?) still applied with the LFO waveform frozen.** p7490, Nemesis, 2009-01-31. Measured on hardware only partly ("I haven't done full tests on this behaviour, as I haven't started work on the LFO yet"): "Even when the LFO is disabled, amplitude (and frequency?) modulation are still applied, but the LFO waveform itself is locked. In the problem track on Spiderman [Separation Anxiety intro, channels 3 and 6], the instruments ... have AM sensitivity set to max, with amplitude modulation enabled on all operators. Whatever value the LFO is frozen at, it applies a large amount of attenuation to the instrument, making it much softer. Phase modulation may also be affecting the pitch." AamirM p7541 agrees it explains the level (his hack had been to add 0xF to TL). 6.2 p7967 end: "The current LFO implementation in MAME is mostly correct, but there is an error in the phase modulation implementation which I'll detail." (Not detailed in this part.) --------------------------------------------------------------------------------------------- ## 7. Timers, INT line, CSM, channel 3 mode — p7967, Nemesis 7.1 **INT line.** CORRECTION of his earlier account (quoted in full in the post, withdrawn): "The INT line is asserted whenever a timer overflows, and will remain asserted until the reset bit is flagged for the timer... The INT line is generated in real-time by a logical OR operation between the overflow bits of the two timers." Measured on hardware (re-test; earlier readings "bad"). (The INT pin is not connected in the Mega Drive: Snake p7445 "the interrupt lines, can't be used".) 7.2 **Timer A rate.** "timer A overflows every fm update cycle" at its shortest period; "Since timer A runs at the same rate as the phase generator update cycle, setting the timer A period to the shortest possible value (0x3FF) will cause this behaviour." 7.3 **CSM key-on/off.** Measured on hardware. - "there is a dedicated internal flag which indicates the current "CSM key-on" state. When timer A overflows, if CSM mode is enabled, this "CSM key-on" flag is set. This flag remains set until the next phase generator update cycle, when key-on events are again evaluated... After the key-on state of the operator has been evaluated during the next update cycle, the CSM key-on flag is cleared. If timer A does not overflow again before the next update, the CSM key-on flag will appear negated, which would key-off the operator on the next update cycle after it had been keyed on by CSM mode. If timer A overflows before every update cycle however, the CSM key-on flag appears to be permanently set... The effect of this is that CSM key-off does not occur, and the key-on event generated by CSM mode allows the operator to proceed through the normal ADSR envelope." - "if the channel 3 mode doesn't equal 10 (upper bits of register 0x27 set to 10), the CSM key-on is masked, and the CSM key-on state is forced to 0. This causes a CSM key-off event to occur if CSM mode is disabled while CSM key-on is currently being held on... CSM mode is only active when the channel 3 mode status bits are set to 10, not when they are set to 11." - **Two flags OR'd**: "There is a normal key-on flag, which is updated by sending manual key on/off writes to register $28. There is also a separate CSM key-on flag... They are OR'd together. An operator is in a state of key-on if either of these flags is asserted... The YM2612 itself only considers that a key on/off event has occurred if the combined OR state of these two flags is different at the beginning of an update cycle than it was at the beginning of the last update cycle." - Hand-over: key on manually, CSM held on (timer A at max rate), manual key-off → operator stays on. - CSM key-on also resets the phase counter (2.1) and with AR 62/63 forces attenuation to 0 at once (3.8). 7.4 **YM3438 manual on channel 3 mode** p8406 Nemesis: the manual "shows the difference in the CH3 mode flags between the YM2608 and the YM3438". From manual; detail not given in the post. --------------------------------------------------------------------------------------------- ## 8. Status / busy 8.1 **Pin 10 is TEST and outputs the busy state.** p6288 Nemesis (2008-09-20), measured on hardware (discrete YM2612): "the supposed "unused" pin 10 is really a "TEST" pin. I've confirmed this is correct, and that what this pin actually does is indicate the current "busy" status of the chip." p7409 (2009-01-28): "It's an output line which is asserted when the YM2612 is busy, and negated when the YM2612 is ready to receive a write." p8406: the YM3438 manual "formally identifies pin 10 as the TEST pin" and "gives us busy flag timing information" (from manual, numbers not quoted in the post). - p7393 Jorge Nuno, measured (multimeter): pin 10 "has internal resistance to both +V e Gnd (around 90kOhm...)"; "Powered on and playing stuff gives 4.85V". 8.2 **Busy duration: no number in this part.** Nemesis planned logic-analyser measurements (p6288). TmEE p6298 (experience, by ear): "Some things that require longer waits are TL operators and KeyOn/Off. Having too short delays when writing to these registers will have weird sound... L/R reg seems to require long wait aswell." Speculation (p6298, p6288 quote of Snake) that the ASIC's busy timing differs from the discrete chip's: one game "runs at half speed" on later hardware; p6607 TmEE: "Hellfire, the music will be 2x slower... that is so on all MD2 based systems". Not measured. --------------------------------------------------------------------------------------------- ## 9. DAC channel, accumulator, output multiplexing, ladder effect, levels 9.1 **Output is time-multiplexed per channel; no summing of channels.** p7480, p7512, p7515, p7516, p7520, Nemesis, 2009-01-31 to 02-01. Measured on hardware: digital oscilloscope on the YM2612 output pins of an MD1 (discrete YM2612), test ROM ym2612multiplexing. - "The accumulator combines the output from operators, it does not combine the output from channels. The output from the YM2612 is multiplexed." (p7480) - "The accumulator sums the output from all these carriers within a channel, and presents each channel as a single output to the DAC. It also handles the DAC signal for channel 6, and the left/right channel outputs." (p7512) - Test (p7516): "a single operator from each channel. The phase generator is frozen, with the phase generator outputting a maximum positive value each cycle. The envelope generator ... is locked in an infinite decay phase, at an effective internal attenuation value of 0. A different TL value is used for the selected operator in each channel." Second shot: "unique values for TL in each channel, moving from 0x0 to 0xA with a step of 2 from channel 1 to channel 6." - **Channel order on the output: "The apparent output order is 1,5,3,2,6,4."** Same order on the MD2 ASIC (p7537). - "the left and right output streams are actually output at the same time". - **Timing (p7520)**: "This is the analog output from the YM2612 next to the master clock (7.61MHz or there abouts). As you can see, there are 24 master clock cycles between each timeslot." Observed: a gap of 19 clock cycles of silence, then the level held for 5 cycles ("leaving only 5 cycles for the output to remain asserted"). His reading of the gap (by analogy with the YM3016 data sheet, speculation): 16 serial bits + 2 latch cycles + 1. "the DAC has one timeslot per channel, or 7610000/6/4=317083, where 6 is the fm prescaler, and 4 is the number of operators per channel." HardWareMan p7522: 6 timeslots → 7.6 MHz/24/6 ≈ 52 kHz. Earlier (p7460): multiplexed rate "over 310KHz". (Clock 7.61 MHz is the PAL console's FM clock.) - Visible in recordings at 192 kHz, not at 96 kHz or below (p7480, p7512, p8032). - p7518 HardWareMan (earlier oscilloscope work, part 1): "6 timeslots per one channel (left and right). That's is why DAC function replace one of channel (number 6)." 9.2 **MD2 ASIC (315-5660) output is also multiplexed but a different DAC.** p7537, Nemesis, 2009-02-01, measured: oscilloscope on "an MD2, board PC BD MD2 VA1.8 PAL, with an embedded YM2612 in the 315-5660": "Very different to the MD1 with the "real" YM2612. The output is still multiplexed, and the strange channel order from the output is the same, but that's about it. Clearly this is a totally different DAC." Snake p7548 (reading the picture): "the MD2 DAC takes a lot longer to do the conversion, but isn't serial". 9.3 **9-bit DAC / accumulator in the YM3438 manual.** From manual (YM3438_APL.pdf): - p8406 Nemesis: the manual "confirms what Steve suspected; they've removed the accumulator" and "gives us a description of the CH6 DAC mode". - p8407 Snake: "It does confirm the 9 bit DAC". - p8447 Paul Jensen (translator of the Japanese), page 33 (PDF page 35): "The accumulator totals up the (9-bit) output sent to each slot of each channel one at a time and sends it to the D/A converter. Therefore, no special attention is required in terms of sound creation." → CONTRADICTION inside the thread on whether the manual says the accumulator is absent; Snake p8469 calls the sentence "probably an error copied over from some other document". The parent should read the manual page itself. - p8494 Lord Nightmare: YM2413 and VRC7 also time-multiplex instead of accumulating. 9.4 **Ladder effect / low-level distortion** (discrete YM2612). All by ear, recordings or scope pictures; no numbers. - TmEE p6581: "Real YM2612 has quite bit of the "ladder effect" noise in the sound, where as MD2 ASIC YM2612 does have it much less." p6635: "it sounds like a damn 6-bit WAV". - HardWareMan p6636: ladder "clearly hear at very low volume on every FM channel (did not tested it for DAC)"; his MD2 with the single big chip "did not produce this "ladder" effect but it did mute some very low volume sounds". p7531: present "in every channel separatly". p8007: capture of the ladder on a bass note (ladder.th.gif), MD1 headphone jack to Audigy line in at 48 kHz. - Snake p7437/p7440/p7446/p7449/p7470: After Burner II "Super Stripe" quiet instruments are louder and different on an MD1 because of the distortion; "CONFIRMED: on a Genesis 2, it sounds just like Kega" (clean). "'off' should happen way earlier than it actually does." p7530 (from old scope memories, speculation as to cause): "one side performs exactly as it should, and hits silence when it should. But the other side doesn't... I *think* it's the negative side that has the problem". - Nemesis p7448: "I've observed a minor loss in precision, which is either due to the DAC or the accumulator, and of course there's the obvious jump between low volume and off". - Nemesis p7460: multiplexed output rendered in his emulator and resampled "sounds much closer to the real hardware" for After Burner II than summed output (emulator experiment). - TmEE p6607: "MD2 YM2612 seems to start clipping at lower amplitudes that real YM2612". p6582 Snake: "There is some filtering that goes on BEFORE the signal exits the chip" (assertion, no evidence). - GManiac p8556 (measured, 96 kHz recordings of an European MD1, sweep ROMs): output contains harmonics 2F, 3F... of a single sine ("after 5th repetition even harmonics are more weak than odd ones"), and images mirrored about half the sample rate: main + mirror = "52780 Hz - it's base frequency of YM"; crossing at 26390 Hz; 46160 Hz tone mirrored at 6620 Hz. "(MAX = 52781 or 53267)". Asks why; unanswered in this part. 9.5 **DAC channel (register $2A/$2B)** — little here. - TmEE p7969 (measured, recordings DACTESTS.RAR): "YM2612 misses DAC writes or does not output them when the sample rate is too high... 32KHz sounds bad (and its around the rate you get when you wait for the chip). 26KHz (~half the YM2612 sample rate) sounds great". Nemesis p8020: the faster one "has some additional noise on the output signal. I'll take a look." Snake p8023 (speculation): "probably writing to the DAC at around the same time the chip is trying to read it." - "Stereo PCM" by switching pan between DAC samples does not work on hardware: TmEE p6298/p6337, Stef p6339 ("acted as simple mono sample player on real hardware"). Measured by ear / recording. 9.6 **Output filtering of the console** (board, not chip): TmEE p6563 "a filter which gets rid on anything above 10KHz or so would be what's in MD2, plus a great deal of distortion... for MD1, you can omit the distortion"; Snake p7558 "the filtering effectively downsamples the whole thing to around 40KHz"; p7998 Genesis 2 filter has ripple, Genesis 1 flat. GManiac p8556: MD1 attenuates rising frequencies up to 46 kHz (picture). After Burner II plays PSG at maximum frequency as a 4-bit DAC (p7460, p7493). --------------------------------------------------------------------------------------------- ## 10. Clocking and sample rate - FM prescaler 6, 4 operators per channel, 6 channel slots: clock/6/4 per channel slot, clock/144 per sample (p7520 Nemesis, p7522 HardWareMan). 24 master (FM input) clocks per channel timeslot, measured on the scope (p7520). - Sample rate on a PAL console "around 52847Hz" (p8032 Nemesis); GManiac's measured base frequency 52780 Hz on a European MD1, "(MAX = 52781 or 53267)" (p8556). - EG update once per 3 samples (3.1). Key on/off, CSM flag, timer A: per sample (3.7, 7.2). - No 351 divider (withdrawn, 3.1). --------------------------------------------------------------------------------------------- ## 11. Reset / power-on - p7999 Snake (old tests, from memory): "I believe they are mostly undefined (if you reset the chip while it's playing, I believe the note continues unaffected), with the exception of the registers that control stereo, which seem to be set to allow left and right output for all channels, at least at power on." p8023: "I seem to recall hitting the reset line didn't clear things though (maybe it keyed all channels off?)" — unsure. - p8020 Nemesis: "I can't say I've done very thorough tests on this. I generally ran on the assumption that the registers were initialized to 0 on power-on. I found documentation stating this is the case for other Yamaha FM chips, and the same seems to be true on the YM2612, with the exception of the Left/Right flags, which are initially set... I didn't do any tests with triggering a reset after initializing the registers". → power-on: registers 0, L/R both set (lightly tested); /IC reset behaviour: UNSETTLED here. --------------------------------------------------------------------------------------------- ## 12. Test registers Nothing concrete in this part. p7410/p7967 Nemesis: the test register is what lets him read the operator/EG output digitally; "I'm going to publish my own notes on the YM2612 test register" (promised). Digital read-outs quoted: operator output values such as 0x001F, 0x1FE8, 0x0021 (14-bit-looking words, in the SSG-EG code comment). --------------------------------------------------------------------------------------------- ## 13. YM2612 vs ASIC vs clones; console revisions - Discrete Yamaha YM2612: MD1 VA0..VA6, and MD2 VA2 (TmEE p6632, p6639; LN p6630). - ASIC with FM inside (VDP+I/O+YM2612+PSG): 315-5487 (MD1 VA7, Wondermega, MD2 VA0), 315-5660 (MD2 VA1, VA3, X'eye), 315-5700 (Nomad; LN writes "FC1004" for the family; TmEE also writes 513-7000 once), 315-5708 compatible (p6615, p6638, p6639, p6643). Later single-chip systems 315-5960 (MD2 VA4 / Genesis 3 VA1), 315-6123 (Genesis 3 VA2) — FM not characterised. TmEE: "Real YM2612 sounds one way (poorer), and ASIC variants all sound same." - Clones: SE-95 (from an AITO clone; "higher output levels compared to real YM2612 and its sound seemed cleaner", TmEE p6540), PCS95, TA-07 (HardWareMan p6558, p7538). No measurements. - Differences reported between discrete and ASIC: ladder effect (9.4); different DAC, same multiplex order (9.2); earlier clipping on ASIC (p6607, by ear); busy timing perhaps different (8.2, speculation); address latch behaviour the same (1.1); SSG-EG "I'd be surprised if SSG-EG works any differently there" (Snake p8027, not tested). - p8406/p8407: YM3438 "is the YM2612 for all intensive purposes" / "hardware and software 100% identical to the YM2612" per its application manual (their reading of the manual). - Snake/Arbee/others: music was authored on NTSC model 1 with the discrete chip; default emulation target should be that (opinion). --------------------------------------------------------------------------------------------- ## 14. Facts from posts by nukeykt and jotego None: neither posted in this part. --------------------------------------------------------------------------------------------- ## 15. Files, recordings, test ROMs, images linked in this part URLs are as they appear in the forum text; phpBB shortened many with "..." and those cannot be rebuilt from this text. None were fetched. Nemesis (nemesis.hacking-cult.org), hardware = PAL MD1 "MD1600" (VA4, discrete YM2612) unless said: - p7515: test ROM + source "http://nemesis.hacking-cult.org/MegaDri ... lexing.asm" / ".bin" (ym2612multiplexing; megadrive-python pins ym2612multiplexing.bin). - p7515, p7516, p7520: oscilloscope screenshots of the discrete YM2612 output: http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexing.png , .../multiplexing2.png (left+right, TL 0x0..0xA step 2), .../multiplexing3.png (output beside the 7.61 MHz clock: 24 clocks per slot). - p7537: same on MD2 VA1.8 PAL (315-5660): .../Documentation/multiplexingmd2-1.png , .../multiplexingmd2-2.png . - p7512: .../Documentation/operators.png (algorithm diagram). - p7967: SSG-EG attack-and-release test ROM ("...elease.bin"), source ("...elease.asm"), hardware recording from "a PAL MD1600 (WARNING, huge file)" ("...elease.rar", 96 kHz per p8032), and his emulator's output ("...elease.rar"). megadrive-python pins ym2612attackandrelease.bin and "ssg-eg md1600 attack and release.rar". - p7967: links to earlier posts viewtopic.php?p=5716#5716 (EG description) and viewtopic.php?p=6224#6224 (EG clock correction). TmEE (hardware: modified "CCAM" MD2 VA1 PAL with 315-5660-02; unmodded MD1 VA4 with socketed YM2612, dated 08 May 1992; SE-95 clone chip): - p6298: ROM page http://www.hot.ee/tmeeco/MD.HTM ; stereo-PCM recording + ROM "http://www.fileden.com/files/2008/4/21/ ... STEREO.RAR"; photo http://www.hot.ee/tmeeco/MYSMD2.JPG . - p6532: Battletech track 12 from the MD2 ("... Tech12.ogg"). - p6545: "... CRDNGS.RAR": CCAM MD2, MD1 with YM2612, MD1 with SE-95. - p6581, p7567: http://www.epicgaming.us/tiido/MD_Sine.rar (single-operator 27.5 Hz sine, TL 0,1,2..., MD1 and MD2; "Kindly done by Epicenter") and http://www.epicgaming.us/tiido/waveform_analysis.png . - p6595: Konami logo etc. from MD2 via VGM player ("... GMPLAY.ogg"). - p6612: six game recordings (Heavy Nova, "D2CCAM", Wondermega, Subterrania, SpiderMan, Hellfire .ogg). - p7463: After Burner II medley ("... TRBRN2.ogg"); 22 kHz WAV player ROM ("... KOZMOZ.RAR"). - p7494, p7503: photos 5E6A.jpg, MD11.jpg, MD12.jpg on fileden. - p7969: DAC rate tests "http://www.fileden.com/files/2008/4/21/ ... CTESTS.RAR". - p6563: sega-16 post on the MD2 mixer (before/after). GManiac ("ghost", shedevr.org.ru; hardware: Chinese MD2 clone MK 1631-07, European MD1 PAL 1600-05 dated 05 May 92): - p7435: http://shedevr.org.ru/ghost/After_Burner_II_-_SS.ogg (clone MD2). - p7439: http://shedevr.org.ru/ghost/After_Burner_SS_Cut.zip (hardware vs Kega). - p7467: http://shedevr.org.ru/ghost/SS_PSG.7z (VGM). - p7497: http://shedevr.org.ru/ghost/Datarum_Super_Stripe.rar ; cites http://arcade.ym2149.com/megadrive/index.html (someone's MD1 recordings, 04 June 92 unit). - p8556: sweep test sources and binaries ("Here are sources and binaries (2.5 kb)", link text only; megadrive-python pins shedevr.org.ru/ghost/ym2612/sweep_1000.rar), ym_67.asm, ym_77.asm; pictures http://shedevr.org.ru/ghost/ym2612/md1_eur_46160_osci_6621.png , .../md1_eur_46160_spec.jpg , .../1000Hz_96.png (96 kHz, European MD1). HardWareMan (unmodded MD1, "YM2612+SEGA 315-5313, board IC BD M5 PAL VA4", 60 Hz, dated 20 May 92; Audigy SB0090 line-in, 44.1/48 kHz): - p6614: Subterrania track from his PD ROM (link text only). - p7489: http://rapidshare.com/files/192035241/AftBrn2.rar.html , http://rapidshare.com/files/192021501/WavPlay.rar.html ; photo dscn2670bk6. - p7498: http://rapidshare.com/files/192104633/Datarum.rar ("Super 3in1 Trax" PD ROM). - p8007: Battletech track 12 WAV from the Model 1 (link text only); pictures http://img7.imageshack.us/img7/5615/hifreq1.th.gif , .../5498/hifreq2.th.gif , .../5692/ladder.th.gif (ladder effect on bass). Others: - p6520 AamirM: a user's hardware recording of Battletech track 12 (console unknown; Snake doubts it); p6529 Snake: his own sample (NTSC Genesis 1). Link text only. - p7998 Snake: http://www.reptilia-design.co.uk/gen1-gen2.png (Genesis 1 vs 2, detune-bug notes at max volume, levels after the filter). p8027: an SSG-EG sample at 44.1 kHz (link text only). - p6725 Shiru: http://docs.google.com/View?docid=dd8kqn9f_13cqjkf4gp — OPL2/OPL3 decap article (Matthew [Gambrell] and Olli [Niemitalo], decap by MEFAS); p6767 yehar: http://yehar.com/adlib (die photographs); p6784 Lord Nightmare: http://yehar.com/adlib/ym3812_rom3_1.jpg and his reading of OPL2 "ROM3" (4-bit address, 7-bit data; table withheld). - p8403 vedge: http://www7.plala.or.jp/kikekike/fm/YM3438_APL.pdf (YM3438 application manual, Japanese); p8408: http://www7.plala.or.jp/kikekike/fm/YM3438_Cat.pdf . (Both are in megadrive-python's FMDocs.7z.) Nemesis p8406 says he will translate it. - p6596 zack: niconico video comparing JP MD1 and MD2. - p6644 Eke: Amstrad MegaPC board photo (imageshack); p6648 LN: MegaPC Plus card photo. - p6639 TmEE: http://www.sega-16.com/forum/showthread.php?t=5079 (315-5950 single chip). - p8037 Nemesis: his sound card, http://www.emu.com/products/product.asp?product=9872 . --------------------------------------------------------------------------------------------- ## 16. Open questions left by this part 1. Busy flag duration in cycles, discrete vs ASIC (planned, not posted here; the YM3438 manual is said to give it). 2. The ladder effect's exact transfer function; whether negative values are handled wrongly (Snake's guess); "loss of precision" DAC or accumulator. 3. Why the channel output order is 1,5,3,2,6,4. 4. Whether the YM3438 manual says there is an accumulator (9.3 contradiction). 5. EG update distribution across channels within the 3-sample cycle (Snake's guess, untested). 6. The exact mechanism of the AR 62/63 stall. 7. LFO: frozen-value behaviour when disabled (what value?), the PM error in MAME. 8. /IC reset vs power-on state. 9. DAC channel misbehaviour at ~32 kHz write rate. 10. GManiac's harmonics and mirror images (probably zero-order hold / multiplexing; unanswered). 11. Key-off/key-on at attenuation 0 (Eke p8045). 12. Invert-flag toggling and phase hold during SSG-EG release: unobservable. 13. Self-feedback: endorsed from MAME, not independently tested by Nemesis in this part. 14. Battletech track 12: Nemesis's promised analog explanation with pictures. --------------------------------------------------------------------------------------------- ## 17. Withheld blocks that look like measurements None certain. For the record, the four withheld blocks in this part: - p6649 kode54, 66 chars: a line of MAME fm.c (emulator code; correctly withheld). - p6784 Lord Nightmare, 262 chars: his decoding of OPL2 "ROM3" bits from yehar's die photograph (die-reading data for the YM3812, not the YM2612; not emulator code). Probably harmless to read, of little use for OPN2. - p8010 Eke, 1194 chars: follows his question about the SSG-EG algorithm; by context emulator code or a scenario listing (correctly withheld). - p8045 Eke, 151 chars: "in advance_eg_channel, I have this" — Genesis Plus GX code (correctly withheld). ## 18. Slips and skips - **Slip (small): p6519, Eke.** Two lines of Genesis Plus GX / MAME-derived code sit in [QUOTE] tags, not [CODE], so the filter did not withhold them, and they were read before their nature was clear: an assignment of `fn_max` and an `if (finc < 0)` wrap. Nothing is taken from them; the fact they illustrate (a negative phase increment wraps at 17 bits) is Nemesis's own finding from part 1 and should be cited from there. The parent may want to blank lines 229-240 of t386-part2.txt. - Nemesis's code blocks in p7967 are from his own emulator (Exodus) and he presents them as his results; read in full. Two of his formulas are noted by him as equal to what MAME already did (attack curve; 4x SSG-EG multiplier); they are his statements, no MAME code was shown. - p8030 Eke links his rewritten fm.c: not followed. - No furrtek material met. - Nothing fetched; no links followed.