# The FM part Four keyable 4-operator channels with the OPNA's FM (OPNA LFO, stereo switches, SSG-EG). Citations as in [registers.md](registers.md). The YM2610 manual describes the registers but not the FM's behaviour; the behaviour comes from the OPNA manual (the same FM, [DOC AM "Additional Information"] calls the YM2610 an OPNA relative), ymfm, and the closed box. ## Channels and slots - Part I $x1, $x2 are channels 1 and 2; part II $x1, $x2 channels 3 and 4. [DOC AM ยง5 table, "Write Data (FM)"] Register column 0 ($x0) of either part exists but does not sound: keyed on, it stays silent, while columns 1 and 2 of both parts swing +-4084. [OBSERVED lle:fm] ymfm masks the same two channels (mask $36 of six). [DOC ymfm ymfm_opn.h:657] The variant field `column0_keyable` (decision 6) is False for this chip. - $28: D7-D4 key slots 4-1 on (1) or off (0); D2-D0 the channel: D2 the part, D1-D0 the column (so 1, 2, 5, 6 here). [DOC AM "Write Data (FM)"; OPNA p. 18] - Operator registers: offsets +0, +4, +8, +C from the channel's address are **slots 1, 3, 2, 4**. [DOC OPNA p. 20, Table 2-2] The closed box keys them with $28 bits D4, D6, D5, D7 respectively. [OBSERVED lle:fm, slots] The YM2610 manual's "internal register address" table lists slots 1-4 at $x1, $x5, $x9, $xD in order, i.e. slot 2 at +4. [DOC AM "Write Data (FM)"] Contradiction **C11**; the core follows the OPNA manual and the closed box. - Slot 4 is always a carrier. [DOC OPNA p. 21] ## Phase generator - F-number 11 bits ($A1-$A2 low 8, $A5-$A6 bits 2-0 high 3), block 3 bits ($A5-$A6 bits 5-3); write the high register first. [DOC AM; OPNA p. 24] - The OPNA formula F = 144 x f x 2^20 / phi M / 2^(B-1) [DOC OPNA p. 24, where the transcription prints 2^20 as "220"] means a phase step of **(F << B) >> 1** per sample in units of 2^-20 of a cycle. ymfm and Geolith compute ((2F) << B) >> 2, the same, keep it to 17 bits after detune, then multiply. [DOC Geolith 455-487] - MUL: x1/2 for 0, xN for 1-15. [DOC OPNA p. 26, Table 2-5] - Key code: block in bits 4-2, then N4 = F11, N3 = F11 (F10 + F9 + F8) + !F11 F10 F9 F8 (F11 the F-number's top bit). [DOC OPNA p. 25] - Detune: DT bit 2 is the sign, bits 1-0 the size; the OPNA manual's Table 2-6 (Hz at 8 MHz) gives the size per block and note. ymfm's 32 x 4 table [DOC ymfm ymfm_fm.ipp:181-190] equals the manual's figures in all 96 places, with one unit = phi M / 144 / 2^20 = 0.05298 Hz (`python3 -I validation/check_tables.py`). [DOC OPNA p. 26] The core builds the table from the manual's figures. ## Operator output - The operator's output is a log-sine lookup plus the envelope's attenuation, converted back through an exponent table, then signed. [DOC ymfm ymfm_fm.ipp:470-488] ymfm's two 256-entry tables (quarter-wave log-sine in 4.8 format, 10-bit exponent mantissas) are, by ymfm's note, "the internal format of the OPN chip, extracted from the die" [DOC ymfm ymfm_fm.ipp:49, 89], and both equal closed forms exactly: round(-log2(sin((i + 1/2) pi / 512)) x 256) and round(2^(i/256) x 1024) - 1024 (256 of 256 each; `validation/check_tables.py`). Rung 0 computes them from the closed forms and checks them against ymfm. - Full scale: one carrier at TL 0 peaks at +-4084 in the serial word. [OBSERVED lle:fm] That is ymfm's largest exponent entry ((0x3FA | 0x400) << 2 = 8168) halved by the YM2610's one-bit FM scaling. [DOC ymfm ymfm_fm.ipp:95-96, ymfm_opn.cpp:2180-2181] - TL: 7 bits, 0.75 dB a step, $7F = 96 dB. [DOC OPNA p. 32, Table 2-9] TL 8 and 16 halve and quarter the peak (4084, 2042, 1021). [OBSERVED lle:fm] ## Algorithms and feedback - Eight algorithms [DOC OPNA pp. 21-23]: 0 S1-S2-S3-S4 in series; 1 (S1 + S2) modulate S3, then S4; 2 S1 and (S2-S3) modulate S4; 3 (S1-S2) and S3 modulate S4; 4 S1-S2 and S3-S4 in parallel; 5 S1 modulates S2, S3 and S4; 6 S1-S2 plus S3 and S4; 7 all four in parallel. (From the manual's prose; its figure is in the page renders.) - Feedback on slot 1 only, FB 0-7: off, pi/16, pi/8, pi/4, pi/2, pi, 2 pi, 4 pi. [DOC OPNA p. 21, Table 2-3] How the two previous outputs are averaged and shifted is ymfm's ([DOC ymfm ymfm_fm.ipp, channel output]) and is judged at the FM rung: **U7**. ## Envelope generator - AR, DR, SR 5 bits; RR 4 bits; SL 4 bits in 3 dB steps, 15 = 93 dB; KS 2 bits. [DOC OPNA pp. 27-29, Table 2-7] - Effective rate = 2R + Rks, 0 when R = 0; RR counts as 2 RR + 1; capped at 63. Rks = key code >> (3 - KS). [DOC OPNA pp. 29-30, Table 2-8] - Attack is exponential, the other phases linear in dB. [DOC OPNA p. 27] - The envelope is clocked once every 3 samples [DOC ymfm ymfm_opn.h:123, ymfm_fm.ipp:1305-1309]; the per-rate increment pattern is ymfm's table [DOC ymfm ymfm_fm.ipp:147-166] and the attack step attenuation += (~attenuation x increment) >> 4 [DOC ymfm ymfm_fm.ipp:708-715]. ymfm says its rate 62/63 attack behaviour was confirmed by nukeykt (a die-model source); the core takes ymfm's rules, provisional, until the FM rung compares envelopes with the closed box: **U7**. - SSG-EG ($90-$9E, D3 enable, D2-D0 shape; AR should be $1F): eight shapes. [DOC OPNA p. 31] The state machine (inversion, hold, 4x step below the midpoint) is ymfm's [DOC ymfm ymfm_fm.ipp:619-662]: provisional, **U7**. ## LFO - $22: D3 on, D2-D0 rate: 3.98, 5.56, 6.02, 6.37, 6.88, 9.63, 48.1, 72.2 Hz. [DOC AM "LFO Frequency"; OPNA p. 33] PMS (3 bits): 0, +-3.4, 6.7, 10, 14, 20, 40, 80 cents. AMS (2 bits): 0, 1.4, 5.9, 11.8 dB. AMON per operator ($6x D7). [DOC AM; OPNA pp. 33-34] - ymfm's dividers {109, 78, 72, 68, 63, 45, 9, 6} are "based on converting the frequencies in the applications manual", with an off-by-one that "tests on the hardware and nuked bear out" (no test named). [DOC ymfm ymfm_opn.cpp:214-227] - The closed box's tremolo period (AMS 3, one carrier, deepest point every period, read in 32-sample windows): about 610 samples at rate 7, 964 at rate 6, 13,100 at rate 0, i.e. about 91, 58 and 4.2 Hz. [OBSERVED lle:lfo] The manual's 72.2, 48.1 and 3.98 Hz and ymfm's dividers predict about 768, 1,152 and 13,950 samples. Contradiction **C9**; the measurement is coarse (+-32 samples) and is **U6** until a finer probe repeats it. The core starts from the manual's table, provisional. ## Channel 2's special mode ($27 D7-D6) - With $27 = $40, channel 2's operators take separate F-numbers: slot 1 $A9/$AD, slot 3 $A8/$AC, slot 2 $AA/$AE, slot 4 the channel's own $A2/$A6. [OBSERVED lle:fm, multifreq; DOC OPNA p. 20, Table 2-2 note *1] A different mapping (slot 1 $A2/$A6, slots 2-4 $A8-$AA) was the Neo Geo Development Wiki's, set aside 2026-11-26: contradiction **C10** now has no standing source on that side, and the core follows the OPNA manual and the closed box. - $27 D7-D6: OPNA 01 CSM, 10 "effect sound" (separate F-numbers) [DOC OPNA p. 36]; ymfm: 10 = CSM, any non-zero = separate F-numbers [DOC ymfm ymfm_opn.h:198-199]. In the closed box $80 did **not** give separate F-numbers: all four operators sounded at the $AA/$AE pitch. [OBSERVED lle:fm] Contradiction **C12**, unexplained: **U8**.