Controller peripheral

From dreamcast.wiki
Jump to navigation Jump to search

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 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
0x08: D
0x10: Up-b
0x20: down-b
0x40: left-b
0x80: right-b
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
0: fully up
128: center
255: fully down
Right analog stick left/right
0: fully left
128: center
255: fully right
Left analog up/down
0: fully up
128: center
255: fully down
Left analog left/right
0: fully left
128: center
255: fully right