If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!
This article has a talk page!

The Cutting Room Floor:Common Things/Bit Reversal

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of The Cutting Room Floor:Common Things.

DPCM bit reversal is a sample encoding error that's ubiquitous among Family Computer (Famicom) and Nintendo Entertainment System (NES) games which make use of the APU's DMC channel, but also one that was obscure enough to hide in plain sight for decades.

Original Data
NES-DPCMintended.png
Bit-Reversed Data
NES-DPCMcorrupted.png

Background

The NES' RP2A03/2A07 microprocessor contains an Audio Processing Unit (APU) which is made up of two parts. APU1 consists of two pulse wave channels, and APU2 consists of a triangle channel, a noise generator, and a configurable DMC channel.

The DMC channel can either play 7-bit PCM data via the $4011 register (at the cost of manually streaming sample data using the CPU), or it can be configured to automatically play up to 4081 bytes of 1-bit audio formatted using delta modulation (or DPCM) while leaving the CPU mostly free to do other tasks (this does lead to some hardware bugs, but they are irrelevant here). Most games using the DMC channel opted to use the latter for space and code reasons. However, with this method came a rather unusual quirk in the way the APU decodes DPCM data. A right shift register is used in the DMC output unit[1], creating an unintuitive right-to-left bit order for each byte of the sample.

Encoding samples with an incorrect bit order in each byte drastically corrupts the audio data (as seen in the triangle wave example above), as DPCM is reliant on sequential order. Nintendo was seemingly aware of this quirk before releasing Wild Gunman (February 1984),[2] as no game prior to this uses the DAC's capabilities and the gunman's "Fire!" speech was encoded correctly. Several first-party games after Wild Gunman also contain correctly-encoded samples, suggesting this was also known by R&D4 and SRD.

Original Sample
Bit-Reversed (corrupted)

However, many third-party developers may have been unaware of this quirk, as evidenced by DPCM samples encoded with an incorrect bit order. This is corroborated by the fact that technical documentation from the era is somewhat vague regarding the direction of the shift register.[3] It is possible that developers could have confused the sample encoding and/or dismissed the resulting corrupted sound as an inherent limitation of the format. The discoveries of bit-reversed DPCM samples in third-party games began with an accidental find in Double Dribble.[4] Subsequent investigations revealed the extent of DPCM bit-reversal and its undocumented status. One such example is Gimmick!.[5] As the game reuses samples from other Sunsoft games, it brought the revelation that those games were also affected by it.[6]

List of Games With Corrupted Samples

The following list is ordered by initial release date. This list includes both licensed and unlicensed releases.

Bomberman

December 19, 1985

Original Sample
In-Game

Ganbare Goemon!

July 30, 1986

no audio examples

King Kong 2

December 18, 1986

no audio examples

Professional Mahjong Gokuu

December 25, 1986 (Note: Internal disk info field lists December 18, 1986)

no audio examples

Double Dribble

July 24, 1987

Description Original Samples In-Game
"Double Dribble"
"Jump Ball"
"Free Throw"
"Dunk Shot" (unused)
Bouncing Basketball (FDS)

Contra

February 9, 1988

Original Samples
In-Game

Gauntlet

July 1988

no audio examples

Abadox: The Deadly Inner War

December 15, 1989

no audio examples

Quarter Back Scramble

December 19, 1989

no audio examples

Batman: The Video Game

December 22, 1989

no audio examples

A Boy and His Blob: Trouble on Blobolonia

January 1990

no audio examples

Ghostbusters II

April 1990

no audio examples

Power Blade

April 20, 1990

no audio examples

Shanghai II

August 24, 1990

no audio examples

Klax

December 14, 1990

no audio examples

Sword Master

December 21, 1990

no audio examples

Bomberman II

June 28, 1991

Original Samples
In-Game
Original Samples
In-Game

Metal Slader Glory

August 30, 1991

no audio examples

Ufouria: The Saga

September 20, 1991

Original Samples
In-Game

Super Spy Hunter

September 27, 1991

no audio examples

Darkman

October 1991

no audio examples

Rampart (Jaleco)

January 1992

no audio examples

Gimmick!

January 31, 1992

Original Samples
In-Game

Dragon Warrior III

March 1992

Note: Only applicable to the North American version, as the sample is used in an exclusive intro cutscene.

no audio examples

Jurassic Boy 2

February 25, 1994

no audio examples

Mixed Sample Encodings

List of Games With Raw 1-bit PCM

These have samples encoded as raw 1-bit PCM instead of DPCM.

References