MSX Paddle Controller
This page was last modified 23:58, 29 June 2019 by Danjovic. Based on work by Mars2000you and Msxholder and others.

MSX paddle controller is quite a simple device, but there are not so many commercial implementations for MSX.

Paddle controller status can be read from BASIC by using PDL() instruction or by calling GTPDL (#00DE) BIOS routine. These will return asked paddle status as value between 0-255

Contents

MSX Turbo R compatibility

PLEASE NOTE: the MSX Turbo R BIOS does not support paddle natively any more. In order to use paddle controllers on an MSX turbo R you can load the new set of drivers called TRnewdrv.

Hardware protocol

Each joystick port can have up to 6 paddle controllers connected without any button:

VALUE PORT PIN NAME
1 1 1 Joy1 UP
2 2 1 Joy2 UP
3 1 2 Joy1 DOWN
4 2 2 Joy2 DOWN
5 1 3 Joy1 LEFT
6 2 3 Joy2 LEFT
7 1 4 Joy1 RIGHT
8 2 4 Joy2 RIGHT
9 1 6 Joy1 BUTTON A
10 2 6 Joy2 BUTTON A
11 1 7 Joy1 BUTTON B
12 2 7 Joy2 BUTTON B


Analog data is time encoded with a resolution of 12uS per count.

The Yamaha MMP-01 is a music pad that is known to use this protocol to transmit its coordinates, so PDL() and GTPDL() can also be used to read it.

Example code

This is an example of a compatible code to read the paddles with direct I/O. It's shown here for educational purposes only, as the MSX coding guidelines forbid direct access to the I/O ports. The GTPDL BIOS function must always be used instead.

MYGTPDL:
	INC	A
	AND	A
	RRA
	PUSH	AF
	LD	B,A
	XOR	A
	SCF
.LOOP:	RLA
	DJNZ	.LOOP
	LD	B,A
	POP	AF
	LD	C,10H
	LD	DE,03AFH
	JR	NC,.PORT1
	LD	C,20H
	LD	DE,4C9FH
.PORT1:	LD	A,0FH
	DI
	OUT     (0A0H),A
	IN      A,(0A2H)
	AND	E
	OR	D
	OR	C
	OUT	(0A1H),A
	XOR	C
	OUT	(0A1H),A
	LD	A,0EH
	OUT	(0A0H),A
	LD	C,00H
.WAIT:	IN	A,(0A2H)
	AND	B
	JR	Z,.DONE
	INC	C
	JP	NZ,.WAIT
	DEC	C
.DONE:	EI
	LD	A,C
	RET

The interesting part is: the paddle controller interface was designed in a way to allow analog and digital signals to be compatible for all pins. This way, an analog joystick could be built this way and read by the GTPDL BIOS function, even with fancy analog buttons like the Playstation-2 controller. Such analog joystick will return progressive analog values accordingly. But, if a standard MSX digital joystick is connected instead, the very same software will still be compatible, as GTPDL will only return 0 or 255 (min and max) values, without graduation. Very similar to the behavior when someone uses a Playstation-1 controller on Playstation-2 games.

Reference design

This reference paddle controller implementation is shown on the official MSX documentation, as you can see it defines an variable resistor of 150 k, this VR value don't Exist !:

MSXpaddle.png