General Purpose port
This page was last modified 09:07, 16 February 2023 by Mars2000you. Based on work by Gdx and Sd snatcher and others.
General Purpose ports (aka Joystick ports)

Contents

Description

The MSX standard defines two general purpose ports, which can also be used for input devices such as a joystick, joypad, mouse, paddle controllers, trackballs, graphic tablet... and even as a game network (ex: F1 3D Spirit).

The multi-using of these ports is defined by the MSX-HID protocol. Although they are part of the standard, the general port connectors are not present on the Daewoo CPC-300E.

Compatibility

The DE9 connector, first used on the Atari 2600 became quite popular at the time, and was used by many game consoles and home computers. As such many peripherals with this connector where made. Unfortunately the Atari 2600 only had a single trigger button, and the different game console and home computer vendors implemented the second trigger button in inconsistent ways which creates incompatibility. Still some Joysticks or gamepads meant for other computer systems can sometimes be used with the MSX.

Some joysticks even had a selector switch to select the system you where connecting it to.

  • Fully Compatible
    • Amstrad CPC-464 (2 button joystick only)
    • Fujitsu FM-77 / FM Towns (joystick & mouse)
    • NEC PC-6000, PC-8800 and PC-9800 series (joystick & mouse)
    • Roland mouse
    • Roland tablet
    • Sharp X1 / X68000 (joystick only)
  • Partially Compatible
    • Atari 400/800/2600 (single button only)
    • SEGA SG-1000, Mark III and Master System (single button only)
  • Not Compatible
    • Atari 7800
    • Commodore (C64, C128, Amiga)
    • PC Serial Mouse
    • Sega
    • ZX Spectrum

There exists some adapters to use non-MSX hardware on the MSX General Purpose port, and vice versa.

ATTENTION!
An Amiga mouse should not be connected to an MSX! Pin5 is +5V on the MSX, but used for Button 2 on the Amiga. Since on the Amiga the buttons are active low, connecting an Amiga mouse to the MSX and pressing button 2, will short circuit the supply voltage.
ATTENTION!
The connector is the same as used for many RS-232C serial devices, they are electrically incompatible and serial devices should not be plugged into the MSX port, or vice-versa.

Hardware

MSX uses a digital joystick design with a straight forward mapping. The port is a DE-9 type (often incorrectly called DB-9), with the male side on the MSX, and the female side on the game controller side.

Pin Use Type Description
1 UP I Joystick Up
2 DOWN I Joystick Down
3 LEFT I Joystick Left
4 RIGHT I Joystick Right
5 +5V DC +5V power source (50mA)
6 TRG 1 I/O Trigger button A
7 TRG 2 I/O Trigger button B
8 OUT O
9 GND Signal ground


Schematic Circuit:

Schematic circuit of standard joystick, from MSX side
Schematic circuit of standard joystick, from MSX side














If a MSX mouse is connected, the pins are used as follows;

Pin Use Type Description
1 Data b0 I Bit 0/4 of the coordinates
2 Data b1 I Bit 1/5 of the coordinates
3 Data b2 I Bit 2/6 of the coordinates
4 Data b3 I Bit 3/7 of the coordinates
5 +5V DC +5V power source (50mA)
6 TRG 1 I/O Left button
7 TRG 2 I/O Right button
8 Strobe O Data type selection
9 GND Signal ground


The system works as follows:

The MSX Mouse sends 2 signed bytes to the computer, X and Y. These bytes must be, respectively, added to the current X and Y location, so it is a relative movement. So X=0 means X is the same, X=1 means X=+1 and X=255 means X=-1. This is very easy to implement, however it poorly supports mouse speed control, because it's a digital signal. Well, anyways, those 2 bytes are transferred in 4 parts. The computer reads pins 1-4 four times, afterwards signalling the mouse to send the next 4 bits by complementing pin 8.

Programming

You can find more info on these pages:

Note for programmers

Why the mouse goes to the right-bottom corner when the mouse is not connected?

Because the joystick ports usually have pull-up resistors to maintain the pin signals on +5v when the switches are open, shorted to GND when pressed.

When connected but inactive, the mouse returns 0000 0000 0000 0000 to the computer, 0x and 0y, and the pointer is static. But disconnected, the joystick port receives 1111 1111 1111 1111, FFh FFh (twos complement), -1x and -1y every 1/50sec, and then the pointer moves right/down diagonally.