The Atari mouse interface works on a minimal emulation of Sun's Firm_event structures. The primary reason for this is easy interfacing with X11.
The movement and button events are read as structures of the form:
typedef struct Firm_event {
u_int_16_t id; /* key or MS_* or LOC_[XY]_DELTA */
u_int_16_t pad; /* unused */
int_16_t value; /* VKEY_{UP,DOWN} or locator delta */
struct timeval time; /* time stamp of the event */
}
The values of 'id' concerning the mouse:
#define MS_LEFT 0x7f20 /* left mouse button */
#define MS_MIDDLE 0x7f21 /* middle mouse button */
#define MS_RIGHT 0x7f22 /* right mouse button */
#define LOC_X_DELTA 0x7f80 /* mouse delta-X */
#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */
The values of 'value' concerning a button event:
#define VKEY_UP 0 /* a button went up */
#define VKEY_DOWN 1 /* a button went down */