MMC5 audio: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
m (Created page with '== Overview == Nintendo's MMC5 mapper provides extra sound output, consisting of two pulse wave channels and a PCM channel. The pulse wave channels behave almost ident...')
 
(PCM details updated. Verified on MMC5 hardware.)
Line 11: Line 11:
== PCM Mode/IRQ ($5010) ==
== PCM Mode/IRQ ($5010) ==


<b>NOTE</b>:  <i>MMC5 PCM was never used on any commercial NES or Famicom games.  The below documentation was supposedly taken from the MMC5 patent.  It has not yet been tested on hardware.</i>
<b>NOTE</b>:  <i>MMC5 PCM was never used on any commercial NES or Famicom games.</i>


=== Write ===
=== Write ===
  7  bit  0
  7  bit  0
  ---- ----
  ---- ----
  xxxx xxxM
  Ixxx xxxM
        |
|      |
        +- Mode select (0 = PCM Write Stream on.  1 = PCM Read Stream on.)
|      +- Mode select (0 = write mode. 1 = read mode.)
  +--------- PCM IRQ enable (1 = enabled.)


=== Read ===
=== Read ===
Line 25: Line 26:
  Ixxx xxxx
  Ixxx xxxx
  |
  |
  +-------- IRQ (0 = No IRQ triggered. 1 = $00 read during PCM Read Stream resulting in IRQ)
  +-------- IRQ (0 = No IRQ triggered. 1 = IRQ was triggered.) Reading $5010 acknowledges the IRQ and clears this flag.


==== PCM Write Stream Mode ====
== Raw PCM ($5011) ==
This functions exactly the same as the [[APU|NES APU]]'s register $4011, except that all 8 bits are used.  $5010 IRQs are not generated in this mode.
This functions similarly to the [[APU|NES APU]]'s register $4011, except that all 8 bits are used.


==== PCM Read Stream Mode ====
=== Write ===
The MMC5 digital channel has a circuit that automatically puts the data bus (D0-D7) read from anywhere in $8000-$BFFF into the DAC.  However, if a $00 byte is read, then an IRQ is generated by the MMC5 and acknowledged by bit 7 of $5010.  This could be used to read stream 8-bit PCM from ROM and terminate at $00.
It uses $8000-$BFFF because the 2A03 DMC uses $C000-$FFFF.  However, it will also wrap to $8000 when it increments from $FFFF though.  Interestingly enough this could be used to allow MMC5 and 2A03 playing the same data at the same time, although it will sound different because of the 8-bit MMC5 PCM format and the 7-bit 2A03 PCM or 1-bit DPCM.
 
== Raw PCM ($5011) ==
  7  bit  0
  7  bit  0
  ---- ----
  ---- ----
Line 41: Line 37:
  |||| ||||
  |||| ||||
  ++++-++++- 8-bit PCM data
  ++++-++++- 8-bit PCM data
== PCM description ==
MMC5's DAC is changed either by writing a value to $5011 (in write mode) or reading a value from $8000-BFFF (in read mode).  If you try to assign a value of $00, the DAC is not changed; an IRQ is generated instead. This could be used to read stream 8-bit PCM from ROM and terminate at $00.
It uses $8000-$BFFF because the 2A03 DMC uses $C000-$FFFF.  However, 2A03 DMC will also wrap to $8000 when it increments from $FFFF.  This could be used to allow MMC5 and 2A03 playing the same data at the same time, although it will sound different because of the 8-bit MMC5 PCM format and the 7-bit 2A03 PCM or 1-bit DPCM.
=== IRQ operation ===
(pseudocode)
(On DAC write)
    if(value=0)
        irqTrip=1
    else
        irqTrip=0
(On $5010 write)
    irqEnable=value.bit7
(On $5010 read)
    value.bit7=(irqTrip AND irqEnable)
    irqTrip=0
Cart IRQ line=(irqTrip AND irqEnable)


== Status ($5015, read/write) ==
== Status ($5015, read/write) ==
This register is analogous to the [[APU Status]] register found within the NES at $4015, except that only the bottom 2 bits are used; being for the MMC5's two pulse channels.
This register is analogous to the [[APU Status]] register found within the NES at $4015, except that only the bottom 2 bits are used; being for the MMC5's two pulse channels.

Revision as of 22:51, 3 January 2010

Overview

Nintendo's MMC5 mapper provides extra sound output, consisting of two pulse wave channels and a PCM channel. The pulse wave channels behave almost identically to the native pulse channels in the NES APU.

Pulse 1 ($5000-$5003)

These registers manipulate the MMC5's first pulse wave channel, which functions identically to those found in the NES APU except that it lacks sweep support.

Pulse 2 ($5004-$5007)

These registers manipulate the MMC5's second pulse channel.

PCM Mode/IRQ ($5010)

NOTE: MMC5 PCM was never used on any commercial NES or Famicom games.

Write

7  bit  0
---- ----
Ixxx xxxM
|       |
|       +- Mode select (0 = write mode. 1 = read mode.)
+--------- PCM IRQ enable (1 = enabled.)

Read

7  bit  0
---- ----
Ixxx xxxx
|
+-------- IRQ (0 = No IRQ triggered. 1 = IRQ was triggered.) Reading $5010 acknowledges the IRQ and clears this flag.

Raw PCM ($5011)

This functions similarly to the NES APU's register $4011, except that all 8 bits are used.

Write

7  bit  0
---- ----
WWWW WWWW
|||| ||||
++++-++++- 8-bit PCM data

PCM description

MMC5's DAC is changed either by writing a value to $5011 (in write mode) or reading a value from $8000-BFFF (in read mode). If you try to assign a value of $00, the DAC is not changed; an IRQ is generated instead. This could be used to read stream 8-bit PCM from ROM and terminate at $00.

It uses $8000-$BFFF because the 2A03 DMC uses $C000-$FFFF. However, 2A03 DMC will also wrap to $8000 when it increments from $FFFF. This could be used to allow MMC5 and 2A03 playing the same data at the same time, although it will sound different because of the 8-bit MMC5 PCM format and the 7-bit 2A03 PCM or 1-bit DPCM.

IRQ operation

(pseudocode)

(On DAC write)
    if(value=0)
        irqTrip=1
    else
        irqTrip=0

(On $5010 write)
    irqEnable=value.bit7

(On $5010 read)
    value.bit7=(irqTrip AND irqEnable)
    irqTrip=0

Cart IRQ line=(irqTrip AND irqEnable)

Status ($5015, read/write)

This register is analogous to the APU Status register found within the NES at $4015, except that only the bottom 2 bits are used; being for the MMC5's two pulse channels.