# Notes: SpritesMind thread 386, part 3 (posts p8557 to p27104, 2009-04-20 to 2015-10-03) Source text: `reference/scratch/t386-part3.txt` (pages t386-450.html to t386-720.html). Every line was read. Only what the posts say is recorded. "HW" = measured on hardware. Post ids are phpBB ids (pNNNN). URL of a post: `https://gendev.spritesmind.net/forum/viewtopic.php?p=NNNN#pNNNN`. No post in this part is by `nukeykt` or `jotego`, so that heading is empty (see end). --------------------------------------------------------------------------- ## 1. Register map **1.1 Chip-level ($2x) registers present on the YM2612 die.** Sauraen, p26964, 2015-09-19. *Die analysis* (HardWareMan's YM2612 die photograph; Sauraen: "I have not done any hardware testing yet"). Copied exactly ("Key: - no bit, X bit present"): ``` 20|-------- 21|XXXXXXXX (LSI Test Register) 22|----XXXX (LFO Register) 23|-------- 24|XXXXXXXX (Timer A MSBs) 25|------XX (Timer A LSBs) 26|XXXXXXXX (Timer B) 27|XXXXXXXX (Ch3 mode, timer controls) 28|XXXX-XXX (Key-ons) 29|-------- 2A|XXXXXXXX (Ch6 DAC data) 2B|X------- (Ch6 DAC enable) 2C|XXXXX--- (Test Register 2) 2D|-------- 2E|-------- 2F|-------- ``` - "all these control registers are only accessible from bank 0 (A1 = 0 ...)" and "each register individually is specified as having that address bit at zero". - "I can further confirm that no other "undocumented" registers exist at the chip level". - New at the time: "$21 indeed has all 8 bits, and the test register at $2C ... has bits 7:3"; previously thought $21 had bits 7:2 and $2C only bit 5. - Physical order of register blocks on the die, read off the address decoders: top bus 24, 25, 27, 2B, 2A; bottom bus 21, 28, 26, 22, 2C (no behavioural meaning stated). **1.2 No undocumented channel or operator registers.** Sauraen, p26987, 2015-09-22, *die analysis* of the address decoder table (13 output rows; inputs are address bits 2-7 and their inverses plus two enables, "probably" for channel registers and operator registers). "This proves that there are no undocumented channel or operator registers (though there still could be undocumented bits in existing registers...)". Address bits 0, 1 and A1 go straight to a control unit, which Sauraen "suspect[s]" is the sequencer that times the write "when the correct item is up". **1.3 Address latch does not take addresses $00-$0F.** Sauraen, p26964: the latch for the channel/operator register address is gated by a decoder for `0000XXXX`, "my guess is this decoder's output is inverted--that is, the register will only latch the address if the address is not 0000XXXX". *Die analysis, stated as a guess.* On the YM2203 the same decoder is `~(000-----)` (p26985). Sik, p26966: the YM2608 uses $00-$1F for other functions. **1.4 YM2203 FM register set, for comparison.** Sauraen, p26985, 2015-09-21, *die analysis of a YM2203 die photograph*: ``` AD|76543210 --+-------- 21|XX-XXXX- (Test Register) 24|XXXXXXXX (Timer A MSBs) 25|------XX (Timer A LSBs) 26|XXXXXXXX (Timer B) 27|XXXXXXXX (Flags and Ch3 mode) 28|XXXX--XX (Key Ons) 2D|[address decoder, but no data bits] 2E|[address decoder, but no data bits] 2F|[address decoder, but no data bits] ``` **1.5 Key-on register $28, channel select values 3 and 7.** Paul Jensen, p9213, 2009-09-08, quoting the manual's table (000 CH1, 001 CH2, 010 CH3, 100 CH4, 101 CH5, 110 CH6) asks what 011 and 111 do; says Super Hydlide writes them. **Not answered in this part.** **1.6 SSG-EG register values.** Nemesis, p14196, 2011-11-13, *HW* ("I ran a test on all 256 possible values for the SSG-EG register"): "The upper 4 bits had no observable effect, and unless bit 3 was set to 1, there was also no observable effect either." So values 0xxx (low nibble) do nothing on the YM2612. (andlabs, p14187, had noted that the YM2149 data sheet and the YM2610 manual list 01xx as behaving like 1111, and that "the YM3438 APL doesn't list any 0xxx values".) --------------------------------------------------------------------------- ## 2. Phase generator **2.1 Frequency formulas.** GManiac, p8560 (2009-04-20) and p9214 (2009-09-08); arithmetic, not stated as a measurement: ``` F-Number = 144 * freq * (2^20 / MCLOCK) / 2^(Oct - 1) / multiplier freq = multiplier * F-Number * 2^(Oct - 1) * (MCLOCK / 2^20) / 144 MCLOCK/144 = 52781 ``` and in Paul Jensen's names: `FNote = FNum * FSam * Multiplier * 2^(Block - 21) / 144` (p9214; Jensen's own in p9213 was `FNote = FNum * FSam * (2 ^ Block - 21)`). GManiac: octave 7, multiplier 8, note 2048 would equal the channel sample rate (52781 Hz in his figures); the highest real note is 2047. "it doesn't matter for YM to play frequency X or 52781-X" (aliasing), shown on a spectrogram of an MD (p8560, HW recording, `mirror_2048_140.jpg`). **2.2 The six steps of a phase generator update.** Nemesis, p8908, 2009-06-18, *HW* (his tests; see 2.3). Exact: ``` 1. Get the current value of fnum (11-bit result) 2. Apply frequency modulation to the fnum value (11-bit result) 3. Shift fnum by the block data to obtain the initial phase increment value (17-bit result) 4. Apply detune to the phase increment value (17-bit result) 5. Apply the frequency multiplier to the phase increment value (20-bit result) 6. Add the final phase increment value to the phase counter (20-bit result) ``` "this is how the phase generator is updated each cycle in the YM2612." **2.3 LFO frequency modulation (vibrato) is applied to the 11-bit F-number, first.** Nemesis, p8905 (2009-06-15), *HW*: "Phase modulation is applied to the 11-bit fnum value before it is combined with the block data, or any other operations are carried out using it." Method: "By repeatedly disabling the LFO before it entered into the negative oscillation phase, and carefully measuring and monitoring the output from the YM2612, we were able to observe that frequency modulation values do indeed cut off after the 11th bit". "There is no extra bit of precision with frequency modulation." "I conducted a whole battery of tests using observable overflow conditions and precision limitations during the phase generator update cycle". He says MAME (and "IIRC" Kega) treated F-number as 12 bits here and are "measurably incorrect". **2.4 Overflow of the modulated F-number.** Nemesis, p8908, *HW/analysis*: - No negative overflow is possible: "the "amplitude" of the phase modulation is dependent on the initial fnum data itself, specifically, the upper 6 bits of fnum. If all upper six bits of fnum are 0, phase modulation won't adjust fnum at all." "fnum will always be larger than the amount that would be subtracted". - Positive overflow happens: "If all bits of fnum are set for example, the positive oscillation of phase modulation will cause an overflow. In this case, the upper bits are lost. The result is an 11-bit result, so a positive overflow will cause fnum to wrap around from a very large value to a very small value." "just mask the result of the addition between fnum and the phase modulation value with an 11-bit mask". **2.5 The vibrato increment table.** Nemesis, p8911, 2009-06-18, from his own core (Exodus), indexed [PMS 0-7][quarter-wave step 0-7]. Exact: ``` const unsigned int YM2612::phaseModIncrementTable[1 << pmsBitCount][1 << (phaseModIndexBitCount - 2)] = { {0, 0, 0, 0, 0, 0, 0, 0}, //0 {0, 0, 0, 0, 1, 1, 1, 1}, //1 {0, 0, 0, 1, 1, 1, 2, 2}, //2 {0, 0, 1, 1, 2, 2, 3, 3}, //3 {0, 0, 1, 2, 2, 2, 3, 4}, //4 {0, 0, 2, 3, 4, 4, 5, 6}, //5 {0, 0, 4, 6, 8, 8,10,12}, //6 {0, 0, 8,12,16,16,20,24}}; //7 ``` "This corresponds with the lookup table for fnum bit 9. ... the lookup table for every other bit is simply a shift of this table. For fnum bit 10, shift the values up by 1. For fnum bit 8, shift the values down by 1. For fnum bit 7, shift the values down by 2, etc." He says MAME's table (withheld in p8909) "is correct, but mostly redundant", and that MAME's is shifted up by one because of its 12-bit F-number. Eke (p8909, prose): the LFO PM step runs 0~31 and the value "is negative ... for steps above 16"; depends on the upper F-number bits, depth 0~7. **2.6 UNSETTLED by Nemesis: full-precision vibrato.** Nemesis, p8911: "I measured sign-extension taking effect in the negative portion of the frequency modulation wave, even when the only fnum bits set were below the upper six bits, all the way down to fnum bit 0, which suggests that the frequency modulation value may be calculated at full precision, then the lower bits discarded when it is combined with fnum". His diagram (exact): ``` // --------------------------------------------- // | Fnum (11-bit) | // |-------------------------------------------| // |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | // --------------------------------------------- // --------------------------------------------------------------------------------- // | Frequency Modulation Value (20-bit) | // |-------------------------------------------------------------------------------| // |19 |18 |17 |16 |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | // --------------------------------------------------------------------------------- //10 | 4 | 3 | 2 | 1 | 0 | // 9 | 4 | 3 | 2 | 1 | 0 | // 8 | 4 | 3 | 2 | 1 | 0 | // 7 | 4 | 3 | 2 | 1 | 0 | // 6 | 4 | 3 | 2 | 1 | 0 | // 5 | 4 | 3 | 2 | 1 | 0 | // 4 | 4 | 3 | 2 | 1 | 0 | // 3 | 4 | 3 | 2 | 1 | 0 | // 2 | 4 | 3 | 2 | 1 | 0 | // 1 | 4 | 3 | 2 | 1 | 0 | // 0 | 4 | 3 | 2 | 1 | 0 | ``` "In this case, the lookup table I've given above would correspond with fnum bit 0, and you would shift up from that for each place above bit 0, then negate the value if we're in the negative half of the wave, and finally you'd shift down 9 places and add the result to fnum. I don't do this in my core currently however." "a carry could be generated from bit 8 of the frequency modulation value for example." "Personally, I think it's likely the value is calculated at full precision." He never completed the test (p8911; p16459, 2012-08-02: "I never fully finished testing the phase modulation implementation to my satisfaction"). Eke (p8913) notes MAME also uses F-number bit 4. **2.7 Vibrato does not touch block or the key code.** Nemesis, p16459, 2012-08-02, recollection of HW tests, hedged: "I don't think BLOCK data has any effect (at least, I don't recall being able to find any)"; "I don't believe that phase modulation impacts the way any other part of the phase generator operates, such as detune or the normal way BLOCK/FNUM data is used, all it does is to add a small adjustment to FNUM before the BLOCK data is applied." **2.8 Phase counter and its output.** TmEE, p18723 (reading Nemesis's diagram): "The output from PG multiplication calculator is 20 bit, lower 10 bits are dropped and the data exits the PG and enters "Operator Unit"." Eke, p16391: "the size of phase counter is 20-bit, with lower 10-bit being dropped when calcultating the output". Mamizou, p15665, *die*: "you can see the 10.10 bit wide registers in the PG". **2.9 F-number/block write order (latch).** Nemesis, quoted in full by Eke in p9457 (original post is in an earlier part), *HW*, with test ROM: "the YM2612 doesn't commit a write to the block/fnum register until the fnum register is written to." Example: "-Set 0xA6 to 0x1E -Set 0xA2 to 0xFF -Set 0xA6 to 0x24. The effective settings for the channel will remain as 0xA6 = 0x1E, 0xA2 = 0xFF." "If register changes were applied immediately, the result would be an A4 (440Hz). Instead, this ROM will play an A6 in the actual hardware." Also: "writing an fnum byte for one channel doesn't commit fnum/block writes which have been made to other channels ... The update will remain in limbo until the fnum register for channel 2 is written to". - **Open (Eke, p9457, 2009-10-23, unanswered):** MAME uses one shared latch, so a block byte written for channel 2 followed by an F-number byte for channel 3 would give channel 3 channel 2's block byte. "I wonder if this is correct ?" And for channel 3's special-mode registers: one latch for all, a second latch for $AC-$AE (what MAME does), or one per operator? No reply in this part. **2.10 Key code.** Eke, p14071 (pointer only): the key code for detune and rate scaling is built from block and "N4/N3 ... built from fnumber", as in Nemesis's phase-generator post (earlier part, `start=106`). --------------------------------------------------------------------------- ## 3. Envelope generator **3.1 Update period.** The EG updates once every 3 sample cycles. TmEE, p18818 ("Updates happen every 3 cycles"), Aly James p21132 ("IIRC EG updates every 3 FM update cycles"), trap15 p21109 (YM2203 emulator: counting the EG once per 3 output cycles gives the right rate; *from his emulator by ear*). None is a new measurement here; they repeat Nemesis's earlier posts. **3.2 Global counter never reads 0 / period.** GManiac, p18838, 2013-02-13 (source not stated; he says elsewhere, p11876, that he "made a tons of tests on real MD"): "global EG counter max value is 4095, not 4096, so full EG "cycle" lasts 12285 internal cycles." **3.3 Which sample cycle updates which channel: speculation.** GManiac, p18838: "Somewhere was an opinion that envelopes of different channels of one block ... are updated in different cycles of 3-cycle phase. I think it's true": ``` Global cycle 1: channels 1 and 4 updated Global cycle 2: channels 2 and 5 updated Global cycle 3: channels 3 and 6 updated Global cycle 4: channels 1 and 4 updated ``` TmEE (p18836) updates all at once in his core and thinks the difference "would be inaudible". **Open:** andlabs's questions (p18823, p19059) whether all operators update at once or in a 3-cycle loop, whether EG register values are latched per EG cycle, and how wide the global counter is, got no measured answer in this part. **3.4 When the EG first runs after power-on.** Nemesis, p14196: "I have absolutely no idea, and no real idea how I could test that either." He guesses the cycle counter may be uninitialised at power-on. *Speculation.* **3.5 Maximum rate.** Eke, p14071 (explaining MAME, pointing to Nemesis's EG post): "the maximal RATE value ... is capped at 63 ... When the rate is maximal, envelope directly switches to the next "phase"." *From emulator, with pointer to Nemesis.* **3.6 Attenuation width and SSG-EG key-off inversion.** Nemesis, p14196: the EG attenuation is 10 bits (`attenuationBitCount`); on key-off under SSG-EG his core does the equivalent of `state->attenuation = ((unsigned int)0x200 - state->attenuation) & ((1 << attenuationBitCount) - 1);` (his own code; the condition under which it applies is in his earlier SSG-EG post). **3.7 EG output + TL.** TmEE, p18903 (*his emulator compared with a real chip's spectrum*): "10 bit EG output + 10 bits of TL I clamp to 10 bits". **3.8 Envelope shape, range (manufacturer).** YM3438 application manual, translated by BRPXQZME on romhacking.net, relayed by Christuserloeser, p11860, 2010-09-14, *from manual*: "The envelope's waveform changes exponentially during attack; at the rest of the rates, it changes linearly. Also, in the internal calculations, it has a zero (0) to negative ninety-six (-96) dB range, but due to the precision of the DAC, the actual dynamic range ends up being zero (0) dB to negative fifty-four (-54) dB." TL: ""00" means attenuation of zero (0) dB (the maximum level), and "7F" is ninety-six (96) dB (the minimum level)." GManiac, p11876, *HW*: "each 8 steps of TL are equal to 6 dB (division by 2)". **3.9 Tables Nemesis considers settled.** Nemesis, p11386, 2010-07-16: list of chip tables: sine; pow; detune; phase modulation increment; attenuation increment ("may be largely "generated" rather than stored"); envelope generator counter shift ("may be entirely generated"); LFO increment ("probably part of the circuit path"); amplitude modulation shift (same). "I've already reverse engineered the contents of all these tables to my satisfaction, as in, I'm confident I have them 100% correct, perhaps with the exception of the attenuation increment table for which I haven't directly verified every single entry, so maybe 95% confident for that one." --------------------------------------------------------------------------- ## 4. Operator unit **4.1 Sine table obtained through the test register.** Nemesis, p11386: asked whether the sine ROM could be read out with the test mode: "Already done. That's how I derived the algorithm I provided in this thread to re-create the bit-accurate sine table." *HW.* (The algorithm itself is in an earlier part.) Eke, p10466: the power and sine tables "have been verified by Nemesis on real chip (and Jarek as well on chip of the same family)", operator output is "a 14-bits signed value ... (also verified on real chip)". GManiac p12995: "Sine table is normal, I tested it using phase modulation." **4.2 Operator output range.** GManiac, p11876, *HW*: "operator's output is -8168..+8168". (blargg p10459 uses -8192 to +8191 for a channel in MAME: emulator.) **4.3 Modulation input scaling.** GManiac, p18814, 2013-02-11 (*his HW tests*): "14-bit operator output sums with other operators's output, if it is present (algos 1-3), then their sum shifts RIGHT for ONE bit and this value is added to input phase of modulated operator. No exceptions." TmEE confirms by spectrum against a real chip (p18903: "shift the 14bit output right 1 time and then add to 10bit output of PG", and after fixing other bugs "4ops work correctly too, producing correct spectrum"). TmEE p18723: two modulators into one operator are "just summed together"; p18836: the modulation value is signed. - Mamizou, p18725, *die*, said the low 4 of the 14 bits "just end" ("they're just dropped") at the Sine+EG adder. This conflicts with GManiac's shift-by-one and with Sauraen (4.6: full 14-bit value used for modulation). Treat Mamizou's as superseded. **4.4 Feedback.** GManiac, p18814, *HW*: "For feedback fb1 and fb2 are summed, then value shifted for various amount of bits, it depends on feedback depth. Yes, there are really two feedback registers, I made it sure by special tests." Sauraen, p27060, *die*: "The shifter unit that implements the "feedback amount" is in the datapath for all operators, but it's just set to a constant for all but op 1." The per-level shift amounts are **not given** in this part (Eke p9005 lists it as needing confirmation). **4.5 Which sample of each modulator is used (operator ordering).** Sauraen, p27098, 2015-10-03, *die analysis* (YM2203 die, "confirming critical elements against the YM2612"). Operators numbered so that algorithm 0 is the chain 1-2-3-4. "the four operators use the following values for their modulation in "Cycle 1"": ``` Op 1: Op 1 Cycle 0, Op 1 Cycle -1 Op 2: Op 1 Cycle 1 Op 3: Op 1 Cycle 0, Op 2 Cycle 0 Op 4: Op 1 Cycle 1, Op 2 Cycle 0, Op 3 Cycle 1 ``` "This can also be replicated simply by processing the operators in the order 3, 1, 4, 2, and in every case using the most recent output of the needed operator. (So that when you process op 3, you're using the results of ops 1 and 2 from the previous cycle; and when you process op 4, you're using the most recent 1 and 3 but old 2.)" Steve Snake's "two operator units in parallel" (ops 1 and 3 together, then 2 and 4) "is functionally correct ... though it's not strictly how the chip behaves" (there is one operator unit on the die, p26964). Earlier statement of the same in pipeline terms, p27060 (YM2203 timing; on the YM2612 "the cycles indicated should be 0, 6, 12, and 18" and each operator takes 12 cycles): ``` 0) Op 1's FM value is fed into the pipeline from stored "old 1" and stored 1. Op 2 just finishing, sent to accumulator and stored as 2. 3) Op 3's FM value is fed into the pipeline from stored 1 and stored 2. Op 4 just finishing, sent to accumulator. 6) Op 2's FM value is fed into the pipeline from new Op 1 result, which is also stored as 1 and sent to the accumulator. The old value from "stored 1" is stored as "old 1". 9) Op 4's FM value is fed into the pipeline from new Op 3 result (which is also sent to the accumulator), Op 1 stored, and Op 2 stored. ``` **4.6 Structure of the operator unit on the die.** Sauraen, p27032 and p27060, *die analysis*, with his own caveats ("I don't have enough information yet to comment on the accuracy of the results"): - "the sine table is actually 7 -> 19 bit and the exponential table is 7 -> 13 bit, but in both cases several output bits are later gated by the input LSB, so the result of each table plus the logic near them is actually 8 -> 11 bit for the sine table and 8 -> 10 bit for the exponential table." - "The 11-bit output of the sine table is added to the 10-bit EG attenuation value, but it looks like it adds it to the upper 10 bits, not just 10+10 bits = 11 bits with a carry." Result is 12 bits (p27060: "the 12-bit logsin+attenuation value"). - "the four top bits of the resulting value go to a small unit [decoder, then the shifter] ...; the remaining 7 bits address the exponential table, which with its associated logic produces a 10-bit output" (the mantissa). - Bit 9 of the (FM + PG) phase value is carried alongside to the two's complement unit (the sign). - Pipeline registers (p27060): "a) At the adder between the 10-bit FM value and the 10-bit PG value b) At the adder between the 11-bit logsin output and the 10-bit attenuation value c) At the 10-bit mantissa value, immediately before the exponent shifter d) At the two's compliment unit (this is where the output is taken from) e) Circular shift register array (stores outputs of previously computed operators) f) At the unit which adds two previously-computed operator values to make the new FM value". The YM2612 adds "a six-stage shift register ... between the calculated 10-bit FM value and adding that to the 10-bit phase value". - Processing order across channels: "It processes one operator from each channel before it goes to the next operator ... each next clock cycle (this is the main internal clock, which is the external clock divided by 6) a different channel is being processed". Which operator order: "I don't have enough information to tell". - The store of earlier operator outputs "has three entries": op 2, op "old 1", op 1. - "the full 14-bit operator output value is used (and stored) for modulation, but it's reduced to 9 bits before being added to other operators' values that are being sent to the audio output" (p27032). - Register arrays are circular shift registers, not RAM (p26964); dynamic memory throughout (p27060; Shiru p8653 said the same in general terms). **4.7 Algorithms: which operators are summed.** Eke, p9005 (from MAME/manual): algorithm 4 sums two carriers, 5 and 6 sum three, 7 sums four. Manual text in 6.4. --------------------------------------------------------------------------- ## 5. LFO: tremolo (AM) and behaviour when disabled **5.1 AM waveform, from Nemesis's own core.** Nemesis, p16436, 2012-07-31. His code (exact, his own; Exodus): ``` //Apply amplitude modulation to the output attenuation value if(GetAmplitudeModulationEnabled(channelNo, operatorNo, accessTarget)) { // --------------------------------- // | LFO Counter | // |-------------------------------| // |...| 6 | 5 | 4 | 3 | 2 | 1 | 0 | // ----============================= // | Amplitude Modulation | // | Index (7-bit) | // |---------------------------| // | 6 | 5 | 4 | 3 | 2 | 1 | 0 | // ----------------------------- //Calculate the current attenuation value from the LFO. Note that the amplitude //modulation wave starts off inverted. An index of 0 corresponds with the maximum //attenuation value that amplitude modulation can apply, according to the current //amplitude modulation sensitivity. This is of particular importance when the LFO //is set to the disabled state. In this state, the LFO counter is held at 0, but //since an amplitude modulation index of 0 represents the "peak" of the wave, the //operator will be attenuated by a fixed amount through amplitude modulation while //the LFO counter is being held at 0. bool inverted = (currentLFOCounter & 0x40) == 0; unsigned int amValue = currentLFOCounter & 0x3F; if(inverted) { amValue = ~amValue & 0x3F; } //Adjust the attenuation value by the amplitude modulation sensitivity const unsigned int amShiftValues[4] = {8, 3, 1, 0}; unsigned int amSensitivity = GetAMSData(channelNo, accessTarget); amValue = (amValue << 1) >> amShiftValues[amSensitivity]; //Attenuate the operator output by the current amplitude modulation value attenuation += amValue; } ``` How known: Nemesis says he wrote the core "in tandem with my testing" (p21355), but for the shift values specifically (p16459): "I didn't record enough detail to be sure if I confirmed those shift values through my own tests or not. I presume I did". Eke (p16438) notes MAME uses the same shift of 8 and that 7 would already give zero since the maximum is $7E. **5.2 LFO disabled: counter held at 0, tremolo at its maximum.** Nemesis, p16436 (in the comment above): with the LFO disabled "the LFO counter is held at 0", and index 0 is maximum AM attenuation, so an AM-enabled operator "will be attenuated by a fixed amount ... while the LFO counter is being held at 0." Supporting observation, Eke, p16431, 2012-07-30, *compared by ear with real hardware and Kega*: California Games "Surfing event" track, whose driver keeps stopping and starting the LFO, sounds right ("like real hardware or Kega") only if AM is at its maximum (126) when the counter is at 0 / the LFO is restarted. - **Contradiction inside the thread:** Eke, p9166 (2009-08-26), described his then core as: "instead of being reseted, current modulation level is held when LFO is disabled, and is reseted when LFO is enabled"; and p9005 recalls Nemesis once saying AM/PM "could still be applied depending on which step the LFO was stopped" (Spiderman Separation Anxiety intro). Nemesis's 2012 code comment says the counter is held at 0 while disabled. Later statement (2012) is the researcher's own; the held-level variant is Eke's emulator choice of 2009. - LFO update order (Eke, p9005, opinion): should be done after output calculation, like EG and PG. Not measured. **5.3 LFO PM**: see 2.3 to 2.7. **5.4 Nemesis never wrote up the LFO.** p8905, p21355 (2013-11-03): "I think there were one or two questions I had remaining about the LFO I never got back to testing"; they would be marked `//##TODO##` or `//##FIX##` in the Exodus source. --------------------------------------------------------------------------- ## 6. Accumulator, DAC and output stage **6.1 Manufacturer text (YM3438 application manual), translations relayed in the thread.** *From manual.* - Paul Jensen's summary, relayed p11859 (2010-09-13): "1. Each slot/carrier is output as a 9-bit value. 2.The DAC is 9-bit. 3. The chip has a 96 dB dynamic range internally/theoretically, but the DAC is only 9-bit, so the effective dynamic range is 54 dB. 4. Due to the lower dynamic range of the DAC, overflows can occur if you set attenuation (TL) too low. 5. The minimum wait time between writes to addresses $21 through $B6 is 17 clock cycles." - BRPXQZME's translation, relayed p11860: "Audio output: Two (2) channels, L and R. Nine (9)-bit stereo DAC included." "6. Accumulator: The accumulator adds together and accumulates for each channel the output (9-bit) of each slot for each channel sent from the operator, and sends it to the D/A converter." "7-1. D/A converter ... the OPN2C can perform D/A conversion on the data written in the address $2A registers. This encodes analog sound into eight (8)-bit data ... The sampling rate for this is 55.5 kHz." TL passage: "in the case of the OPN2C, the internal D/A converter is nine (9)-bit, so the actual analog audio output becomes equivalent to fifty-four (54) dB. Therefore, compared to the OPN, even if the exact same parameters are set, there are cases where the analog sound output will overflow entirely." - Further translation relayed by Eke, p11873 (2010-09-19), on converting OPN/OPNA tone data: "Because the D/A converter's dynamic range is limited to nine (9) bits, this can cause the output waveform to overflow unintentionally depending on the values set for tone parameters." Guidance: "① Confirm the connection (algorithm) data. If these data are zero (0) through three (3), then the waveform does not distort, even at TL=0. ② When con. = 4, set the TL of the second individual carrier so that it will be negative six (-6) [dB] or more. ③ When con. = 5 or 6, set the TL of the third individual carrier so that it will be negative nine and one half (-9.5) [dB] or more. ④ When con. = 7, set all TL's to negative twelve (-12) or more." (Translations are by forum volunteers on romhacking.net, not by the excluded author. Original page images were at monsterup.com, links likely dead.) - TmEE, p11864: 54 dB = 9 bits x 6 dB. **6.2 Operators are reduced to 9 bits BEFORE they are summed; the sum is limited.** GManiac, p11862 (2010-09-14) and p11865, p11876 (2010-09-22), *HW* (real MD, oscillograms; method: "algo 7, all operators are at +1 of sinus, all TL = $7f, freq = 0, so we have silence", then adjusting each TL separately): - "I confirm that DAC and accumulator are 9 bits, and carriers are shifted BEFORE going to accumulator." - "operators are shifted first, then are summed"; "operators are shifted arithmetically (not logically) by 5 bits". - "+8168 asr 5 = +255", "-8168 asr 5 = -256". "One operator can give you values from -256 to +255. Using one more operator you can get +256 ... Range of accumulator or DAC is -256..+256 and you cannnot get values out of this range. There is no "overflow", high values won't become small values." Found by "Setting one operator to +255 and adjusting TL of other operator I found that maximum is +256." "So we have 513 levels, but maybe ... we have only 512 uniqie levels? I don't know." - Agrees with the die: Sauraen, p27032, "Only the top 9 bits of the operator output are passed to the channel accumulator unit." - Eke's summary, p11875: (1) 14-bit slot output to 9 bits by a 5-bit shift, (2) add up to four slots, (3) limit to -256..+256. Stef p11874 also reads the manual's "overflow" as limiting. - Note the upper limit +256 (not +255) is GManiac's reading, "AFAIR". - Earlier emulator-side guesses now superseded: Eke p9005/p10442 clips each channel to 14 bits (fixes a Sonic 3 distortion); blargg p10441 (2010-02-20, *listening tests against his own US model 1 Genesis recordings*) masks low bits of each channel before mixing, thought 7 or 8 bits; Eke p10460 found 9 bits closest. **6.3 The DAC on the discrete YM2612 (die).** *Die analysis* of HardWareMan's die photograph: - Nemesis, p15075 (2012-04-16): the DAC input splits into upper 3 bits and lower 5 bits, decoded to 8 and 32 lines, selecting one entry of an 8x32 (256-entry) array. p15076: nine lines arrive; "it's really a 9-bit DAC, but one of those is the sign bit". - HardWareMan, p15077: "Analog value matrix is 8x32 (256 levels). 9th bit is a sign. Sign bit conect DAC matrix to AVCC or AGND via Source/Sink power switches. That is why between two samples on MOL/MOR are 1/2 of AVCC. Thus, 8bit DAC pulls up to the AVCC or pulls down to the AGND which depends on 9th sign bit." (This corrects his own p14976 "DAC is 8bit, not 9bit".) - HardWareMan, p15097: "DAC is 9 bit mono. "Stereo" is just enabling selected channel to left or right output." A multiplexer before it "selects program sample [register $2A] or accumulator sample." - HardWareMan, p26980 (2015-09-21): a resistor chain, pushed to AVcc or pulled to GND by the sign bit; a switch matrix picks the tap by the 8-bit code; "there is also 1/2 AVcc generator by 2 resistors. The on/off schematic connect analog output to 1/2AVcc or Ux." "But it turned out that there is additional resistance ... it obviously affected to Ux possibly making some unbalancing between positive and negative part of DAC values." - HardWareMan, p14985: "Analog output has only one transistor, wich connected to AVCC. Thus, analog output can only source current, not sink. External resistor required." - Eke, p19743 (2013-05-18), reasoning not measurement: the 9-bit value is two's complement, so with a sign-switched ladder the negative half needs an offset; he suspects the ladder effect lies there. **6.4 Time-division multiplexing.** The six channels are output one after another, not summed. - GManiac, p8646 (2009-05-07), citing Nemesis's oscilloscope screenshots (earlier part): pulse rate "317 kHz (7.67 MHz/24) and duration of 1 wavefront is 6 cycles ... and of zero point - 18 cycles." (i.e. each channel slot is 24 chip clocks, of which the level is driven for 6 and the output rests for 18). - blargg, p10441: "the DAC really operates at 6 times the normal rate, or 1/24 the clock input ... 7.6704545... MHz, the DAC operates at 319.6022727... kHz ... 1/6 that rate, 53.26704545... kHz." (arithmetic; cites Wikipedia for multiplexing). - TmEE, p14991: output "is muxed not summed"; one DAC serves both sides with L/R switches (p14988, HardWareMan p15097). - Channel order: Eke, p10442, from memory only: "a strange order like 1,4,3,2,5,6 i think, must look back". Unverified here. - HardWareMan, p14976: oscilloscope picture showing left and right in sync. **6.5 The "ladder effect" (discrete YM2612).** *HW observations:* - GManiac, p8751 (2009-05-19): with a sine growing from 0 to maximum, "multiple harmonics have the same level at all levels of sine ... result of "ladder effect" - it is irregular meander, it contains all multiples of main frequency, not only odd ones, but odd multiples (especially "4*n+3" ones) are stronger." - GManiac, p11876 (real MD, oscillograms): "levels -1 and -2 of DAC are the same. I mean that if you change output from -1 to -2 you won't notice difference on oscillogram." - GManiac, p12980/p12991 (2011-03): proposed test, algorithm 7, one operator, TL $40: operator output -31..+31, "-31 asr 5 = -1", "31 asr 5 = 0", sequence "-1 0 0 0 -1 0 0 0 ..."; TL $3F: "attenuation of 2^7.875 = 234.75 times", output -34..+34, DAC -2..+1. On an MD1 "you should see only 2 steps: from -1 to 0 and from 0 to +1. You won't see step from -2 from -1 because of glitch ... And step -1 to 0 will be HUGE (that is ladder effect)." - GManiac, p12991: "another glitch in MD1 DAC. Some larger levels have really less voltage. For example, +35 is higher than +36. I don't know concrete values." (non-monotonic DAC; no numbers). - HardWareMan, quoted in p11810: oscilloscope pictures of "A very noticeable ladder effect"; p12972 (2011-03-18): new recordings, "abundant presence of the ladder effect in all of decaying sounds"; p24774 (2014-10-25): Rigol DS1074Z-S traces of headphone L, R and the YM2612 output pin. - Oliver_A, p11810 (2010-08-31), interpretation: "an offset is somehow added ... which results in a noticeable gap in the positive and negative interval around the zero mark." - Aly James, p19907 (2013-05-31), *model fitted by ear/spectrum to a PAL model 1 Mega Drive recording* (his FMDrive VST): "If sineout goes down past -0.009 then output a negative voltage almost 50 times lower then the clean maximum signal. Else output 0.0", low-pass filter it a little, add it to the clean signal. "same behavior is observed on the hardware when you mute a channel, you still ear the distorted part at lower volume". (Code withheld; the prose is the model.) - Sauraen, p26985, *guess*: "the logic is 100% correct, and it's an analog effect"; the two halves of the resistive divider need not meet in the middle and the step may depend on preceding output. He proposes a DAC-register test (hold +255 or -256 for a second, then step 4..-4) "sampling at the analog output pin". Not run in this part. - Eke, p26981: the effect "does not affect all negative values, only "small" ones" (his understanding). - blargg, p10446/p10462: US model 1 recordings show tones fading out "grossly quantized"; faint background static in Sonic Green Hill Zone. **6.6 YM3438 / Mega Drive 2 ASIC output.** - TmEE, p12981 (2011-03-18), *HW, MD2 ASIC, sound card capture*, GManiac's TL $3F test: "There seems to be -2, -1, 0 and +1 here. So even if there is none of higher percision DAC, there's no glitch that eats up few values." TL 71: "2 values left, alternating rapidly. No 9-bit DAC, but no glitch either..." (he seems to mean: no finer than 9 bits). Image `MD2YMtest.png`. - TmEE, p12973: "ASIC YM has this effect definitely not present in its output." His next sentence is ambiguous: a discrete YM3438 fitted in an MD1 by l_oliveira "has same problem in its output, which means ASIC YM is not based on it" (reads as: the discrete YM3438 showed the problem). But p13067 (2011-03-30): "I have confirmed that MD2 uses an YM3438 ... I did some tests as I did on my MD2 and to my surprise everything matched". Take p13067 as the later word; p12973 stands as an unresolved contradiction. - TmEE, p13067: the YM3438 "has very high impedance output that picks up lot of digital noise. Also the output is significantly louder than YM2612, and this all matches with MD2 output aswell." (p12973 had said "lower impedance": contradiction.) - TmEE, p8557/p8751: MD2 spectrogram harmonics "are different from your MD1 recording"; GManiac p8751 says a TA-07 clone in a Chinese MD2 and TmEE's MD2 spectrogram both showed the "ladder". (Conflicts with p12973; early, by eye.) - TmEE, p15027: 315-5478 / 5660 / 5700 / 5708 ASICs have "the least noisy output"; there are "trailing noises and other oddities that only happen on YM2612 and not on YM3438". - Nemesis, p15031: "we know it's a completely different DAC than in the discrete YM2612." - Mamizou, p21338 (2013-11-03): a YM3438 decapped at siliconpr0n.org, metal layer scanned; "definitely a different layout than the YM2612". **6.7 Board filtering (not the chip).** Eke, p10458, from schematics, from memory: MD1 has "only a low pass filter @~26.7 khz and a DC removal capacity before the stereo mixing chip, MD2 had ... something like 7Khz for LP if I recall correctly". TmEE, p8561: his modded MD2 rolls off "after ~15...16KHz". --------------------------------------------------------------------------- ## 7. DAC channel (registers $2A, $2B) - GManiac, p14109, 2011-10-21, "I tested in on HW": "FM Channel 6 and Reg $2A are independent of each other. "DAC mode" (Reg $2B) only chose output of one of them. If it is in "FM Mode" it outputs Channel 6 output. If it is in "DAC Mode", it outputs value stored in Reg $2A and normalized to scale of DAC (-512 to + 512). Normalization formula is (v - $80) * 4 where v = ($2A)." Channel 6's FM keeps running while the DAC is selected ("Yes, it does"). **Inconsistency to flag:** elsewhere he gives the accumulator/DAC range as -256..+256 (6.2); an 8-bit value placed in the top 8 of 9 bits would be (v - $80) * 2. The "* 4" and "-512 to +512" are as he wrote them. - Die: the $2A value feeds the upper eight bits of the 9-bit DAC input register; the ninth, least significant bit comes from $2C bit 3 (Sauraen p26996, HardWareMan p15081; see 10.2). The multiplexer chooses "program sample or accumulator sample" (p15097). - Manual (p11860): 8-bit data, "sampling rate for this is 55.5 kHz" (for an 8 MHz clock, TmEE p11861). GManiac p11862: that is the per-channel output rate, not how fast one can write. - Write rate in practice, *HW*: TmEE p11861/p11864/p11867: polling BUSY he gets about 33 kHz on MD2 and MD1s, with missed writes above about half the sample rate. GManiac p11862: "One console let me writings at 32 kHz, while other - at 24 kHz." - MAME's scaling of the DAC value, (data - 0x80) shifted left 6 in a 14-bit channel (Eke p9005): *from emulator*. --------------------------------------------------------------------------- ## 8. Status and BUSY, write timing - Manual (p11859): "The minimum wait time between writes to addresses $21 through $B6 is 17 clock cycles." - Stef, p25392, 2014-12-22, *HW* (his XGM Z80 driver on a console; model not stated): "the BUSY bit of the YM2612 can be read only on port 0 and not from any port as we can read in many documentations." Nemesis (p25400) had not known; "No emulators emulate access delays to the YM2612 ports right now, Exodus included." - Stef, p25406, 2014-12-26, *HW observation*: "the busy cycle after writing port 0 or port 2 is quite short (28 Z80 cycles is enough) but it can much longer after a write to port 1 or 3, it can take up to 75/80 Z80 cycles ! ... the "Key on/off" register requires more than 60 cycles for instance." (He does not say whether these are Z80 clock cycles or T-states of his loop; treat as rough.) - TmEE, p8557: "on MD2 ... ASIC YM2612 is slower" (needed a fixed write routine). - Pin 10: Nemesis, p15000, *HW*: "pin 10 is actually the "TEST" pin ... it returns the realtime "busy" state of the YM2612, the same as what can be read from the status register. I've confirmed this through hardware tests." Named TEST in the YM3438 manual. Sauraen p26996 (die): BUSY "is permanently wired to the TEST pin output". - Sauraen, die analysis, on what BUSY is: p26964 (edit): "the BUSY flag is just a timer, not actually related to when the data is stored into the shift registers"; the write itself waits until the addressed channel/operator comes round in the shift register. p26985, hedged ("may be incorrect"): "the BUSY flag should not affect writes to the chip-level registers. That is, if you write to $52 and it goes BUSY, you should be able to write to $2A (DAC data) and it will accept that data ... But if you write to $62 it will drop that write if it's still busy." He asks for a hardware test; none in this part. (His earlier sentence in p26985, that BUSY clears when the written channel's cycle comes round, is overtaken by the p26964 edit.) - IRQ: Sauraen p27032: the status unit holds BUSY and the two timer overflow flags and "the logic, just an AND, which produces the IRQ output from the two overflow signals" (die; "AND" as written, polarity not stated). - HardWareMan, p8649, opinion: register access is asynchronous; timers and BUSY scale with the chip clock. - Open (Stef, p27104): may the data port be written immediately after the address port? Unanswered in this part. --------------------------------------------------------------------------- ## 9. Timers, CSM, channel 3 Little in this part. - Eke, p9166: his core then matched "Nemesis last findings regarding CSM and SSG-EG modes (verified with his test ROM)". No detail. - Test bit $21:2 makes the timers run 24 times faster (10.1). - TmEE, p16577: on a YMF276 wired write-only beside the original chip, timers were read from the original. - TmEE p13441: the YMF288 has "No CSM mode" (another chip). --------------------------------------------------------------------------- ## 10. Test registers **10.1 $21, bit by bit.** Sauraen, p26964, *die analysis for where the wire goes; the function "From testing" is other people's hardware tests* (exact): ``` 21:D7 Goes to parallel data output unit. From testing, selects MSB or LSB of output. 21:D6 Goes to parallel data output unit, and status flags output unit. From testing, 0 is read status flags, 1 is read parallel data output. 21:D5 Goes to EG control unit. From testing, 1 disables EG clock. 21:D4 Goes to MSB of channel accumulator unit (probably sign bit). From testing, "inverts output" (changes sign bit without changing other bits?) 21:D3 Goes to PG control unit. From testing, 1 disables PG clock. 21:D2 Goes to timer unit. From testing, 1 makes timers run off FM clock (24x faster) instead of sample clock. 21:D1 Goes to unknown control unit (large block above PG). 21:D0 Goes to parallel data output unit. Function unknown—maybe selects which channel to read output of? ``` He suspects (p26964) D5 and D3 "actually just prevent writes of the recalculated phase or attenuation value back to the list" rather than stopping a clock. **10.2 $2C, bit by bit.** Sauraen, p26996, 2015-09-26, *die analysis* (exact): ``` $2C:7 - Selects whether the TEST pin is an output or input. (Presumably 0 = output, 1 = input, since power-up state is output.) $2C:6 - Goes to the same unit as the TEST pin's input wire, which is a small control unit at the upper right of the EG. ... $2C:5 - Goes to a few places (probably some sort of control) around the DAC output register block. (By others' testing, causes the Ch6 DAC output value to be used in place of all channels except Ch5, or something like this.) $2C:4 - Goes to the control unit for the accumulator-to-DAC parallel output (which can be read from the data bus). Same control unit as $21:7, $21:6, and $21:0 go to. $2C:3 - Ch6 DAC ninth (least significant) bit. ... It goes into the ninth bit of the DAC output register block, in an exactly corresponding place as where the eight signals from $2A go into the first eight bits. ``` Sauraen's first idea for bit 5 (p26964): the DAC value is "output on all 6 channels' cycles, instead of only on the cycle of channel 6. This would explain why it got louder and why all channels' LR bits affected it". HardWareMan (p15081, p27002) and Nemesis (p15082) had guessed the ninth bit earlier. **10.3 Reading internal data through the status port.** Sauraen, p27032, 2015-09-29, *die analysis*, polarity untested: - A 16-bit value is gated onto the data bus, high or low byte chosen by $21:7 ("polarity unknown"); enabled by $21:6. - $2C:4 chooses the source: "I'm assuming that 0 means read 9-bit channel output and 1 means read 14-bit operator output." The channel value comes from the top of the operator accumulator "right by where the output goes to the DAC"; its top five bits "are connected together and pulled-up or pulled-down (can't quite tell which)". - "Bit 14 ... the value of bit 14 is one of those bits if $21:0 = 0 and the other if $21:0 = 1. Both ... come from the top of the EG; one comes from near the end of a 10-bit structure (possibly overflow or sign?), and the other comes from a complex logic unit". - "Bit 15 ... comes from the very lower right corner of the PG ... (probably carry/overflow bit)." - "Since we can read the output of each operator individually from the chip using this, we can implement the same thing in an emulator and compare the two at bit accuracy." **10.4 Nemesis on $2C** (p15082, speculation): its upper two bits may mirror $21's read-out bits. Superseded by 10.2. **10.5 YMF276 (OPN2L) differs.** TmEE, p16567, 2012-08-10, *HW*: "the test register $2C has different functions, and few tracks in Shinobi III write garbage to that reg, and cause the chip to go silent (and it is luck it does not happen on 2612/3438). There is no "loud PCM mode" but instead 2 bits that turn off FM in different ways ... and one bit that seems to halt EG". The YMF276 otherwise register-compatible, "really has 16 bit sound output" through an external DAC (p16567, p17325). --------------------------------------------------------------------------- ## 11. Clocking and sample rate - Chip clock on the Mega Drive = master / 7: "53/7=7.6 MHz" (GManiac p8642); 7.6704545 MHz (blargg p10441). Internal clock = chip clock / 6 (Sauraen p27060: "the main internal clock, which is the external clock divided by 6"). 24 internal clocks (one per operator of each channel) = 144 chip clocks per sample: 53,267 Hz (blargg); GManiac uses 52781 (PAL figure). Channel slot rate = clock / 24 = about 317-320 kHz. - Under- and over-clocking, *HW*: TmEE p8811: MD2 run from a 3.6 MHz master, "YM output is nicely ~4000Hz", music correct when sped up 14 times. HardWareMan p9020: YM2612 at VCLK/2 works, "I can't make YM2612 work at VCLK/4 and more". mikejmoffitt p27062: at a very low clock "it seemed to lose its internal state, and it may have been around 1/4". TmEE p27081: ran at 500 kHz ("only DAC worked") and about 16 MHz. Sauraen p27060: dynamic memory, so a minimum clock. --------------------------------------------------------------------------- ## 12. Reset / power-on Nothing measured in this part. Nemesis p14196: the chip "will power up outputting silence due to the way the other registers are initialized"; the internal cycle at power-on may be arbitrary (speculation). Sauraen p26996: TEST pin powers up as an output (presumed). --------------------------------------------------------------------------- ## 13. Variants - YM3438 = OPN2C (manual). MD2 ASIC behaves as a YM3438 in TmEE's tests (p13067). - YMF276 = OPN2L, FM Towns II, digital output to an external DAC (p13447, p16567). - Clones TA-07 and SE-95 (Chinese, per TmEE p18698); HardWareMan p14859: the TA-07 die "is made almost by copy-paste technique". - YM2203: same operator pipeline with three channels (Sauraen p27060). --------------------------------------------------------------------------- ## 14. Facts from posts by nukeykt and jotego None in this part. No post in p8557-p27104 is by either author. --------------------------------------------------------------------------- ## 15. Recordings, test ROMs, images and files linked Most 2009-2013 hosts (fileden, imageshack, savepic, monsterup) are probably dead; URLs are as printed, many truncated with "..." by the forum. | What | URL as printed | Who | Ran on / shows | |---|---|---|---| | `sweep_1000.rar`: sweep ROMs with source, plus `mirror.asm` | http://shedevr.org.ru/ghost/ym2612/sweep_1000.rar | GManiac (Ghost), p8560 | test programs for a real MD; megadrive-python already pins this file | | `mirror_2048_140.jpg` spectrogram | http://shedevr.org.ru/ghost/ym2612/mirror_2048_140.jpg | GManiac, p8560 | his MD recording of the mirror demo | | `YM_Emu.rar`: Delphi YM2612 emulator, Russian comments, no SSG-EG or ch3 mode | http://shedevr.org.ru/ghost/ym2612/YM_Emu.rar | GManiac, p18736 | **source code, licence unknown: not to be read without checking** | | MD2 spectrograms / waveform, `...1000Hz.jpg`, `YM77.jpg`, `YM672.jpg`, `YM772.jpg`, `YM672.png` | http://www.fileden.com/files/2008/4/21/... (truncated) | TmEE, p8557, p8561 | audio-modded MD2, 48 kHz card | | `ARIEL.RAR`: mic vs line-in recording | fileden (truncated) | TmEE, p8763 | MD2, aliasing demonstration | | Half-clock recordings, Comix Zone (5.3 MB), Batman & Robin (29 MB / 170 MB) | links not printed | HardWareMan, p9020 | MD with YM2612 at VCLK/2 | | `ym2612FrequencyWriteOrder.bin` and `.asm` | http://nemesis.hacking-cult.org/MegaDri ... eOrder.bin (truncated) | Nemesis (quoted p9457) | plays A6 on hardware; megadrive-python pins the .bin | | `genesis_recordings.zip` (mp3, 2.6 MB): Wonder Boy in Monster World, Target Earth and others | link text only | blargg, p10446, p10459 | "US MD1 (the revision that shows the "licensed by sega"...)" | | YM3438 manual page images (DAC, accumulator, read mode, OPN differences) | http://www.monsterup.com/upload/1266919197124.gif and seven more | Eke, p10466, p10467 | scans of the Japanese manual | | Translation thread | http://www.romhacking.net/forum/index.p ... 422.0.html | Paul Jensen, BRPXQZME; relayed p11859-p11873 | translations of those pages | | MD2 PCM and FM waveforms `...CM_MD2.png`, `...FM_MD2.png` | fileden (truncated) | TmEE, p11811 | MD2 | | "New records from Yamaha" | link not printed | HardWareMan, p12972 | discrete YM2612, ladder effect in decays | | `MD2YMtest.png` | http://www.hot.ee/tmeeco/PICS/MD2YMtest.png | TmEE, p12981 | MD2 ASIC, TL $3F sine: levels -2..+1 | | `FMDocs.7z` (140 MB) | http://nemesis.hacking-cult.org/MegaDri ... /FMDocs.7z | Nemesis, p13442 | his document collection (megadrive-python pins it) | | YMF288 note | http://www.ylw.mmtr.or.jp/~hosino/ma-ne ... ymf288.txt | cited by Nemesis | Japanese text, other chip | | YM2612 and TA-07 die thumbnails | http://savepic.net/2658093m.jpg, 2641709m.jpg, 2670220m.jpg | HardWareMan, p14859, p14871 | first decap pictures | | YM2612 die photograph, stitched, 24516x21770, 116 MB | http://nemesis.hacking-cult.org/MegaDri ... tiched.jpg ; PSD: ... hed_PSD.7z (about 700 MB) | HardWareMan; mirrored by Nemesis, p14998, p15018 | "Feel free to use it as you wish" (p14859) | | DAC region pictures and oscilloscope shot | http://savepic.su/1692466.jpg, 1700658.png, 1643350.png, 1699689.png, 1684328.png, 1714262.png, 1723272.jpg | HardWareMan, p14976-p15081 | die crops; MOL/MOR scope | | DAC schematic sketch | http://savepic.ru/7837847.jpg, http://savepic.ru/7821463.png | HardWareMan, p26980 | his reading of the DAC | | Functional block overlay of the die; DAC trace `...g-wip2.png` | "chip parts so far" (no URL); https://www.dropbox.com/s/kbsocon4v6v14 ... g-wip2.png | Mamizou, p15663, p19163 | die annotation | | Nemesis's operator diagram | http://nemesis.hacking-cult.org/MegaDrive/Documentation/YM2612%20Notes/ym2612%20operator.png | Nemesis (shown p18715) | his diagram | | `...vs276.flac`, `...oreVs.flac`, `...undMod.jpg` | fileden (truncated) | TmEE, p16567 | MD2 ASIC on one side, YMF276 + external DAC on the other | | Ladder model picture and waveform | http://www.alyjameslab.com/tutorials/YM2612LADDER.jpg, http://www.alyjameslab.com/tutorials/YM2612_Ladder_waveform.png ; WAVs "Megadrive PAL model 1 recording", "FMDrive MD1 mode recording", YM2164 (FB-01) clean signal (link text only) | Aly James, p19907 | PAL model 1 MD; megadrive-python pins `MD1_LADDER.wav` from the same site | | Aly James's other thread | viewtopic.php?t=1402&start=21 | p19769 | FMDrive thread, ladder discussion | | Oscilloscope traces: headphone L/R and YM2612 pin; Battletech music 12 | http://savepic.org/6325557.png and twelve more | HardWareMan, p24774 | Rigol DS1074Z-S on a console | | Die annotation pictures | http://i.imgur.com/lbLtEJs.jpg, yt0p3IV.jpg, J5lfNGM.jpg, QvnRFS9.jpg | Sauraen, p26964-p27032 | register blocks, address decoder, read-out unit | | YM3438, YM2203, YM2413 die scans | siliconpr0n.org (link text only) | "someone at siliconpr0n.org", p21338, p25362 | check author before use | | OPL2/OPL3 decapsulation document | http://docs.google.com/View?docid=dd8kqn9f_13cqjkf4gp | cited by dtech, p11205 | other chips | | andlabs's emulator | http://github.com/andlabs/ym2612 | andlabs, p18817 | source, licence unknown, built on Nemesis's posts | | sigMate's hardware board thread | viewtopic.php?t=1122 | p15160 | a YM2612 test rig | | Test-register thread | viewtopic.php?t=1118 | cited by Nemesis p15082 | $2C discussion | | Sonic Retro thread | http://forums.sonicretro.org/index.php?showtopic=28589 | p15118 | not described | | Genesis Plus GX `ym2612.c` | code.google.com link, p9166 | Eke | **excluded source: do not open** | Also announced: Nemesis's emulator Exodus, whose YM2612 core was written "in tandem with my testing", comments marking "what's been backed up by hardware tests", open questions marked `//##TODO##` / `//##FIX##` (p18777, p21355). Licence to be checked in the files. --------------------------------------------------------------------------- ## 16. Open questions left in this part 1. Vibrato precision: is the modulation computed from all 11 F-number bits with carries, or only from the upper bits (2.6)? Nemesis leaned to full precision, never tested. 2. AM shift values {8, 3, 1, 0}: Nemesis could not say they were measured (5.1). 3. LFO when disabled and re-enabled: held at 0 (Nemesis 2012) versus level held (Eke 2009); what the vibrato does while disabled; LFO update position in the sample (5.2). 4. F-number latch: shared between channels or per channel; channel 3 special-mode registers (2.9). 5. Key-on channel values 3 and 7 (1.5). 6. Feedback shift amounts per level; exact conversion of the summed two outputs. 7. Accumulator upper limit +255 or +256; 512 or 513 levels (6.2). 8. DAC register scaling: "(v - $80) * 4", "-512 to +512" against a 9-bit DAC (7). 9. The ladder effect as numbers: size of the step at zero, the equal -1/-2 levels, the non-monotonic levels (+35 above +36), dependence on preceding output; cause (logic or analogue) unsettled (6.5). 10. Whether a discrete YM3438 shows the effect (TmEE p12973 against p13067), and its output impedance (6.6). 11. Multiplexing order of the six channels (6.4). 12. BUSY: its length per register, whether it is a fixed timer, whether writes to $2x registers are accepted while busy and others dropped, whether data may follow address at once (8). BUSY readable only on port 0: one report, console model not given. 13. Which sample cycle each channel's envelope updates in; EG state at power-on (3). 14. Polarity and exact contents of the test read-out ($21:7, $21:0, $2C:4), function of $21:1 and $2C:6 (10). 15. Channel clipping on the YM3438/ASIC and its DAC resolution beyond TmEE's one test. --------------------------------------------------------------------------- ## Slips and skips - **p8905 (Nemesis), repeated in the quote in p16391:** contains a two-line comment quoted from the MAME FM core inside a [QUOTE] block (about 2048 FNUMs and one more bit of LFO precision). It is a prose comment, not code, and was read before it could be recognised. Nothing from it is used except Nemesis's statement that it is wrong. - **p10460 (Eke):** quotes blargg's two-line change to Genesis Plus GX's pan mask as plain text inside a [QUOTE] (the same block was withheld in p10459 but the quote escaped the filter). Read in passing; not recorded above beyond blargg's prose description (mask the low 7 bits of each channel). - **p16391 (Eke):** prose description of how MAME computes its phase increment (16.16 fixed point, table layout); code blocks withheld, prose read. Emulator description, not used. - p14187/p14196 quote one line of Nemesis's own core and one equivalent line he wrote; his own, kept (3.6). - p14906 (Nemesis): one line of his VDP core; irrelevant. - Nothing credited to the excluded author was met. siliconpr0n.org die scans are mentioned (p21338, p25362) without an author: check before fetching. - Not opened: any link. Nothing was fetched. ## Withheld blocks that look like measurements None is hardware measurement data. For the record, what the prose says each is: p8909 (Eke: his modified phase update, and MAME's LFO PM table), p9457 (MAME block/fnum code), p10459 (blargg's GPGX edit), p14104/p14105 (andlabs's outline of a YM2612 cycle), p14988 (TmEE: ASCII sketch of one DAC with L/R switches), p16391 (two MAME lines), p16431 (Eke: two versions of his AM line), p18823 (andlabs: two EG loop shapes), p18836 (TmEE: two ASCII sawtooth sketches), p19743 (Eke: his "ideal" DAC offsets, computed not measured), p19907 (Aly James: FMDrive ladder snippet, offered with "credit would be nice"; its prose equivalent is in 6.5), p27104 (Stef: Z80 write sequence).