Joybus Protocol: Difference between revisions

Expanded on the command details for command 0x01 and added wavedrom images to show what the data represents.
m (A few subscripts were changed to superscripts.)
(Expanded on the command details for command 0x01 and added wavedrom images to show what the data represents.)
Line 50:
<small>'''{{sup|(2)}}''' ''Requires verification, might be offset by one.''</small>
 
== Additional Command Details ==
==== 0xFF - Reset / Info ====
While identical to 0x00 in what data is returned to the console, if a device has an intended reset function, it should be performed when this command is sent. The N64 controller for example will reset the internal position of its analog stick to (0, 0), essentially recalibrating it. Other devices may have similar functionality, or none at all, but either way they should still send back the same data as if the 0x00 command was sent.
 
==== 0x00 - Info ====
This command requests information about the device. The N64 a 2-byte identifier and 1 byte of extra data.
{| class="wikitable"
Line 75:
<small>'''{{sup|(1)}}''' ''Requires verification yet.''</small>
 
==== 0x01 - Controller State ====
The response for this command is always the same length of 4 bytes (32 bits), but the data it represents will change depending on the type of controller device. A Controller Stop Bit is always included after the response bytes.
{| class="wikitable"
 
|+0x0500 Controller
==== Standard Controller ====
!byte:
The most common is the standard N64 controller. In which case, the data is the current state of the inputs from the controller: the 14 buttons, the current position of the analog stick, and the reset (RST) bit. The default state of buttons and RST is Zero. If a button is pressed, it becomes One. If LT, RT, and Start are pressed, RST is One, Start becomes Zero, and the analog stick's position is reset to (0, 0). Each axis of the analog stick is a [[w:Two's complement|Two's Complement]] byte, giving a decimal value ranging from -128 to +127, even though a standard controller may not reach the full range due to physical limitations. The bit order from left to right, of the response data, is as follows:
! colspan="8" |0
 
! colspan="8" |1
[[File:Controller-response.svg|980px]]
!2
 
!3
==== Mouse ====
|-
The mouse follows a similar format to the standard controller. However, it only uses the A and B buttons, and the x/y axis bytes represent the relative position of the mouse.
!bit from lsb:
 
!7
[[File:Mouse-response.svg|980px]]
!6
 
!5
==== Densha de Go ====
!4
!3
!2
!1
!0
!7
!6
!5
!4
!3
!2
!1
!0
!7-0
!7-0
|-
|description:
|A
|B
|ZT
|Start
|↑
|↓
|←
|→
|?'''{{sup|†}}'''
|?
|LT
|RT
|C↑
|C↓
|C←
|C→
|stick x (+right -left)
|stick y (+up -down)
|}
<small>'''{{sup|†}}'''</small> This bit goes high when you press LT+RT+Start. When pressing this combination, the Start bit will clear, but LT, RT will remain set.
 
==== 0x02 - Read Controller Accessory ====
==== 0x03 - Write Controller Accessory ====
 
== References ==