This program plays a short musical sequence using the TS2068’s SOUND command, reading note and duration data from a DATA statement to drive the AY-3-8910 sound chip. Each iteration of the FOR loop reads three values (a, b, c) and sets four channels of the sound chip: channels 0 and 2 share related pitches (a and a+2), while channels 1 and 3 share the same value b, creating a two-voice harmony effect. The PAUSE 10*c statement controls note duration before silencing channels 8 and 9 (amplitude registers) between notes. The sequence covers 18 notes drawn from six distinct pitch/amplitude combinations in the DATA block.
Program Analysis
Program Structure
The program is minimal and linear, consisting of four numbered lines. Line 1 is a REM credit line. Line 10 opens a FOR loop iterating z from 1 to 18, reading three DATA values per iteration. Line 20 performs the sound output. Line 30 handles timing and loop control, then STOPs. All musical data is held in the single DATA statement on line 40.
AY-3-8910 SOUND Register Usage
The TS2068’s SOUND keyword writes directly to the AY-3-8910 programmable sound generator registers. Each call in line 20 sets four registers in one statement using the semicolon-separated multi-register form:
| Register | Value | Function |
|---|---|---|
| 7 | 60 | Mixer control — enables tone on channels A and B |
| 8 | 15 | Channel A amplitude (maximum) |
| 9 | 15 | Channel B amplitude (maximum) |
| 0 | a | Channel A tone period (low byte) |
| 1 | b | Channel A tone period (high byte) / Channel B pitch parameter |
| 2 | a+2 | Channel B tone period — slightly offset from Channel A |
| 3 | b | Channel B tone period (high byte), same as register 1 |
Setting Channel B’s pitch to a+2 while Channel A uses a creates a subtle detuning effect, giving the melody a slightly fuller, chorus-like timbre. Registers 8 and 9 are set to 0 in the silence step (SOUND 8,0;9,0) to mute both channels between notes without resetting the pitch registers.
DATA Layout and Note Parameters
The DATA statement encodes 18 triplets of the form a, b, c where a is the low-byte pitch component, b is the high-byte pitch component (giving a 12-bit period value), and c is a duration multiplier. Duration is computed as PAUSE 10*c, so c=1 yields approximately 0.5 seconds and c=4 approximately 2 seconds at 50 Hz. The distinct pitch values used are:
a=92, b=4— one pitcha=209, b=5— a second pitcha=158, b=4— a third pitcha=47, b=5— a fourth pitcha=226, b=3— a fifth pitch
Key BASIC Idioms and Techniques
- The semicolon-chained
SOUNDsyntax allows multiple AY registers to be written in a single BASIC statement, reducing line count and execution overhead. - Using
a+2for register 2 computes the detuned Channel B pitch inline without needing an extra variable. - The silence step
SOUND 8,0;9,0targets only the amplitude registers, leaving pitch registers intact — a clean articulation technique. STOPat the end of line 30 halts execution cleanly after the loop completes, avoiding a fall-through to theDATAline.
Anomalies and Notes
The REM on line 1 references “RESET 1986 BYTE POWER,” identifying the tune as likely an arrangement of a known piece for the BYTE POWER publication. Line 2 is an empty line, probably a spacer left from editing. The mixer register value of 60 (binary 00111100) enables tones on channels A and B while disabling noise on all channels and leaving channel C muted — a standard two-voice melodic configuration.
Content
Source Code
1 REM RESET 1986 BYTE POWER WRITTEN BY K. BOISVERT
2
10 FOR z=1 TO 18: READ a,b,c
20 SOUND 7,60;8,15;9,15;0,a;1,b;2,a+2;3,b
30 PAUSE 10*c: SOUND 8,0;9,0: NEXT z: STOP
40 DATA 92,4,2,209,5,2,92,4,2,209,5,2,92,4,1,158,4,1,47,5,1,158,4,1,92,4,4,226,3,2,209,5,2,226,3,2,209,5,2,226,3,1,209,5,1,47,5,1,209,5,1,92,4,4
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
