The AY-3-8910 is the sound chip used in the MSX, ZX Spectrum 128 and Amstrad CPC. Here it uses the MSX register ports and 1.7897725 MHz clock, so compatible AY register programming uses the same port addresses and periods. It has three square-wave tone channels, A, B and C. Each channel can mix its tone with noise and use either a fixed volume or an envelope that changes the volume over time. All channels share one noise generator and one envelope.
Select a register through 0xA0, then write it through 0xA1 or read it through 0xA2. Two-byte periods use the lower-numbered register for the low byte.
| Registers | Bits kept | Meaning |
|---|
| 0/1, 2/3, 4/5 | 8 low + 4 high | Tone periods for A, B and C, 0 to 4095 |
| 6 | 5 | Shared noise period, 0 to 31 |
| 7 | 8 | Mixer: bits 0–2 disable the tones of A/B/C; bits 3–5 disable their noise. A 0 bit enables that source. Bits 6/7 are I/O-direction controls; they are retained on readback but have no effect here because the I/O ports are unconnected. |
| 8, 9, 10 | 5 | Volumes for A, B and C: bit 4 clear uses bits 0–3 as fixed volume, 0 to 15; bit 4 set follows the shared envelope instead |
| 11/12 | 8 low + 8 high | Shared envelope period, 0 to 65,535 |
| 13 | 4 | Shared envelope shape, 0 to 15; every write restarts it for all channels following the envelope |
| 14, 15 | none | Unconnected I/O ports: read 0xFF, writes ignored |
A tone's frequency is 1,789,772.5 ÷ (16 × period) Hz: period 254 is about 440 Hz, the A above middle C. The noise generator advances at the same clock ÷ (16 × noise period) rate; smaller periods give faster, brighter noise. Tone, noise and envelope periods of 0 act as 1, while still reading back as 0.
One complete envelope rise or fall takes 256 × envelope period ÷ 1,789,772.5 seconds. The shape selects what follows that first rise or fall:
| Shape | First movement | Then |
|---|
| 0–3 | Fall from full volume to 0 | Hold at 0 |
| 4–7 | Rise from 0 to full volume | Drop to 0 and hold |
| 8 | Fall | Repeat falling ramps |
| 9 | Fall | Hold at 0 |
| 10 | Fall | Alternate rising and falling ramps |
| 11 | Fall | Jump to full volume and hold |
| 12 | Rise | Repeat rising ramps |
| 13 | Rise | Hold at full volume |
| 14 | Rise | Alternate falling and rising ramps |
| 15 | Rise | Drop to 0 and hold |
Changing the noise period affects every channel with noise enabled. Writing register 13 retriggers every channel using the envelope, even if its shape value is unchanged.
| Note | C | C♯ | D | D♯ | E | F | F♯ | G | G♯ | A | A♯ | B |
|---|
| Period from middle C | 428 | 404 | 381 | 360 | 339 | 320 | 302 | 285 | 269 | 254 | 240 | 226 |
An octave lower doubles the tone period and an octave higher halves it. Every Build starts with every register 0, so every channel is silent. The chip keeps sounding while the program is paused or stopped at a breakpoint, and falls silent when the program ends. Testcases are silent and retain the same register readback.