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:
10— Initialise and trigger sound via the AY-3-8910 chip20— Wait approximately 2 seconds (PAUSE 100= 100 × 1/50 s)30— Silence the output by zeroing amplitude registers40— Loop back unconditionally to line10
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:
| Register | Value | Function |
|---|---|---|
| 6 | 6 | Noise period |
| 7 | 7 | Mixer control (enables noise on channels A & B, disables tone) |
| 8 | 16 | Channel A amplitude — envelope mode enabled (bit 4 set) |
| 9 | 16 | Channel B amplitude — envelope mode enabled (bit 4 set) |
| 10 | 16 | Channel C amplitude — envelope mode enabled (bit 4 set) |
| 12 | 56 | Envelope period (coarse byte), sets overall envelope duration |
| 13 | 8 | Envelope 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
SOUNDcall 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
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.
