# MSX-MUSIC and the FM-PAC (YM2413) MSX-MUSIC is the standard name for a YM2413 (OPLL) with the FM BIOS, built into many MSX2+ and turbo R machines (MAME 0.285: 12 of its MSX rows carry a `YM2413 OPLL`; census.md) and sold as cartridges: Panasonic's FM-PAC ("Pana Amusement Cartridge 2") first among them. Source: ASCII's MSX Datapack vol. 2, section 3.1 [DP2-3.1], in the English translation the MSX Assembly Page hosts. ## Programmer's model [DP2-3.1 tables 7.19-7.22] | Unit | Address register | Data register | | --- | --- | --- | | built in | I/O 7Ch (write) | I/O 7Dh (write) | | external (PAC2-compliant cartridge) | I/O 7Ch or memory 7FF4h | I/O 7Dh or memory 7FF5h | - Built-in versus external is told by an 8-byte string at 4018h of the unit's ROM: "APRLOPLL" for built in, "PAC2OPLL" for the Pana Amusement Cartridge 2 (another maker may put its own four bytes in place of "PAC2") [DP2-3.1 table 7.21]. - An external cartridge's OPLL is enabled by setting bit 0 of 7FF6h in its slot [DP2-3.1, step 5 of the detection procedure, Japanese text]. Two OPLLs on the same ports (built in plus cartridge) sound twice as loud [DP2-3.1 3.1.3]. - Waits the CPU must leave: 3.36 us after an address write, 23.52 us after a data write [DP2-3.1 table 7.22]. Direct access is discouraged in favour of the FM BIOS [DP2-3.1 3.1.4]; games do it anyway, so a too-fast write is the chip's business (ym2413-python's). ## The FM-PAC cartridge [MEGAROMS, "FM PAC"] 64 KB ROM (the FM BIOS and a program) in 16 KB pages at 4000-7FFF, selected by 7FF7h; 8 KB battery SRAM, mapped at 4000-5FFF after writing 4Dh to 5FFEh and 69h to 5FFFh (any other value hides it again); 7FF4/7FF5 the OPLL ports, 7FF6 bit 0 enables the OPLL (bits 0 and 4 are the only ones that read back). The census finds its program ROM once ("FM Pana Amusement Cartridge (Japan) (Program)", MAME list type `fmpac`). The FM-PAC ROM is Panasonic's firmware: bring-your-own, by SHA-1. C-BIOS ships a `cbios_music.rom` (BSD-2-Clause) for the built-in unit's ROM socket (bios.md). ## The family core [ym2413-python](../../ym2413-python) (clean-room restart, 514 tests on PyPy; its README): `OPLL(YM2413)`, `write(0|1, value)`, `run(clocks)`, `take_outputs()`. It has two consumers already (sms-python's FM unit, famicom-python's VRC7). The MSX needs nothing new: the board decodes 7C/7D (and 7FF4/7FF5 for a cartridge), clocks it at the bus clock (3.579545 MHz) and mixes. Its own claims hold (no console recording; the fifteen built-in voices are not a dump: ym2413-python's T1). ## Later MSX-AUDIO (Y8950, Philips Music Module / Panasonic FS-CA1 / Toshiba HX-MU900) and the Yamaha SFG modules (YM2151) appear in the census as program ROMs; ym2151-python exists for the SFG; the Y8950 (OPL with ADPCM) has no family core. Both are later rows.