The Cutting Room Floor:Common Things/Bit Reversal
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 |
|---|
![]() |
| Bit-Reversed Data |
Contents
- 1 Background
- 2 List of Games With Corrupted Samples
- 2.1 Bomberman
- 2.2 Ganbare Goemon!
- 2.3 King Kong 2
- 2.4 Professional Mahjong Gokuu
- 2.5 Double Dribble
- 2.6 Contra
- 2.7 Gauntlet
- 2.8 Abadox: The Deadly Inner War
- 2.9 Quarter Back Scramble
- 2.10 Batman: The Video Game
- 2.11 A Boy and His Blob: Trouble on Blobolonia
- 2.12 Ghostbusters II
- 2.13 Power Blade
- 2.14 Shanghai II
- 2.15 Klax
- 2.16 Sword Master
- 2.17 Bomberman II
- 2.18 Metal Slader Glory
- 2.19 Ufouria: The Saga
- 2.20 Super Spy Hunter
- 2.21 Darkman
- 2.22 Rampart (Jaleco)
- 2.23 Gimmick!
- 2.24 Dragon Warrior III
- 2.25 Jurassic Boy 2
- 2.26 Mixed Sample Encodings
- 3 List of Games With Raw 1-bit PCM
- 4 References
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
- Some Konami Famicom and NES games reuse corrupted samples for the kick and snare drums but use the correct encoding for everything else. Examples: Gradius II, Super C, The Adventures of Bayou Billy, Track & Field II.
- Jurassic Park: The dinosaur shouts in the main menu are played using 7-bit PCM, and the kick and snare drums are played with bit-reversal samples.
- Nantettatte!! Baseball contains a bit-reversed timpani sample plus a kick/snare combo, and bass guitar samples encoded as raw 1-bit PCM.
- Power Blade 2
- S.C.A.T.: Special Cybernetic Attack Team
List of Games With Raw 1-bit PCM
These have samples encoded as raw 1-bit PCM instead of DPCM.
- After Burner II uses portions of its voice samples to create the drum sounds.
- Blaster Master
- Fester's Quest
- Just Breed
- Shadow of the Ninja: Use for player character and before final boss shouts sound.
References
- ↑ NESdev Wiki: DMC output unit
- ↑ Nintendo's Family Computer website
- ↑ Famicom technical documentation: Page 2 of "CPU & PPU" contains a CPU block diagram
- ↑ NESdev thread
- ↑ Twitter thread by bbbradsmith (video)
- ↑ "NES Sound: The DMC - Behind the Code" by Displaced Gamers
