FRS' MSX Page

PWM devices for the MSX

The MSX standard has native support for the PWM protocol. This document describes how to create some devices and adapters that use it, and how to read such devices.


This is the basic circuit of one PWM channel, and will be used as a building block for all devices for the MSX listed on this page:

Schematic of the 72LS123 circuit

The variations on each circuit will be:
Please note that each 74LS123 chip features two PWM channels. When only one of its channels is used, the other must be disabled to avoid interference.
The 74HCT123 is a more modern replacement and should be preferred instead of the 74LS123. The components in this page were calculated for the two chips when possible.


Hardware

1) MSX-Paddle:

It uses a single PWM channel, and can have up to five digital buttons. It's recommended to assemble them with at least three buttons: A, B and START.

  a) Components

  b) DE9 female connector pinout

type-1: Up to 5 buttons (tip: designed to use NES or SMS joypad cases. Just add the extra buttons)
     1: aX (Q-pin of the 74HCT123)
     2: START button
     3: Shoulder L1
     4: Shoulder R1 / diode to NOT(pin-8)
     5: Vcc
     6: A button
     7: B button
     8: B-pin of the 74HCT123 and common pin for all digital buttons.
     9: GND

type-2: Up to 8 buttons (tip: designed to use SNES joypad cases)
     1: aX (Q-pin of the 74HCT123)
     2: START button / SELECT button
     3: Shoulder L1 / GND
     4: Shoulder R1 / 10K pull-up to Vcc
     5: Vcc
     6: A button / X button
     7: B button / Y button
     8: B-pin of the 74HCT123, pin-1 of the 74HCT157 that selects each pair of buttons.
     9: GND


Be sure to connect the inputs of the second channel as described below, to disable it and prefent it from producing spurious oscillations:

2) IBM-PC DA15 joystick adapter (AKA joyDA15 adapter)

This adapter uses two monostable channels.

  a) Components for each channel

  b) DE9 female connector pinout and connections

      1: 74HCT123 pin13
      2: DA15 pin10
      3: 74HCT123 pin5
      4: DA15 pin14
      5: DA15 pins 1,8,9 and 74HCT123 pin16
      6: DA15 pin2
      7: DA15 pin7
      8: 74HCT123 pins 2 and 10
      9: DA15 pins 4,5, and 12

3) Atari-2600 dual-paddle adapter

  a) Components

  b) DE9 female connector pinout

     1: 74HCT123 pin5
     2: N/C
     3: N/C
     4: 74HCT123 pin13
     5: 74HCT123 pin16 and Paddle DB9_pin7
     6: Paddle DB9_pin3
     7: Paddle DB9_pin4
     8: 74HCT123 pins 2 and 10, and Paddle DB9_pin8
     9: GND


Software Programming


1) Channel mapping

The channels will be mapped as follows. See the Assembly and MSX-BASIC sections on how to read each channel.

 a) MSX-Paddle

   Channel
     0            : aX (analog X)
     1            : START button / SELECT button
     2            : L1 shoulder button / (optional) L2 shoulder button
     3            : R1 shoulder button / (optional) R2 shoulder button
     4            : A button / X button
     5            : B button / Y button

     buttons SELECT, L2, R2, X and Y are read by setting the pin-8 of the joyport to high.

 b) joyDA15 adapter

   Channel
     0            : aX (analog X)
     1            : X button
     2            : aY (analog Y)
     3            : Y button
     4            : A button
     5            : B button

 c) Atari-2600 dual-Paddle

   Channel
     0            : Paddle-1 analog X1
     3            : Paddle-2 analog X2
     4            : Paddle-1 button
     5            : Paddle-2 button

 d) Generic template for a dual-analog joystick

   Channel
     0            : aX1 (analog X1)
     1            : aX2 (analog X2)
     2            : aY1 (analog Y1)
     3            : aY2 (analog Y2)
     4            : B button / A button
     5            : C button / START button

     The digital buttons will have the following output: 00=Pressed, FFh=released. A and START buttons are read by setting the joyport pin-8 to high.

e) Yamaha MMP-01

Check this article for the channel assignment on this device.

2) MSX-BASIC programming

3) Assembly programming

      The bits marked with "?" may contain random values and must be masked out from readings.

  Be careful to handle devices that are different than the standard MSX 2-button joystick, to avoid the infamous bug that some games have, where when a different device is left connected to the joystick port, the game has undesired collateral effects like interpreting a stuck direction.

  The connected devices can be identifyed in assembler by their fingerprints. The best way is to use HIDlib, as it handles both the detection and the disconnection of all MSX-HID devices.

4) MSX turboR support

Originally, the MSX turboR models had the drivers for PWM devices and Light-pen removed from their BIOS. But now you can use them back. All you have to do is to install the TRnewdrv drivers available at this page.

5) Notes

These are hobbyist projects. Build and use them at your own risk.