From MegaDrive Wiki
Revision as of 11:29, 16 March 2015 by Tristanseifert (talk | contribs) (6 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This short article is in need of work. You can help us by adding to it.

The RF5C68A is a PCM playback chip that is capable of playing eight simultaneous channels. Samples are stored in sign-magnitude format instead of Two's Compliment, but conversion can be achieved by flipping the most significant bit of the sample.

Note that this article is written in the context of the Mega CD — while the information still applies to this chip in other systems, absolute addresses may not be the same as they are elsewhere. Please use caution when using this reference.

Sample Storage

In order to hold samples, the RF5C164 can connect to up to 64 KB of Mask ROM, PSRAM, or SRAM. In the case of RAM, this memory is accessible to the system the RF5C164 is connected to through windows of 4 KB each. This window is located at $1000 and goes up to $1FFF. To write to all of the memory, a banking mechanism is instituted in the chip that can change which of the 16 banks is currently accessible through this window. The active window can be changed through the control register.

Note that the RF5C164 uses $FF as a loop marker in audio samples, thus preventing it from being used as an actual audio value. The value can often be replaced with $FE with no adverse effects.


To control various aspects of the sample playback, including sample rate, panning, volume, address, as well as loop point, the RF5C164 has several registers through which these settings can be controlled. All registers except the sample start address are banked and will change depending on what channel is selected through the control register.

Register Map

Address Function
$0000 Envelope
$0001 Pan
$0002 Address increment low
$0003 Address increment high
$0004 Loop start address low
$0005 Loop start address high
$0006 Sample start address (high only)
$0007 Control Register
$0008 Channel on/off

Control Register

$0007 - Control Register
7 6 5 4 3 2 1 0
SE MOD 0 0 WB3 WB2 WB1 WB0
0 CB2 CB1 CB0
  • SE: When set, the chip begins producing sound, disabling all of the eight channels when cleared.
  • MOD: Controls the selection of what the lower four bits of the register do. When set to one, CB2-CB0 are read.

MOD = 1

  • CB2-CB0: Channel to access through channel control registers ($0000 to $0006)

MOD = 0

  • WB3-WB0: Bank to access through the PCM memory window.

The value contained in these bits is multiplied by $1000 and added to the lower 12 bits of the address when the PCM memory window is accessed.


$0000 - Envelope
7 6 5 4 3 2 1 0
  • ENV: This value is multiplied with the low 7 bits of the sample data to produce an unsigned 16-bit value.


$0001 - Pan
7 6 5 4 3 2 1 0
  • R and L: 4-bit values that are multiplied by the unsigned 16-bit value created after envelope calculation, resulting in a 19-bit unsigned value.

Address increment

This group of registers specifies the amount to increment the sample address by each sound cycle.

$0002 - Address Increment Low $0008 - Address Increment High
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

When a certain bit in each register is set, a value associated with that bit is added to the address each sample cycle. These values are:

Bit FDL Increment FDH Increment
7 2-4 24
6 2-5 23
5 2-6 22
4 2-7 21
3 2-8 20
2 2-9 2-1
1 2-10 2-2
0 2-11 2-3

Loop Start Address

These two registers, located at $0004 for the low byte, and $0005 for the high byte, store the address that will be loaded into the channel's playback address once $FF is read as sample data.

Sample Start Address

This register, located at $0006 stores the high byte of the start of the sample. The low byte of the address is always set to $00 and writes to this register will immediately load this combined value into the channel's pointer, starting playback at the new location on the next sample clock.

Channel on/off

$0008 - Channel On/Off
7 6 5 4 3 2 1 0

Each bit in this register corresponds to a certain channel, and when set, the corresponding channel will produce sound. The control register's master on/off bit has priority over this register, meaning that if the control register's on/off flag is clear, no sound will be produced, no matter what.

PCM RAM Locations

The register pairs at $0010 to $001F can be read to determine the location that the channel is playing. The even addresses hold the low byte, whereas odd ones hold the high bytes. The first registers at $0010 specify channel one, going up to channel two at $0012 and so on.


Download.png Download RF5C68A Datasheet
File: RF5C68A.pdf (512KB) (info)

Datasheet for the RF5C68A, a chip similar to the RF5C164.