/*                                                   */
/* othello game     file name: othello.h             */
/*                                                   */
/*           programed by K. Shishido                */
/*               date: 2000.12.12.                   */
/*                                                   */

#define _CS		_asm_inline("mov ax, cs")
#define _DS		_asm_inline("mov ax, ds")

#define SC1E  0x01
#define SC2E  0x02
#define SPR   0x04
#define SPRWE 0x08
#define VM 0x8000
#define HM 0x4000
#define S2PR 0x2000
#define WHITE 0
#define BLACK 1
#define SEQ 0x00
#define LOC 0x01
#define VS  0x02
#define RE  0x03
#define ACK 0x06
#define STP 0x09
#define PAS 0x0a
#define NAK 0x15    /* Žg—p’†Ž~ */
#define NXT 0x1a
#define ESC 0x1b
#define NOP 0xff
#define TAB 0x09
#define SPC 0x20
#define FOREVER 1
#define BUFFSIZE 1024
#define ODTMOUT 60

typedef struct {
	BOOL			active;
	unsigned int	bc;
	unsigned int	bw;
	unsigned int	b_count;
	unsigned int	w_count;
	unsigned int	cntl;
	unsigned int	rctl;
	unsigned int	bcon;
	unsigned short	dt;
	int		x, y;
	signed char	board[8][8];
} OTH_DATA ;

typedef struct {
	unsigned int	sequence;
	unsigned int	r_seq;
	unsigned int	top;
	unsigned int	bottom;
	BOOL			bounds;
	BOOL			progress;
	unsigned int	timeoutcount;
	unsigned int	totaltimeout;
	unsigned char	buffer[BUFFSIZE];
} RS_DATA ;

unsigned short	bmp_null[]= { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};

unsigned short	bmp_base[]= {
		0x8080, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf,
		0x0000, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
		0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0x80bf, 0xffff,
		0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0xffff,
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
		0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080,
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8080
	};

unsigned short	bmp_cursor[]= {
		0x0000, 0x0000, 0x1111, 0x0f0f, 0x0c0c, 0x0a0a, 0x1818, 0x1010,
		0x0000, 0x0000, 0xe2e2, 0x3c3c, 0x0c0c, 0x1414, 0x0606, 0x0202,
		0x1010, 0x1818, 0x0a0a, 0x0c0c, 0x0f0f, 0x1111, 0x0000, 0x0000,
		0x0202, 0x0606, 0x1414, 0x0c0c, 0x3c3c, 0xe2e2, 0x0000, 0x0000
	};

unsigned short	bmp_black[]= {
		0x0000, 0x0000, 0x0101, 0x0707, 0x0f0f, 0x0f0f, 0x1f1f, 0x1f1f,
		0x0000, 0x0000, 0xe0e0, 0xf8f8, 0xfcfc, 0xfcfc, 0xfefe, 0xfefe,
		0x1f1f, 0x1f1f, 0x0f0f, 0x0f0f, 0x0707, 0x0101, 0x0000, 0x0000,
		0xfefe, 0xfefe, 0xfcfc, 0xfcfc, 0xf8f8, 0xe0e0, 0x0000, 0x0000
	};

unsigned short	bmp_white[]= {
		0x0000, 0x0000, 0x0100, 0x0601, 0x0807, 0x0807, 0x100f, 0x100f,
		0x0000, 0x0000, 0xe000, 0x18e0, 0x04f8, 0x04f8, 0x02fc, 0x02fc,
		0x100f, 0x100f, 0x0807, 0x0807, 0x0601, 0x0100, 0x0000, 0x0000,
		0x02fc, 0x02fc, 0x04f8, 0x04f8, 0x18e0, 0xe000, 0x0000, 0x0000
	};

unsigned short	bmp_invert[]= {
		0x0000, 0x0000, 0x0003, 0x0007, 0x0107, 0x0107, 0x030f, 0x030f,
		0x0000, 0x0000, 0x60e0, 0xf0d0, 0xf8b8, 0xf8f8, 0xfcfc, 0xfc7c,
		0x030f, 0x030f, 0x0107, 0x0107, 0x0007, 0x0003, 0x0000, 0x0000,
		0xfc7c, 0xfcfc, 0xf8f8, 0xf8b8, 0xf0d0, 0x60e0, 0x0000, 0x0000,

		0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
		0x0000, 0x0000, 0x60e0, 0x60e0, 0x60e0, 0x60e0, 0x60e0, 0x60e0,
		0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000,
		0x60e0, 0x60e0, 0x60e0, 0x60e0, 0x60e0, 0x60e0, 0x0000, 0x0000,

		0x0000, 0x0000, 0x0003, 0x0205, 0x0007, 0x0007, 0x000f, 0x000f,
		0x0000, 0x0000, 0x70f0, 0x38f8, 0x18f8, 0x9878, 0x1cfc, 0x4cbc,
		0x000f, 0x000f, 0x0007, 0x0007, 0x0205, 0x0003, 0x0000, 0x0000,
		0x4cbc, 0x1cfc, 0x9878, 0x18f8, 0x38f8, 0x70f0, 0x0000, 0x0000
	};

void vl_errcheck(unsigned int) ;
void st_errcheck(char far *) ;
