Helicopter 2 Sound Example

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

This three-line program plays a musical or sound effect using the TS2068’s AY-3-8910 sound chip via the SOUND command, then loops continuously. The SOUND statement configures ten registers of the AY chip in a single call: registers 6 and 0–5 set noise period and tone/noise/envelope parameters, registers 9–10 and 8 set channel volumes, register 7 is the mixer control (value 48, enabling specific channel combinations), and registers 12–13 define the envelope period. The PAUSE 3 introduces a short delay of approximately 3/50ths of a second between repetitions before GO TO 1 restarts the loop.


Program Structure

The program consists of just three executable lines after the title REM, forming an infinite loop:

  1. 10 — Fire a multi-register SOUND command to the AY-3-8910 chip
  2. 20PAUSE 3 (~60 ms delay at 50 Hz)
  3. 30GO TO 1 (jumps back to line 0’s REM, effectively restarting from line 10)

GO TO 1 targets line 0’s REM rather than line 10 directly. Since a REM executes as a no-op, the loop still works correctly, but it is a minor inefficiency — GO TO 10 would be marginally faster as no line-search step is wasted.

AY-3-8910 Register Programming

The single SOUND statement on line 10 sets ten registers in one call using the TS2068 paired register syntax register,value:

RegisterValueFunction
618Noise period (18 = relatively low-frequency noise)
0250Channel A tone period (low byte)
17Channel A tone period (high byte) — combined ~1786 giving a low pitch
2255Channel B tone period (low byte)
37Channel B tone period (high byte)
4255Channel C tone period (low byte)
57Channel C tone period (high byte)
916Channel B amplitude — envelope-controlled (bit 4 set)
1016Channel C amplitude — envelope-controlled (bit 4 set)
816Channel A amplitude — envelope-controlled (bit 4 set)
748Mixer: binary 00110000 — noise enabled on channels A & B, tones on all disabled
122Envelope period (low byte) — fast envelope cycle
130Envelope shape: single decay, no repeat

All three channels have their amplitude registers set to 16 (envelope mode). Envelope shape register 13 = 0 selects a one-shot decaying waveform. The mixer value 48 (0b00110000) enables noise on channels A and B while disabling all tone outputs, producing a purely noise-based percussive burst reminiscent of rotor noise — consistent with the “HELICO” (helicopter) title.

Notable Techniques

  • Using a single SOUND call with multiple register pairs is the most efficient way to set up a complex AY sound in one atomic operation, avoiding audible gaps between register writes.
  • Setting all amplitude registers to 16 ties all three channels to the single hardware envelope generator, giving a unified volume contour without per-channel software timing.
  • The PAUSE 3 acts as a minimal delay so the envelope has time to complete its decay before the next trigger, preventing the registers from being re-written mid-cycle.
  • The REM at line 0 serves as a program header/splash, storing the title and copyright in a location that costs nothing at runtime since the loop re-enters at line 10 after the first pass — though as noted, GO TO 1 does needlessly scan past line 0 on each iteration.

Appears On

Tape-based magazine.

Related Articles

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

Image Gallery

Source Code

 0 REM                                                            HELICO 2                        WRITTEN BY K. BOISVERT          ©1986 BYTE POWER                           
   10 SOUND 6,18;0,250;1,7;2,255;3,7;4,255;5,7;9,16;10,16;8,16;7,48;12,2;13,0
   20 PAUSE 3
   30 GO TO 1

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