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.
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.
||Address increment low|
||Address increment high|
||Loop start address low|
||Loop start address high|
||Sample start address (high only)|
- 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 (
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.
- ENV: This value is multiplied with the low 7 bits of the sample data to produce an unsigned 16-bit value.
- 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.
This group of registers specifies the amount to increment the sample address by each sound cycle.
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|
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.
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
$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 RF5C68A Datasheet
File: RF5C68A.pdf (512KB) (info)
Datasheet for the RF5C68A, a chip similar to the RF5C164.