![]() |
libdragon
|
Joybus command helpers and data structures. More...
Files | |
file | joybus_commands.h |
Joybus command helpers. | |
Data Structures | |
struct | joybus_cmd_n64_accessory_read_port_t |
"N64 Accessory Read" Joybus command structure. More... | |
struct | joybus_cmd_n64_accessory_write_port_t |
"N64 Accessory Write" Joybus command structure. More... | |
struct | joybus_cmd_identify_port_t |
"Identify" Joybus command structure. More... | |
struct | joybus_cmd_eeprom_read_block_t |
"EEPROM Read Block" Joybus command structure. More... | |
struct | joybus_cmd_eeprom_write_block_t |
"EEPROM Write Block" Joybus command structure. More... | |
struct | joybus_cmd_pixelfx_n64_game_id_t |
"PixelFX N64 Game ID" Joybus command structure. More... | |
struct | joybus_cmd_n64_controller_read_port_t |
"N64 Controller Read" Joybus command structure. More... | |
struct | joybus_cmd_gcn_controller_read_port_t |
"GameCube Controller Read" Joybus command structure. More... | |
struct | joybus_cmd_gcn_controller_read_long_port_t |
"GameCube Controller Long Read" Joybus command structure. More... | |
struct | joybus_cmd_n64_accessory_read_port_t.send |
"N64 Accessory Read" command send data More... | |
struct | joybus_cmd_n64_accessory_read_port_t.recv |
"N64 Accessory Read" command receive data More... | |
struct | joybus_cmd_n64_accessory_write_port_t.send |
"N64 Accessory Write" command send data More... | |
struct | joybus_cmd_n64_accessory_write_port_t.recv |
"N64 Accessory Write" command receive data More... | |
struct | joybus_cmd_identify_port_t.send |
"Identify" command send data More... | |
struct | joybus_cmd_identify_port_t.recv |
"Identify" command receive data More... | |
struct | joybus_cmd_eeprom_read_block_t.send |
"EEPROM Read Block" command send data More... | |
struct | joybus_cmd_eeprom_read_block_t.recv |
"EEPROM Read Block" command receive data More... | |
union | joybus_cmd_eeprom_read_block_t.recv.__unnamed15__ |
struct | joybus_cmd_eeprom_write_block_t.send |
"EEPROM Write Block" command send data More... | |
union | joybus_cmd_eeprom_write_block_t.send.__unnamed19__ |
struct | joybus_cmd_eeprom_write_block_t.recv |
"EEPROM Write Block" command receive data More... | |
struct | joybus_cmd_pixelfx_n64_game_id_t.send |
"PixelFX N64 Game ID" command send data More... | |
struct | joybus_cmd_n64_controller_read_port_t.send |
"N64 Controller Read" command send data More... | |
struct | joybus_cmd_n64_controller_read_port_t.recv |
"N64 Controller Read" command receive data More... | |
struct | joybus_cmd_gcn_controller_read_port_t.send |
"GameCube Controller Read" command send data More... | |
struct | joybus_cmd_gcn_controller_read_port_t.recv |
"GameCube Controller Read" command receive data More... | |
struct | joybus_cmd_gcn_controller_read_long_port_t.send |
"GameCube Controller Long Read" command send data More... | |
struct | joybus_cmd_gcn_controller_read_long_port_t.recv |
"GameCube Controller Long Read" command receive data More... | |
Joybus command identifiers | |
#define | JOYBUS_COMMAND_ID_RESET 0xFF |
"Reset" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_IDENTIFY 0x00 |
"Identify" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_N64_CONTROLLER_READ 0x01 |
"N64 Controller Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_N64_ACCESSORY_READ 0x02 |
"N64 Accessory Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_N64_ACCESSORY_WRITE 0x03 |
"N64 Accessory Write" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_EEPROM_READ_BLOCK 0x04 |
"EEPROM Read Block" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_EEPROM_WRITE_BLOCK 0x05 |
"EEPROM Write Block" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_RTC_IDENTIFY 0x06 |
"Real-Time Clock Identify" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_RTC_READ_BLOCK 0x07 |
"Real-Time Clock Read Block" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_RTC_WRITE_BLOCK 0x08 |
"Real-Time Clock Write Block" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_N64_RANDNET_KEYBOARD_READ 0x13 |
"N64 Randnet Keyboard Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_64GB_LINK_CABLE_READ 0x13 |
"64GB Link Cable Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GBA_LINK_CABLE_READ 0x14 |
"GBA Link Cable Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_64GB_LINK_CABLE_WRITE 0x14 |
"64GB Link Cable Write" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GBA_LINK_CABLE_WRITE 0x15 |
"GBA Link Cable Write" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_PIXELFX_N64_GAME_ID 0x1D |
"PixelFX N64 Game ID" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GCN_CONTROLLER_READ 0x40 |
"GameCube Controller Read" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GCN_CONTROLLER_ORIGIN 0x41 |
"GameCube Controller Read Origins" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GCN_CONTROLLER_RECALIBRATE 0x42 |
"GameCube Controller Recalibrate" Joybus command identifier. | |
#define | JOYBUS_COMMAND_ID_GCN_CONTROLLER_READ_LONG 0x43 |
"GameCube Controller 'Long Read'" Joybus command identifier. | |
Joybus command helpers and data structures.
Joybus commands are used to communicate with peripherals via the N64's serial interface (SI). There are 4 ports on the front of the N64 for connecting joypads and other devices, and one additional port on the cartridge connector for EEPROM and real-time clock.
A Joybus command consists of metadata, send data, and receive data.
Metadata is used to specify the length of the send and receive data. It is always 2 bytes long, and does not include the command identifier.
The send data is the request-side of the command. Its shape and size depends on the specific command that is being issued, but the send data will always include a 1-byte command identifier at the beginning.
The receive data is the response-side of the command. Its shape and size depends on the specific command that is being issued.
Joybus commands are composed into an "operation block" that issues a command to each Joybus port on the system in order. A port can be skipped by providing a single-byte command with a value of 0x00 (zero send length).
struct joybus_cmd_n64_accessory_read_port_t |
"N64 Accessory Read" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_n64_accessory_read_port_t.send | send | "N64 Accessory Read" command send data |
struct joybus_cmd_n64_accessory_read_port_t.recv | recv | "N64 Accessory Read" command receive data |
struct joybus_cmd_n64_accessory_write_port_t |
"N64 Accessory Write" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_n64_accessory_write_port_t.send | send | "N64 Accessory Write" command send data |
struct joybus_cmd_n64_accessory_write_port_t.recv | recv | "N64 Accessory Write" command receive data |
struct joybus_cmd_identify_port_t |
"Identify" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_identify_port_t.send | send | "Identify" command send data |
struct joybus_cmd_identify_port_t.recv | recv | "Identify" command receive data |
struct joybus_cmd_eeprom_read_block_t |
"EEPROM Read Block" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_eeprom_read_block_t.send | send | "EEPROM Read Block" command send data |
struct joybus_cmd_eeprom_read_block_t.recv | recv | "EEPROM Read Block" command receive data |
struct joybus_cmd_eeprom_write_block_t |
"EEPROM Write Block" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_eeprom_write_block_t.send | send | "EEPROM Write Block" command send data |
struct joybus_cmd_eeprom_write_block_t.recv | recv | "EEPROM Write Block" command receive data |
struct joybus_cmd_pixelfx_n64_game_id_t |
"PixelFX N64 Game ID" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_pixelfx_n64_game_id_t.send | send | "PixelFX N64 Game ID" command send data |
uint8_t | recv |
(unused) As per PixelFX's documentation, N64Digital does not respond to this command. N64Digital only acts as a bus sniffer. |
struct joybus_cmd_n64_controller_read_port_t |
"N64 Controller Read" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_n64_controller_read_port_t.send | send | "N64 Controller Read" command send data |
struct joybus_cmd_n64_controller_read_port_t.recv | recv | "N64 Controller Read" command receive data |
struct joybus_cmd_gcn_controller_read_port_t |
"GameCube Controller Read" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_gcn_controller_read_port_t.send | send | "GameCube Controller Read" command send data |
struct joybus_cmd_gcn_controller_read_port_t.recv | recv | "GameCube Controller Read" command receive data |
struct joybus_cmd_gcn_controller_read_long_port_t |
"GameCube Controller Long Read" Joybus command structure.
Data Fields | ||
---|---|---|
struct joybus_cmd_gcn_controller_read_long_port_t.send | send | "GameCube Controller Long Read" command send data |
struct joybus_cmd_gcn_controller_read_long_port_t.recv | recv | "GameCube Controller Long Read" command receive data |
struct joybus_cmd_n64_accessory_read_port_t.send |
"N64 Accessory Read" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_N64_ACCESSORY_READ) |
uint16_t | addr_checksum | Accessory address with 5-bit checksum. |
struct joybus_cmd_n64_accessory_read_port_t.recv |
"N64 Accessory Read" command receive data
Data Fields | ||
---|---|---|
uint8_t | data[JOYBUS_ACCESSORY_DATA_SIZE] | 32-byte payload of data read from the accessory. |
uint8_t | data_crc | CRC8 checksum of the data for verification. |
struct joybus_cmd_n64_accessory_write_port_t.send |
"N64 Accessory Write" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_N64_ACCESSORY_WRITE) |
uint16_t | addr_checksum | Accessory address with 5-bit checksum. |
uint8_t | data[JOYBUS_ACCESSORY_DATA_SIZE] | 32-byte payload of data to write to the accessory. |
struct joybus_cmd_n64_accessory_write_port_t.recv |
struct joybus_cmd_identify_port_t.send |
"Identify" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_IDENTIFY) |
struct joybus_cmd_identify_port_t.recv |
struct joybus_cmd_eeprom_read_block_t.send |
"EEPROM Read Block" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_EEPROM_READ_BLOCK) |
uint8_t | block | EEPROM block to read. |
struct joybus_cmd_eeprom_read_block_t.recv |
"EEPROM Read Block" command receive data
Data Fields | ||
---|---|---|
union joybus_cmd_eeprom_read_block_t.recv.__unnamed15__ | __unnamed__ | |
uint8_t | status | Status byte. |
union joybus_cmd_eeprom_read_block_t.recv.__unnamed15__ |
struct joybus_cmd_eeprom_write_block_t.send |
"EEPROM Write Block" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_EEPROM_WRITE_BLOCK) |
uint8_t | block | EEPROM block to read. |
union joybus_cmd_eeprom_write_block_t.send.__unnamed19__ | __unnamed__ |
union joybus_cmd_eeprom_write_block_t.send.__unnamed19__ |
struct joybus_cmd_eeprom_write_block_t.recv |
struct joybus_cmd_pixelfx_n64_game_id_t.send |
"PixelFX N64 Game ID" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_PIXELFX_N64_GAME_ID) |
uint64_t | rom_check_code |
ROM check code (ROM header bytes 0x10-0x17). 64-bit check code calculated on 1 Mbyte of ROM contents starting from offset 0x1000. Sometimes these 8 bytes are incorrectly referred to as "CRC HI/LO" or "CRC1/2". |
uint8_t | media_format | Media category code (ROM header byte 0x3B) |
uint8_t | region_code | Region code (ROM header byte 0x3E) |
struct joybus_cmd_n64_controller_read_port_t.send |
"N64 Controller Read" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_N64_CONTROLLER_READ) |
struct joybus_cmd_n64_controller_read_port_t.recv |
"N64 Controller Read" command receive data
struct joybus_cmd_gcn_controller_read_port_t.send |
"GameCube Controller Read" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_GCN_CONTROLLER_READ) |
uint8_t | mode | GameCube controller mode (0-3) |
uint8_t | rumble | Rumble motor control. |
struct joybus_cmd_gcn_controller_read_port_t.recv |
"GameCube Controller Read" command receive data
struct joybus_cmd_gcn_controller_read_long_port_t.send |
"GameCube Controller Long Read" command send data
Data Fields | ||
---|---|---|
uint8_t | command | Joybus command ID (JOYBUS_COMMAND_ID_GCN_CONTROLLER_READ_LONG) |
struct joybus_cmd_gcn_controller_read_long_port_t.recv |
"GameCube Controller Long Read" command receive data
#define JOYBUS_COMMAND_ID_PIXELFX_N64_GAME_ID 0x1D |
"PixelFX N64 Game ID" Joybus command identifier.
Used by PixelFX's N64Digital and Retro GEM console mods for per-game settings.
#define JOYBUS_COMMAND_ID_GCN_CONTROLLER_RECALIBRATE 0x42 |
"GameCube Controller Recalibrate" Joybus command identifier.
Invalidates the origins of the GameCube controller.
#define JOYBUS_COMMAND_ID_GCN_CONTROLLER_READ_LONG 0x43 |
"GameCube Controller 'Long Read'" Joybus command identifier.
Used by GameCube mode 0, mode 1, mode 2, and mode 4 to read extended controller data, including analog A and B button values.
"64GB Link Cable Read" Joybus command structure.
Identical to the "N64 Accessory Read" command but with a different command ID.
"GBA Link Cable Read" Joybus command structure.
Identical to the "N64 Accessory Read" command but with a different command ID.
"64GB Link Cable Write" Joybus command structure.
Identical to the "N64 Accessory Write" command but with a different command ID.
"GBA Link Cable Write" Joybus command structure.
Identical to the "N64 Accessory Write" command but with a different command ID.
"Reset" Joybus command structure.
Identical to the "Identify" command but with a different command ID.
"RTC Read Block" Joybus command structure.
Identical to the "EEPROM Read Block" command but with a different command ID.
"RTC Write Block" Joybus command structure.
Identical to the "EEPROM Write Block" command but with a different command ID.
"GameCube Controller Recalibrate" Joybus command structure.
Identical to the "GameCube Controller Long Read" command but with a different command ID.
"GameCube Controller Read Origins" Joybus command structure.
Identical to the "GameCube Controller Long Read" command but with a different command ID.