Difference between revisions of "JSX"
From MSX Game Library
Line 1: | Line 1: | ||
− | + | Proposal for a protocol to handle a joypad with a variable number of sticks and buttons, plug in the MSX’s general purpose port. | |
− | |||
− | |||
== Protocol == | == Protocol == | ||
Line 30: | Line 28: | ||
–-–-–-–-–-–-–-–-- | –-–-–-–-–-–-–-–-- | ||
x x A A A A B B | x x A A A A B B | ||
− | │ │ │ │ └─┴── Number of button rows ( | + | │ │ │ │ └─┴── Number of button rows (0-3) |
− | └─┴─┴─┴────── Number of axis ( | + | └─┴─┴─┴────── Number of axis (0-15) |
</pre> | </pre> | ||
Revision as of 23:54, 19 October 2024
Proposal for a protocol to handle a joypad with a variable number of sticks and buttons, plug in the MSX’s general purpose port.
Contents
Protocol
No-communication state
Write R#15
- Pin 8: LOW
- Pin 6: any value
Read R#14
- Any available value between 00-3F not already used
Start communication and get ID
Write R#15
- Pin 8: LOW (in case Pin 8 have been modified by another device)
- Pin 6: any value
Write R#15
- Pin 8: HIGH (start communication)
- Pin 6: HIGH
Read R#14
- Get ID
7 6 5 4 3 2 1 0 –-–-–-–-–-–-–-–-- x x A A A A B B │ │ │ │ └─┴── Number of button rows (0-3) └─┴─┴─┴────── Number of axis (0-15)
Read bytes
Repeat this step for each axis, then for each button row.
Write R#15
- Pin 8: HIGH
- Pin 6: LOW
Write R#15
- Pin 8: HIGH
- Pin 6: HIGH
Read R#14
- Get 6-bits values
- For axis: signed 6-bits value [-32 ; 31]
- For boutons: bits field for 6 boutons (0: pressed, 1: released)
Example
For a Joypad with 2 axis (a stick with X and Y axis), and up to 6 buttons, the reading process would be:
- After starting communication, first read to R#14 return the ID.
- ID: 0x04 [0000 0100] for 2 axis, and 1 button row,
- Next reading give X-axis value [-32 ; 31],
- Next reading give Y-axis value [-32 ; 31],
- Next and last reading button states (for up to 6 boutons).