extern unsigned char sv_timer_irq_counter;
extern unsigned char sv_timer_dma_counter;
+/* Masks for joy_read */
+#define JOY_UP_MASK 0x08
+#define JOY_DOWN_MASK 0x04
+#define JOY_LEFT_MASK 0x02
+#define JOY_RIGHT_MASK 0x01
+#define JOY_BTN_1_MASK 0x20
+#define JOY_BTN_2_MASK 0x10
+#define JOY_BTN_3_MASK 0x80
+#define JOY_BTN_4_MASK 0x40
+
+#define JOY_BTN_A_MASK JOY_BTN_1_MASK
+#define JOY_BTN_B_MASk JOY_BTN_2_MASK
+#define JOY_START_MASK JOY_BTN_3_MASK
+#define JOY_SELECT_MASK JOY_BTN_4_MASK
+
+#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
+#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
+#define JOY_START(v) ((v) & JOY_START_MASK)
+#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
+
/* The addresses of the static drivers */
extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */