You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.2 KiB
C

#ifndef RB_SORTRON
#define RB_SORTRON
// sortron.h
// SORTRON DOCUMENTATION
// Addresses
// $00: Command
// Set to $FF upon error
// Set to not $FF (presumably $00) upon success
// $01: read number of slots
// returns number of inventory slots in $02
// $02: read slot
// slot number in $02,
// returns info about item slot
// $03: pull items
// slot number in $02, count in $01, output color in $0C
// $04: match items on input
// number of items in $01, hash in $04, color in $0D,
// only returns success when match is complete
// $01: number of items in slot
// $02-$03: slot to operate on
// $04-$07: item hash
// $08-$09: item damage
// $0A-$0B: maximum item damage
// $0C: output color
// 0 is none, 1-16 is white-black
// $0D: input color
typedef enum {
IDLE = (char)0,
GETSLOTS = (char)1,
GETMETA = (char)2,
EJECT = (char)3,
ACCEPT = (char)4,
FAIL = (char)0xFF
} SortCommand;
typedef struct Sortron {
//0
char command;
// 1
char quantity;
// 2 3
int slot;
// 4 5 6 7
unsigned long id;
// 8 9
unsigned int damage;
// A B
unsigned int max_damage;
// C
char colorout;
// D
char colorin;
} Sortron;
#endif