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...")
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
! Byte 0 (LSB) !! Byte 1 !! Byte 2 !! Byte 3 (MSB)
! Byte 0 (LSB) !! Byte 1 !! Byte 2 !! Byte 3 (MSB)
|-
|-
| Left analog trigger 0 to 255<br>0: fully released<br>255: fully pressed || Right analog trigger 0 to 255<br>0: fully released<br>255: fully pressed || Button bits<br>0x01: Z<br>0x02: Y<br>0x04: X || Button bits<br>0x01: C<br>0x02: B<br>0x04: A<br>0x08: Start<br>0x10: Up<br>0x20: Down<br>0x40: Left<br>0x80: Right
| Left analog trigger 0 to 255<br>0: fully released<br>255: fully pressed || Right analog trigger 0 to 255<br>0: fully released<br>255: fully pressed || Button bits<br>0x01: Z<br>0x02: Y<br>0x04: X<br>0x08: D<br>0x10: Up-b<br>0x20: down-b<br>0x40: left-b<br>0x80: right-b || Button bits<br>0x01: C<br>0x02: B<br>0x04: A<br>0x08: Start<br>0x10: Up<br>0x20: Down<br>0x40: Left<br>0x80: Right
|}
|}


Line 22: Line 22:
! Byte 0 (LSB) !! Byte 1 !! Byte 2 !! Byte 3 (MSB)
! Byte 0 (LSB) !! Byte 1 !! Byte 2 !! Byte 3 (MSB)
|-
|-
| Right analog stick up/down<br>Always 128<br>(no controller uses this) || Right analog stick left/right<br>Always 128<br>(no controller uses this) || Left analog up/down<br>0: fully up<br>128: center<br>255: fully down || Left analog left/right<br>0: fully left<br>128: center<br>255: fully right
| Right analog stick up/down<br>0: fully up<br>128: center<br>255: fully down || Right analog stick left/right<br>0: fully left<br>128: center<br>255: fully right || Left analog up/down<br>0: fully up<br>128: center<br>255: fully down || Left analog left/right<br>0: fully left<br>128: center<br>255: fully right
|}
|}

Latest revision as of 19:08, 1 January 2023

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