/*
	tst1 header
*/

#define WORD unsigned int
#define BYTE unsigned char
#define DWORD unsigned long int

#define DSP_RESET 0x6
#define DSP_READ_DATA 0xa
#define DSP_WRITE_DATA 0xc
#define DSP_WRITE_STATUS 0xc
#define DSP_DATA_AVAIL 0xe

#ifdef __cplusplus
	#define __CPPARGS ...
#else
	#define __CPPARGS
#endif

#define MIXER_ADDRESS       0x04    /* Pro only */
#define MIXER_DATA          0x05    /* Pro only */

#define writemixer(x,y) { outportb (0x220 + MIXER_ADDRESS,(x)); \
		outportb(0x220+MIXER_DATA,(y)); }

extern WORD DMA_BUFSIZE;

//void interrupt (*oldhandler)(__CPPARGS);

WORD SB_base;
BYTE SBirq;
BYTE SBdc;

WORD stat;

WORD pagereg[8] = {
		0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a
	};

WORD lenreg[8] = {
		1, 3, 5, 7, 0xc2, 0xc6, 0xca, 0xce
	};

WORD addrreg[8] = {
		0, 2, 4, 6, 0xc0, 0xc4, 0xc8, 0xcc
	};

WORD maskreg[8] = {
		0xa, 0xa, 0xa, 0xa, 0xd4, 0xd4, 0xd4, 0xd4
	};

WORD modereg[8] = {
		0xb, 0xb, 0xb, 0xb, 0xd6, 0xd6, 0xd6, 0xd6
	};

WORD clrreg[8] = {
		0xc, 0xc, 0xc, 0xc, 0xd8, 0xd8, 0xd8, 0xd8
	};

WORD dmabs[2];
WORD bufseg[2], bufoff[2], bufpage[2], xbs, bfreq[2], bbs[2];
BYTE t1, t2;
DWORD rf[2], rvf[2];

/*
void write_dsp (BYTE value);
BYTE read_dsp (void);*/

BYTE cchn = 0;
BYTE cbuf = 0;

WORD DSPversion;
BYTE oldIRQmask1;
BYTE oldIRQmask2;

int highspeed;
#define MAX_TSE_CHANNELS 16

WORD TSE_channels;	// number of channels to be mixed

struct TSE_Channel{
	BYTE status;		// 0 = disabled, 1 = enabled
	WORD offset;
	WORD length;
	BYTE *data;	// sample data PTR
}TSE_channel[MAX_TSE_CHANNELS];










