Explosion 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 continuous looping sound effect using the TS2068’s SOUND command, which directly controls the AY-3-8910 sound chip registers. Line 10 sets multiple registers in a single statement using semicolon-separated pairs: registers 6–10 configure the noise period and mixer settings, while registers 12 and 13 set the envelope period and shape. Line 20 pauses for approximately two seconds before line 30 silences the tone channels by zeroing registers 8–10 (the amplitude registers), and the loop restarts via GO TO 10.


Program Structure

The program is a four-line infinite loop with a straightforward flow:

  1. 10 — Initialise and trigger sound via the AY-3-8910 chip
  2. 20 — Wait approximately 2 seconds (PAUSE 100 = 100 × 1/50 s)
  3. 30 — Silence the output by zeroing amplitude registers
  4. 40 — Loop back unconditionally to line 10

AY-3-8910 Register Usage

Line 10 uses the TS2068 SOUND keyword (encoded as } in zmakebas source) with seven register/value pairs separated by semicolons. The registers addressed are:

RegisterValueFunction
66Noise period
77Mixer control (enables noise on channels A & B, disables tone)
816Channel A amplitude — envelope mode enabled (bit 4 set)
916Channel B amplitude — envelope mode enabled (bit 4 set)
1016Channel C amplitude — envelope mode enabled (bit 4 set)
1256Envelope period (coarse byte), sets overall envelope duration
138Envelope shape — single attack, no hold/sustain (shape 8 = /___)

Setting amplitude registers 8–10 to 16 (binary 00010000) enables envelope-controlled amplitude on all three channels simultaneously, delegating volume shaping entirely to the envelope generator rather than fixed levels.

Notable Techniques

  • Multi-register SOUND in one statement: Semicolon chaining within a single SOUND call writes all seven registers atomically from BASIC’s perspective, minimising the gap between register updates and producing a cleaner sound onset.
  • Envelope shape 8: Register 13 value 8 selects a single-cycle rising ramp (attack only). Writing any value to register 13 re-triggers the envelope, so each loop iteration restarts the amplitude sweep from zero.
  • Explicit silence on line 30: Zeroing registers 8–10 after the pause cuts the noise burst cleanly before looping, creating a rhythmic on/off pattern rather than a continuous drone.
  • Register 11 omitted: The fine envelope period register (11) is not set, relying on whatever value it holds from a previous run or system initialisation. This could cause slight timing variability across sessions.

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

Explosion Sound Example

Source Code

10 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8
   20 PAUSE 100
   30 SOUND 8,0;9,0;10,0
   40 GO TO 10

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

Scroll to Top