OUAH! Sound Example

This file is part of Byte Power September 1986 . Download the collection to get this file.
Developer(s): Kristian Boisvert
Date: 1986
Type: Program
Platform(s): TS 2068

This program plays a short musical or sound effect using the AY-3-8912 sound chip, then waits for a keypress before silencing all sound generators. The SOUND command sequences configure the AY chip’s registers directly: registers 8–10 set channel volumes, register 7 controls the mixer (enabling tone/noise), registers 12–13 set the noise/envelope period, and registers 0–1 set channel A’s tone period. The REM statement on line 0 contains the title “OUAH!” and credits K. Boisvert and Byte Power (1986). The program uses PAUSE 0 to hold the sound until any key is pressed, after which register 13 is reset to stop the envelope generator.


Program Structure

The program is extremely compact, consisting of just four lines:

  1. 0 REM — Title and copyright banner embedded in a REM statement on line 0, a common technique to store metadata without affecting execution.
  2. 10 SOUND — Configures multiple AY-3-8912 registers in a single statement to produce a sound effect.
  3. 20 PAUSE 0 — Halts execution indefinitely until a key is pressed, allowing the sound to play out.
  4. 30 SOUND 13,0 — Resets envelope register 13 to silence the AY chip.

AY-3-8912 Register Usage

The SOUND statement on line 10 programs the following AY chip registers in sequence:

RegisterValueFunction
80Channel A amplitude — set to 0 initially (envelope mode not yet active)
90Channel B amplitude — off
100Channel C amplitude — off
816Channel A amplitude — bit 4 set, enabling envelope generator control
762Mixer register — value 62 (0b00111110): Channel A tone enabled, others off
122Envelope period fine (low byte)
1314Envelope shape — value 14 (0b1110): attack, alternate, hold; produces rising then sustaining envelope (“woof” shape)
0200Channel A tone period fine (low byte) — sets a low-pitched tone
11Channel A tone period coarse (high byte) — combined with reg 0: period = 200 + 256 = 456, giving ~240 Hz

Notable Techniques

  • The paired SOUND register writes in a single statement exploit the TS2068’s ability to write multiple register/value pairs, avoiding multiple lines and saving memory.
  • Register 8 is written twice: first to 0 to reset it, then to 16 to engage envelope mode. This double-write within one SOUND call ensures a clean envelope trigger.
  • PAUSE 0 without a subsequent INKEY$ check is used purely to suspend the program while the AY chip’s envelope hardware plays autonomously — no CPU intervention needed during playback.
  • Line 0 for the REM is a well-known trick: line 0 is always the first line executed but also stores metadata conveniently at the top of the listing.
  • The title “OUAH!” is French onomatopoeia for a dog’s bark (“woof”), which matches the envelope shape chosen (register 13 = 14 produces a sharp attack with sustain).

Content

Appears On

Tape-based magazine.

Related Products

Related Articles

This month we will talk about the envelope generator. To enable the generator you must put the value 16 to...

Related Content

Image Gallery

OUAH! Sound Example

Source Code

0 REM                                                            OUAH!                           WRITTEN BY K. BOISVERT          ©1986 BYTE POWER                        
   10 SOUND 8,0;9,0;10,0;8,16;7,62;12,2;13,14;0,200;1,1
   20 PAUSE 0
   30 SOUND 13,0

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top