Monday, February 17, 2020

Williams Defender Sound Disassembly

Here's something different, an in progress attempt to reverse engineer the sound board for the arcade game "Defender" (and others). The sounds are very recognizable, and unique to Williams arcade/pinball machines. They always interested me, so I'm making an attempt to understand them better.

The board is based around a 6808 CPU (relative of the 68000), and a DAC attached to an IO controller. The binary is floating around the web, as is this great disassembler: DASMx. I used it to disassemble the ROM into a code listing, and started commenting it.

Here are the schematics from one of the compatible service manuals:


I was able to use the schematics to figure out the memory map. This helps understand the significance of certain read/writes in the code.
RAM: $0000 - $007F (128 Bytes)
PIA: $0400 - $07FF
ROM: $F800 - $FFFF (2KB)

By loading the ROM into audacity I was able to see some recognizable shapes. These are the waveforms/look up tables stored alongside the code. Some are played directly, while others are used to modulate things like pitch, or volume.

There are some interesting tricks done in the code, and I hope to explain them here one day. Things like dynamically generated delay loops, and something akin to granular synthesis...

Until then, the current version of the commented disassembly lives here.

4 comments:

  1. Very interesting post. Would it be possible for you to share the original data file that you loaded into Audacity above, or explain that process in a little more detail? Thanks for writing this, its inspiring stuff.

    ReplyDelete
  2. Hi Alex,

    Thanks for reading!

    I'm not sure about the legality of sharing the binary (the disassembly is questionable enough).
    It can be found as part of the MAME ROM. Google should be able to pull it right up.
    You can also recreate it by assembling the source code I've posted.

    Loading it into Audacity is simple. Is that the part you're asking about?
    You use the "Import Raw Data" tool and select the ROM.
    The data is mono, 8-bit, though I forget if it's signed or not. Sample rate is irrelevant.

    - Zack

    ReplyDelete
  3. Hi Zack, thanks for your reply. I tried importing the defend.snd ROM into Audacity earlier and didn't see the waveforms in your image above, but now I see them at the end of the file. Maybe I had the wrong import settings for 'Import Raw Data'.

    I'm currently working on some audio code to be able to modulate pitch and volume using a similar technique (reading data from a lookup table), so I thought it would be interesting if I could use the defender data curves during development, to see if my code could recreate sounds similar to those in defender, before moving on to my own sound design using different curves and additional features. So really I just needed to know where in which data file I could find the data that I wanted to work with. So I'm good to go now.

    Very interesting stuff, hope you get inspired to explore more arcade machine audio in the future. The Williams stuff is especially interesting, they achieved a very high level of audio/visual synesthesia in their games during that time (Defender, Joust, Robotron etc).

    I actually found your site due to the Novation Bass Station schematic, since I bought one of those recently and it blew my mind. So I appreciate your other hardware related posting as well.

    ReplyDelete
    Replies
    1. Good, glad you were able to get it loaded.

      That would be very cool if you were able to synthesize these (or similar) sounds again! I've done my best to label the tables at the end of the disassembly. You should be able to throw them into an array easily.
      Anyway, I'd love to see this functionality re-implemented and expanded on somehow. Please let me know how your project goes.

      There are more tricks that involve multiplying and subtracting waveforms from each other.
      It likes to modulate pulsewidth independent of frequency too. The absolute width (not ratio) might stay constant as the pitch changes.

      Thanks for the kind words. Happy that you enjoy the hardware too. It's all kind of fascinating.

      Delete