--- title: "Sound" id: 59152 type: "computer_media" slug: "sound" url: "http://localhost/computer_media/sound/" markdown_url: "http://localhost/computer_media/sound.md" published_at: "2025-02-28T01:05:55+00:00" modified_at: "2026-03-30T21:45:24+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A single SOUND command fires up all three tone channels of the AY chip at once, producing a chord that plays until you press a key." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Byte Power" slug: "byte-power" taxonomy: "post_tag" url: "http://localhost/tag/byte-power/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" genre: - name: "Sound" slug: "sound" taxonomy: "genre" url: "http://localhost/type/sound/" media_contents: - id: 50603 title: "Byte Power August 1986" type: "computer_media" url: "http://localhost/computer_media/byte-power-august-1986/" media_type: "Program" programmers: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Sound%20%281986%29%28Byte%20Power%20Aug%201986%29%28TS2068%29%28CA%29%28Program%29.zip" mediadate: "1986" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" article_media: - id: 59141 title: "BETTER PROGRAMMING!" type: "article" url: "http://localhost/article/better-programming-3/" media_type_tags: "Sound" --- # 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: | Register | Value | Function | | --- | --- | --- | | 7 | 60 | Mixer control — enables tone on channels A and B, noise on channel C (binary: 00111100) | | 8 | 15 | Channel A amplitude — maximum fixed volume (no envelope) | | 9 | 15 | Channel B amplitude — maximum fixed volume | | 0 | 10 | Channel A tone period (low byte) — high frequency | | 1 | 5 | Channel A tone period (high byte) | | 2 | 11 | Channel B tone period (low byte) | | 3 | 5 | Noise 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. ## 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 ```