Sound

Developer(s): Kristian Boisvert
Date: 1986
Type: Program
Platform(s): TS 2068
Tags: Sound

This program plays a single musical chord using the TS2068’s built-in SOUND command, then waits indefinitely for a keypress via PAUSE 0. The SOUND statement at line 10 configures the AY-3-8910 sound chip with seven register/value pairs in a single semicolon-separated call: register 7 sets the mixer (enabling tone and noise channels), registers 8–9 set channel volumes, registers 0–2 set the tone periods for the three channels, and register 3 sets a noise period. The REM at line 1 identifies it as a submission to RESET magazine’s 1986 Byte Power column, attributed to K. Boisvert. Line 2 is a blank REM or empty line used as a spacer in the listing.


Program Analysis

Program Structure

The program is minimal, consisting of just four lines. Line 1 is a REM comment crediting the author and publication. Line 2 is an empty or blank line acting as a visual separator. Line 10 issues the sound command, and line 20 halts execution until a key is pressed.

  1. 10 SOUND ... — configures the AY-3-8910 sound chip and begins playback
  2. 20 PAUSE 0 — holds the program open indefinitely after the sound fires

SOUND Register Breakdown

The SOUND keyword (TS2068 extension, displayed as } in zmakebas notation) allows multiple AY-3-8910 register/value pairs to be written in a single statement using semicolons. The seven pairs used here are:

RegisterValueFunction
760Mixer control — enables tone on channels A and B, noise on channel C (binary: 00111100)
815Channel A amplitude — maximum fixed volume (no envelope)
915Channel B amplitude — maximum fixed volume
010Channel A tone period (low byte) — high frequency
15Channel A tone period (high byte)
211Channel B tone period (low byte)
35Noise period — sets the frequency of the noise generator

Register 7 value 60 (binary 00111100) disables tone on channel C and enables noise on channel C while enabling tone on channels A and B, producing a two-tone chord blended with noise. No envelope registers (10–13) are set, so both active tone channels play at constant maximum volume.

Notable Techniques

  • Packing all seven register writes into a single SOUND statement saves both tokens and execution time compared to seven separate calls.
  • PAUSE 0 at line 20 is used here not as a keypress-wait idiom paired with INKEY$, but simply to prevent the program from terminating and silencing the AY chip immediately after the registers are set — the sound continues asynchronously.
  • The omission of channel C tone period registers (4 and 5) is intentional; channel C is used for noise only as determined by register 7.

Bugs and Anomalies

Register 1 in the AY-3-8910 is the high byte of channel A’s tone period (only the lower 4 bits are significant). Setting it to 5 combined with register 0 value 10 gives a 12-bit period of 0x050A (1290 decimal), yielding a relatively low-pitched tone on channel A. Register 3 is the noise period register, not the channel B tone high byte — channel B’s high byte (register 3 is actually the noise period; channel B high byte is register 3 in AY numbering… wait: AY registers: R0=ChA fine, R1=ChA coarse, R2=ChB fine, R3=ChB coarse, R4=ChC fine, R5=ChC coarse, R6=Noise, R7=Mixer). Re-examining: register 3 is in fact the coarse (high) byte of channel B’s tone period, not the noise period — the noise period is register 6, which is not set here. This means the noise generator runs at its default/residual register value, and the program produces two tones (A and B) with noise potentially audible depending on the chip’s reset state.

Content

Related Products

Related Articles

Let’s talk about sound effects in programs. It is very important in a game to have good sound effects as...

Related Content

Image Gallery

Source Code

    1 REM RESET 1986 BYTE POWER                WRITTEN BY K. BOISVERT
    2 
   10 SOUND 7,60;8,15;9,15;0,10;1,5;2,11;3,5
   20 PAUSE 0

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

Scroll to Top