MSX-AUDIO music keyboard
The MSX-AUDIO Y8950 sound chip has a function for an external keyboard. All three MSX-AUDIO modules, the Philips NMS-1205 Music Module, the Toshiba HX-MU900 MSX Music System and the Panasonic FS-CA1 MSX-Audio have a connector for these. The Toshiba and Panasonic’s connectors are compatible; the Philips connector differs from the others.
The keyboards available for the Toshiba and Panasonic modules are the 49-key Toshiba HX-MU901, the Yamaha YK-10, YK-20 and the YK-01 (44 keys). For their Music Module Philips offered a 61-key music keyboard, the NMS-1160. As said, this one is not compatible with the other modules, even though the connector fits the pins are connected differently. Modified Commodore keyboards are also often used.
Reading the keyboard
The keys can be read in a matrix structure of 8x8 bits, which is accessed through the MSX-AUDIO registers at I/O ports 0C0H (address) and 0C1H (data). The address port is write-only, the data port can be read or written to depending on the selected register. A 12 cycle wait (at 3.58 Mhz) is required after all address and data writes.
Note that the Panasonic module has a switch which lets it listen at 0C2H and 0C3H, allowing two modules to be connected at the same time; the Philips and Toshiba modules can also be modified to provide such a switch. You may want to support this, but for this article we will assume the standard ports.
Register | I/O | Description |
---|---|---|
05H | Read | Row bits, 0 = pressed. See below for the bit/key mapping. |
06H | Write | Row selection, 1 = selected. Set bit 0 to select row 0, bit 1 to select row 1, etc. |
Refer to the MSX-AUDIO application manual for more details on writing / reading register data.
The key matrix is as follows:
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Row 0 | C 2 | F#2 | F 2 | E 2 | --- | D#2 | D 2 | C#2 |
Row 1 | --- | C 3 | B 3 | A#3 | --- | A 3 | G#2 | G 2 |
Row 2 | --- | F#3 | F 3 | E 3 | --- | D#3 | D 3 | C#3 |
Row 3 | --- | C 4 | B 4 | A#4 | --- | A 4 | G#3 | G 3 |
Row 4 | --- | F#4 | F 4 | E 4 | --- | D#4 | D 4 | C#4 |
Row 5 | --- | C 5 | B 5 | A#5 | --- | A 5 | G#4 | G 4 |
Row 6 | --- | F#5 | F 5 | E 5 | --- | D#5 | D 5 | C#5 |
Row 7 | --- | C 6 | B 6 | A#6 | --- | A 6 | G#5 | G 5 |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Row 0 | G 2 | F#2 | F 2 | E 2 | D#2 | D 2 | C#2 | C 2 |
Row 1 | D#3 | D 3 | C#3 | C 3 | B 3 | A#3 | A 3 | G#2 |
Row 2 | B 4 | A#4 | A 4 | G#3 | G 3 | F#3 | F 3 | E 3 |
Row 3 | G 4 | F#4 | F 4 | E 4 | D#4 | D 4 | C#4 | C 4 |
Row 4 | D#5 | D 5 | C#5 | C 5 | B 5 | A#5 | A 5 | G#4 |
Row 5 | B 6 | A#6 | A 6 | G#5 | G 5 | F#5 | F 5 | E 5 |
Row 6 | G 6 | F#6 | F 6 | E 6 | D#6 | D 6 | C#6 | C 6 |
Row 7 | --- | --- | --- | C 7 | B 7 | A#7 | A 7 | G#6 |
As you can see, unfortunately not only the connectors are different but so are the keyboard matrices. This means that in order to support both, you have to provide a means of selecting which keyboard to use. This can be done in a menu, but can also be done by asking Toshiba and Yamaha keyboard users to press the highest note on their keyboard (C6). This bit is not available on the Philips, so if it gets flagged the software can recognise it is a Toshiba and switch automatically.
Who did it right? According to MSX-Datapack volume 2 section 4.1.4 (page 281), the Toshiba matrix is the official one. The MSX-AUDIO documentation describes yet another layout, but this is likely an editorial error.
As an aside, because the row selection is not exclusive, if multiple rows are selected the pressed notes will overlap each other. This can be used to do a quick check if any notes are pressed at all, and if not, skip the remaining processing.
The Toshiba HX-MU901’s Multi Sensor
Above the keybed, Toshiba also has a “Multi Sensor” with a capacitive ribbon control and two capacitive ENTER and STOP buttons. You might have pressed these and noticed that 8 keys will be flagged at a time. This is because these controls are on two additional rows, which are selected by default.
These two rows are controlled through the MSX-AUDIO’s “general purpose I/O ports”. These aren’t Z80 I/O ports but rather four additional I/O bits which can be accessed through MSX-AUDIO registers 18H and 19H. Toshiba uses bits 0 and 1 to select rows 8 and 9, which can then be read from register 05H.
Register | I/O | Description |
---|---|---|
18H | Write | General purpose I/O port direction control. Default: 0. Use 00000011B to set the direction of ports 0 and 1 to output. If an output port is set to input, it will always output 1. |
19H | Write | General purpose I/O port data output. Set bits 0 and 1 to select matrix rows 8 and 9. |
05H | Read | Row bits, 0 = pressed. See below for the bit/key mapping. |
Whether these additional row bits are also hooked up on the Panasonic module, I don’t know. Also, on the Philips module bits 0 and 3 are used for different purposes (8-bit DAC enable and DAC/Y8950 output select), so you may want to avoid setting them if a Toshiba keyboard was not detected.
The additional matrix rows are as follows:
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Row 8 | Ribbon 1 | ENTER | STOP | Ribbon 6 | Ribbon 5 | Ribbon 4 | Ribbon 3 | Ribbon 2 |
Row 9 | Ribbon 7 | --- | --- | Ribbon 12 | Ribbon 11 | Ribbon 10 | Ribbon 9 | Ribbon 8 |
The ribbon is divided into twelve sections, and each section can be pressed individually. So if you want to use it as a linear control you will probably want to average the values.
Also worth noting that there are enough unused bits in the normal key matrix, so technically there would have been no need to introduce these two additional rows.
Grauw