Following up the post about the joystick port, I wondered how to connect the Atari Keypad Controller (aka Video Touch Adapter or Kid's Controller) on the MSX.
Atari keypads are a 3x4 matrix that can be read by MSX by pulling down consecutively the pins 6, 7, 8 to select the rows while the colums are read on the pins 1, 2, 3, 4. A key pressed will appear as LOW.
Of course a rewire is necessary, along with one diode and one resistor to make an output collector from pin 8 (which are not essential but can prevent pin contention caused by a combination of wild code an many keys pressed at the same time. The pins 6 and 7 are already open collectors and does not require such expedient.
I have also wrote (and optimized) a raw scanning routine in assembly (72 bytes Code + 3 bytes Data) that can work in either joystick port as well as a BASIC program to demonstrate the code working (with a DIY keypad ;) ).
All sources are available at Github, and for the impacient there is a link to a video