/* conditional compilation flags */
#define OPTOUT 1

/* Device codes to pass to Bconstat(), Bconin() and Bconout() */
#define CON 2	/* Console (ie screen and keyboard) */
#define MIDI 3

/*
 *	Defines for the various command bytes
 */
#define KEYON	0x90
#define CONTROL 0xB0
#define		SUSTAIN	64
#define		KEYHOLD	66
#define PROGRAM 0xC0
#define ACTIVE 	0xFE

/* Is this byte the first one of a midi command */
#define iscmd(x)	((x)&0x80)

#ifdef OPTOUT
extern int lastocmd;
  /* send a byte out of the midi port */
# define midiout(c)	(Bconout(MIDI, (c)), lastocmd = 0)
#else
# define midiout(c)	Bconout(MIDI, (c))
#endif

/* receive a byte from the midi port */
#define midiin()	(Bconin(MIDI) & 0xFF)
/* is there any midi data waiting to be read? */
#define mididatap()	(Bconstat(MIDI) != 0)
/* Has a key been pressed on the keyboard? */
#define kbddatap()	(Bconstat(CON) != 0)
