Expansion Port Sound Module

From NESdev Wiki
(Redirected from EPSM)
Jump to navigationJump to search

The NES Expansion Port Sound Module is an aftermarket homebrew addition that adds 6 channels of 4-operator FM, 3 channels of Sunsoft 5B audio, and a six-instrument sampled drumkit to the front-loading NES. Your NES does not need to be modified - just plug it in the bottom and connect audio to it instead, where it's mixed with the 2A03 audio.

The EPSM uses Yamaha's YMF288 (OPN3) chip, which is a lower-power and smaller upgrade to the YM2608 without most of the sample playback abilities.

It can operate in two different access methods:

Universal access

Rising and falling edges of the OUT1 pin transmit 10 total bits, specifying two address lines and eight data lines. In this mode, it is compatible with all existing cartridges and can operate without any assistance from the cartridge.

$4016 Write (OUT1 rising)

7  bit  0
DDDD AA1.
|||| |||
|||| ||+-- DDDD and AA latched when this bit goes from 0 to 1
|||| ++--- D3=YMF288 A1 and D2=YMF288 A0
++++------ D7-D4 of value that will be written

$4016 Write (OUT1 falling)

7  bit  0
DDDD ..0.
||||   |
||||   +-- DDDD latched and write triggered when this bit goes from 1 to 0
++++------ D3-D0 of value that will be written

Caveat

A barely-noticed design flaw of the 2A03 imposes strict timing constraints on using the universal method: OUT0 through OUT2 are only updated on every APU clock, while the CPU only drives the intended value to the data bus here for one CPU clock. Updates must be preceded by OAMDMA or carefully starting a DMC DMA in order to put the CPU and APU in known alignment.

Mapper-specific access

In the alternative addressing mode, five of the ten EXP pins on the cartridge gain defined function:

EXP1 - EPSM -CE1
EXP3 - EPSM -CE2
EXP4 - YMF288 A1
EXP7 - YMF288 A0
EXP8 - EPSM +CE3

For example, if connected as follows,

EXP1 - EPSM -CE1 = R/W
EXP3 - EPSM -CE2 = -ROMSEL
EXP4 - EPSM A1   = CPU A1
EXP7 - EPSM A0   = CPU A13
EXP8 - EPSM +CE3 = CPU A14

the EPSM will have a suitable memory map for software that expects Sunsoft 5B audio

Tool support

Mesen-X has added support for EPSM for both kinds of access method. The mapper-specific method defaults to these fully-decoded addresses:

$401C = Reg write A1=0
$401D = Data write A1=0
$401E = Reg write A1=1
$401F = Data write A1=1

FamiStudio has a fork with experimental support of the EPSM, but currently no NES export supported as of 2021-12-01.