Now to tell the story of how I made this discovery. I make chiptunes, so as I was working with the Donkey Kong disassembly, the game's sound code got my curiosity as well. The game uses its own processor to handle music and most sound effects, so the sound code is completely separate from the main program and I had to start my disassembly from scratch. I'd never done assembly language for a microcontroller before, and I must say it's wonderfully weird compared to microprocessor ASM! I'm familiar with ASM for several different CPUs, but this isn't quite like any of those.
Anyway, when I started, I didn't have any particular aim other than finding out how the program worked. I found a few interesting things. For instance, you know that rapidly descending series of notes while Mario is spinning when he dies? I found out that's not stored as a series of notes, but generated mathematically.
Reverse engineering a program is a lot like stumbling around in the dark. You poke at random things to see what happens. Since the sound code is on a different CPU from the main program, I could do whatever I liked with it without it ever crashing the game or even affecting it (other than sound). Believe me, this made things much easier! So I spent a lot of time in MAME's debugger calling routines or changing registers to find out what they did. One of the routines would start playing random tunes or glitchy nonsense whenever I called it. Imagine my shock when it started playing music I'd never heard before!
Unfortunately, this was not enough. I could make it play hidden music, but I couldn't do it reliably. It took a while to decode what the routine was actually doing so I could make it play whatever I wanted. But eventually I did, so I was able to find all the hidden tunes and voice clips and be reasonably confident that there weren't any more.
So, like many great discoveries, this one was quite by accident.
(warning: this next paragraph is for technonerds only!)
By the way, if anyone wants to have a look at my disassembly of the sound code, you can find it in dkong-snd.asm
here. This github repository I put up also contains a copy of the disassembly of the game's main program (that is, the gameplay stuff, not the sound stuff) in dkong.asm. This copy was taken from the wiki, but unlike the version on the wiki, this one has some preliminary effort put toward replacing raw offsets with labels. My intention at the moment is to keep the wiki's version for a "raw" disassembly that uses raw offsets and use github for a polished disassembly that looks like what the programmers at Ikegami and Nintendo might have written. But that's a subject for another thread...
(BTW, I ask that the disassembly of the sound code remain on github and not be added to the wiki. It would be messy having it in two places, and github still allows other people to contribute. Of course, a link to it on the wiki would be fine.)