Controller peripheral: Difference between revisions

From dreamcast.wiki
Jump to navigation Jump to search
(Created page with "The controller acts as a main peripheral device on the Maple Bus. == Controller == The "get condition" command (0x09) with controller function code is used to...")
 
No edit summary
Line 1: Line 1:
The controller acts as a main peripheral device on the [[Maple_bus|Maple Bus]].
The controller acts as a main peripheral device on the [[Maple_bus|Maple Bus]].
'''NOTE:''' Some information here is misleading and/or incomplete


== Controller ==
== Controller ==

Revision as of 00:59, 30 December 2022

The controller acts as a main peripheral device on the Maple Bus.

NOTE: Some information here is misleading and/or incomplete

Controller

The "get condition" command (0x09) with controller function code is used to poll controller state. A "data transfer" command (0x08) is returned with controller function code word plus 2 words of data. The returned data must be parsed differently depending on the function definition for the controller. The below sections show how to parse data for a standard controller.

First Data Transfer Word

All button bits are 0 when pressed and 1 when released.

Byte 0 (LSB) Byte 1 Byte 2 Byte 3 (MSB)
Left analog trigger 0 to 255
0: fully released
255: fully pressed
Right analog trigger 0 to 255
0: fully released
255: fully pressed
Button bits
0x01: Z
0x02: Y
0x04: X
Button bits
0x01: C
0x02: B
0x04: A
0x08: Start
0x10: Up
0x20: Down
0x40: Left
0x80: Right

Second Data Transfer Word

Byte 0 (LSB) Byte 1 Byte 2 Byte 3 (MSB)
Right analog stick up/down
Always 128
(no controller uses this)
Right analog stick left/right
Always 128
(no controller uses this)
Left analog up/down
0: fully up
128: center
255: fully down
Left analog left/right
0: fully left
128: center
255: fully right