Turbo Sound Next

From SpecNext official Wiki
Jump to: navigation, search

Turbo Sound Next is the audio system integrated on the Spectrum Next. It features 3 AY-3-8912 sound chips as used in the Spectrum.

A MOS 6581 (SID), as used on the Commodore 64, was experimentally added to the FPGA during development but it was later removed due to the large amount of space it takes up (it is 4 times as big as an AY).

Chip Selection

Turbo Sound Next Control ($FFFD / 65533) controls the selected chip and enables and disables stereo channels per chip. Peripheral 3 Register ($08) controls the mapping of chip channels to stereo channels and Peripheral 4 Register ($09) can be used to enable "mono" output per chip.

Once a sound chip is selected, Turbo Sound Next Control ($FFFD / 65533) also selects the active register on that chip. Sound Chip Register Write ($BFFD / 49149) then allows it to be read or written.

Peripheral 2 Register ($06) controls audio chip mode.

AY-3-8912 layout

The 3 AY-3-8912 chips have the following register layout:

Register Function
0 Channel A Fine Tune
1 Channel A Coarse Tune (4 bits)
2 Channel B Fine Tune
3 Channel B Coarse Tune (4 bits)
4 Channel C Fine Tune
5 Channel C Coarse Tune (4 bits)
6 Noise Period (5 bits)
7 Tone enable flags. Bits 0-2 enable tone on channels A, B, C respectively, but are inverted - 0 is enabled. Bits 3-5 enable noise on A, B, C are are likewise inverted.
8 Channel A amplitude. Bits 0-3 set the fixed amplitude which is used if bit 4 is 0. If bit 4 is 1, the envelope generator is used instead, and bits 0-3 are ignored.
9 Channel B amplitude, same as above.
10 Channel C amplitude, same as above.
11 Envelope period fine.
12 Envelope period coarse.
13 Envelope shape. Bits 0-3 alter the behavior of the envelope generator:

Bit 0: "Hold"; If 1 the envelope generator performs one cycle then holds at the end value. If 0, it cycles continuously.

Bit 1: "Alternate"; If 1 the envelope generator alters direction after each cycle. If 0, it resets after each cycle. If Hold is set, this instead chooses if the value held is the final value (0) or the initial value (1).

Bit 2: "Attack"; if 1 the generator counts up. If 0 the generator counts down.

Bit 3: "Continue"; if 0, the envelope generator performs one cycle then drops amplitude to 0 and stays there, overriding Hold. If 1, Hold is followed.

AY I/O registers 14 and 15 are not implemented on the Next, so bit-banged software written to use RS-232 and AUX ports on the Amstrad Spectrum models is not supported. The Next has a separate high-speed hardware UART, which can be connected to the ESP8266-01 wifi module or a wired RS-232 cable. The UART is interfaced through the UART TX ($133B / 4923) and UART RX ($143B / 5179) ports.