#define JVS_MARK 0xd0
#define JVS_SYNC 0xe0
#define JVS_NODE_MASTER 0x00
#define JVS_NODE_BROADCAST 0xff

#define JVS_VERSION_CMD 0x13  // A real board reports 1.1, but we support 1.3
#define JVS_VERSION_JVS 0x20
#define JVS_VERSION_COMM 0x10

#define JVS_STATUS_OK 0x01
#define JVS_STATUS_UKCOM 0x02
#define JVS_STATUS_SUM 0x03
#define JVS_STATUS_OVERFLOW 0x04
#define JVS_STATUS_UNKNOWN 0xff  // Not a spec-compliant status, but there's none for this!

#define JVS_REPORT_OK 0x01
#define JVS_REPORT_PARAM_NODATA 0x02
#define JVS_REPORT_PARAM_INVALID 0x03
#define JVS_REPORT_BUSY 0x04

#define JVS_FEATURE_PAD 0x00
#define JVS_FEATURE_EOF 0x00
#define JVS_FEATURE_PLAYERS 0x01
#define JVS_FEATURE_COINS 0x02
#define JVS_FEATURE_ANALOG 0x03
#define JVS_FEATURE_ROTARY 0x04
#define JVS_FEATURE_KEYCODE 0x05
#define JVS_FEATURE_SCREEN_POS 0x06
#define JVS_FEATURE_MISC_SWITCH 0x07
#define JVS_FEATURE_CARDS 0x10
#define JVS_FEATURE_MEDAL_HOPPER 0x11
#define JVS_FEATURE_GPIO 0x12
#define JVS_FEATURE_ANALOG_OUT 0x13
#define JVS_FEATURE_CHAR_OUT 0x14
#define JVS_FEATURE_BACKUP 0x15

#define JVS_CHARTYPE_UNKNOWN 0x00
#define JVS_CHARTYPE_NUMBER 0x01
#define JVS_CHARTYPE_ALNUM 0x02
#define JVS_CHARTYPE_ALNUM_KATAKANA 0x03
#define JVS_CHARTYPE_SHIFTJIS 0x04

#define JVS_COINSLOT_NORMAL 0x00
#define JVS_COINSLOT_JAM 0x01
#define JVS_COINSLOT_COUNTER_DISCON 0x02
#define JVS_COINSLOT_BUSY 0x03

// Mandatory JVS commands
#define JVS_CMD_RESET 0xf0
#define JVS_CMD_RESET_ASSERT 0xd9
#define JVS_CMD_ASSIGN_ADDR 0xf1
#define JVS_CMD_CHANGE_COMMS 0xf2

#define JVS_CMD_READ_ID 0x10
#define JVS_CMD_GET_CMD_VERSION 0x11
#define JVS_CMD_GET_JVS_VERSION 0x12
#define JVS_CMD_GET_COMM_VERSION 0x13
#define JVS_CMD_GET_FEATURES 0x14

#define JVS_CMD_REQUEST_RETRANSMIT 0x2f

// Optional JVS commands
#define JVS_CMD_RECEIVE_MAIN_ID 0x15

#define JVS_CMD_READ_SW 0x20
#define JVS_CMD_READ_COIN 0x21
#define JVS_CMD_READ_ANALOGS 0x22
#define JVS_CMD_READ_ROTARY 0x23
#define JVS_CMD_READ_KEYCODE 0x24
#define JVS_CMD_READ_SCREEN_POS 0x25
#define JVS_CMD_READ_MISC_SWITCH 0x26
#define JVS_CMD_REMAINING_PAYOUT 0x2e

#define JVS_CMD_COIN_DECREASE 0x30
#define JVS_CMD_PAYOUT_INCREASE 0x31
#define JVS_CMD_WRITE_GPIO1 0x32
#define JVS_CMD_WRITE_ANALOG 0x33
#define JVS_CMD_WRITE_CHARACTER 0x34
#define JVS_CMD_COIN_INCREASE 0x35
#define JVS_CMD_PAYOUT_DECREATE 0x36
#define JVS_CMD_WRITE_GPIO2 0x37
#define JVS_CMD_WRITE_GPIO3 0x38
