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 |
7 | 1 | 3 | Joy1 LEFT |
8 | 2 | 3 | Joy2 LEFT |
9 | 1 | 4 | Joy1 RIGHT |
10 | 2 | 4 | Joy2 RIGHT |
11 | 1 | 6 | Joy1 BUTTON A |
12 | 2 | 6 | Joy2 BUTTON A |
13 | 1 | 7 | Joy1 BUTTON B |
14 | 2 | 7 | Joy2 BUTTON B |
All analog channels transmit their data using the PWM encoding, with a cycle width of 12uS.
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: