MSX Hobby

Um site para se divertir com eletrônica

PS/2 Keyboard to MSX with Arduino

I made a project to connect a PS/2 keyboard on MSX.

My first project I used an Arduino UNO to this job, but it was not the best alternative because It has only two external interruption. So, I decided to use an Arduino MEGA 2560. It has 6 external interruption, more than I need.

Why did you choose an Arduino to do this? Because it is inexpensive (about US$ 15,00 on DX) , does not need an circuit programmer and it is easy to program (C++).


The MSXs in Brazil

Here in my land Brazil, there were two MSX manufactures, EPCOM was a Sharp subsidiary and Gradiente the company that registered iPhone trade mark before Apple.

Brazilian MSXs

Epcom made two versions of HotBit, the first with case white and the second with case black, and Gradiente made Expert in 4 versions, version 1.0, 1.1 (grey) and Plus and ddPlus (black).

An independent manufacturer made a motherboard actualization to Expert, transforming it in a MSX 2+. See this link.

My project basically works with all these computers, but in Expert Plus and ddPlus, is necessary an update, that I will not do. If someone update my code let me know.

The project

These machines use an 8255 PPI to interfacing a matrix keyboard, as shown in the above diagram.

Hotbit Diagram

 Expert Diagram

We need a microcontroler with 8 outputs and 4 inputs to interface with MSX, and more 2 inputs to connect a PS/2 keyboard (data pin and clock pin).

I decided to program two routines that depends on interruptions. The first routine is for PS2 data PIN and the second is for four pins from MSX PPI line selection.



 PS/2 Read routine:

  1. Read keyboard buffer (11 bits).
  2. If is special or releasing key, read the buffer again to get the key code.
  3. Save the result of the PS/2 key in a matrix of 10 x 8 bits, equal MSX keyboard matrix.

MSX line selection routine:

  1. Read PINs 18,19, 20 and 21.
  2. Get the value of keyboard for line matrix and put in output PINs.

This is my MSX with Arduino interconnection.

Hotbit with Arduino


This is a work in progress project and is not 100% functional, but it works well.

What works?

  • All normal keys are ok.
  • It interprets more than 1 key pressed at same time.
  • CAPS Lock LED.
  • Scroll Lock and Num Lock LEDs are permanently on.

What does not work?

  • Some keys in numerical keypad.
I did not test my circuit with games, but for play games I recomend to use a joystick or gamepad.

Here is the Arduino code (PS2_MEGA2560) and if you have any issue let me know.

Watch out! This code at this time only works with Arduino MEGA.

Here is my video testing the circuit with Hotbit.

Print this PDF (Hotbit and Expert KEYS) to replace the keys that is missing in your ABNT keyboard.

To all. Sorry for my poor English.

2 thoughts on “PS/2 Keyboard to MSX with Arduino


    Prezado, boa tarde.
    Vocë atualizou esse projeto? Tenho um Expert dependendo de teclado e gostaria muito de poder usá-lo.

  • Editor says:


    Não tenho possibilidade de atualizá-lo por um bom tempo, estou sem máquinas e equipamentos para isso.

    Testei ele em um HotBit e funcionou satisfatoriamente. No código do Arduino coloquei diretivas de compilação para o HotBit e para o Expert. Dá uma olhada no código antes de compilar. Se conseguir testar dá um feedback.

    Boa sorte.

Leave a Reply

Your email address will not be published. Required fields are marked *

one × one =