/*------------------------- SHARCOMP.H -------------------------*/
/*								*/
/*  This file contains definitions used for the compiler	*/
/*  specific interface routines, as used by both the library	*/
/*  and the calling application.				*/
/*								*/
/*								*/
/*	    Copyright 1990 Dan Vogel & David Bernazzani		*/
/*								*/
/*		Revision History				*/
/*								*/
/*  03/05/90   DCV	Release.				*/
/*								*/
/*--------------------------------------------------------------*/

#ifndef SHARCOMP_H     /* Prevent re-including this file! */

#define SHARCOMP_H   1

#include <graph.h>


		/* Constants */

	/* Converted Key Definitions */

#define LFEED            10
#define CR               13
#define BELL             7
#define ESC              27
#define BS               8
#define ENTER            13
#define SHIFT_HT         143
#define CTRL_T           20
#define CTRL_B           2
#define CTRL_D           4
#define ALT_D            160

#define F1               187
#define F2               188
#define F3               189
#define F4               190
#define F5               191
#define F6               192
#define F7               193
#define F8               194
#define F9               195
#define F10              196

#define CTRL_F1          222
#define CTRL_F2          223
#define CTRL_F3          224
#define CTRL_F4          225
#define CTRL_F5          226
#define CTRL_F6          227
#define CTRL_F7          228
#define CTRL_F8          229
#define CTRL_F9          230
#define CTRL_F10         231

#define ALT_F1           232
#define ALT_F2           233
#define ALT_F3           234
#define ALT_F4           235
#define ALT_F5           236
#define ALT_F6           237
#define ALT_F7           238
#define ALT_F8           239
#define ALT_F9           240
#define ALT_F10          241

#define HOME             199
#define UP               200
#define PGUP             201
#define LEFT             203
#define FIVE             204
#define RIGHT            205
#define END              207
#define DOWN             208
#define PGDN             209
#define INS              210
#define DEL              211

#define CTRL_HOME        247
#define CTRL_UP          141
#define CTRL_PGUP        132
#define CTRL_LEFT        243
#define CTRL_FIVE        143
#define CTRL_RIGHT       244
#define CTRL_END         245
#define CTRL_DOWN        145
#define CTRL_PGDN        246
#define CTRL_INS         146
#define CTRL_DEL         147

#define ALT_HOME         151
#define ALT_UP           152
#define ALT_PGUP         153
#define ALT_LEFT         155
#define ALT_FIVE         156
#define ALT_RIGHT        157
#define ALT_END          159
#define ALT_DOWN         160
#define ALT_PGDN         161
#define ALT_INS          162
#define ALT_DEL          163

	/*--------------------*/
	/* Video Screen Modes */
	/*--------------------*/
#define DEFAULTMODE    -1      /* restore screen to original mode */
#define TEXTBW40       0       /* 40 x 25 text, 16 grey */
#define TEXTC40        1       /* 40 x 25 text, 16/8 color */
#define TEXTBW80       2       /* 80 x 25 text, 16 grey */
#define TEXTC80        3       /* 80 x 25 text, 16/8 color */
#define MRES4COLOR     4       /* 320 x 200, 4 color */
#define MRESNOCOLOR    5       /* 320 x 200, 4 grey */
#define HRESBW	       6       /* 640 x 200, BW */
#define TEXTMONO       7       /* 80 x 25 text, BW */
#define HERCMONO       8       /* 720 x 348, BW for HGC */
#define MRES16COLOR    13      /* 320 x 200, 16 color */
#define HRES16COLOR    14      /* 640 x 200, 16 color */
#define ERESNOCOLOR    15      /* 640 x 350, BW */
#define ERESCOLOR      16      /* 640 x 350, 4 or 16 color */
#define VRES2COLOR     17      /* 640 x 480, BW */
#define VRES16COLOR    18      /* 640 x 480, 16 color */
#define MRES256COLOR   19      /* 320 x 200, 256 color */


/*-------------------------*/
/* Display Adaptor Options */
/*-------------------------*/
#define MDPA   0
#define CGA    1
#define EGA    2
#define VGA    3
#define MCGA   4
#define HGC    5



/*-------------------------*/
/* Display Monitor Options */
/*-------------------------*/
#define MONO       0
#define COLOR      1
#define ENHCOLOR   2
#define ANALOG     3

/*-----------------------*/
/* Clear Screen Commands */
/*-----------------------*/
#define CLEAR_WINDOW     0
#define CLEAR_VIEWPORT   1
#define CLEAR_SCREEN     2

/*----------------------------------*/
/* Bios Keyboard Interface Commands */
/*----------------------------------*/
#define KEYB_READ  0
#define KEYB_READY 1
#define KEYB_SHIFT 2


#define MAX_DISPLAY_WIDTH   80     /* Width of display in characters */
#define MAX_DISPLAY_HEIGHT  50     /* Max supported number of rows */

                  /*----------------*/
                  /*  Error Values  */
                  /*----------------*/
#define COMP_ERR_NO_ERR        ERR_NONE 	/* Success		      */

#define COMP_ERR_BAD_MODE      (ERR_COMPSPEC-0) /* Unknown video mode	      */
#define COMP_ERR_MODE_FAILED   (ERR_COMPSPEC-1) /* Unable to set video	      */
#define COMP_ERR_UNKNOWN_STATE (ERR_COMPSPEC-2) /* State of adaptor unknown   */
#define COMP_ERR_BAD_ROW       (ERR_COMPSPEC-3) /* Can't set to row requested */
#define COMP_ERR_BAD_COORD     (ERR_COMPSPEC-4) /* Coordinates are off screen */


                /*-----------------------*/
		/*  Routine Definitions  */
		/*-----------------------*/

IMPORT  WORD  Comp_BiosKeybrd(WORD service);
IMPORT  VOID  Comp_ClearScreen(WORD area);
IMPORT  VOID  Comp_Delay(WORD ticks);
IMPORT  VOID  Comp_ExecuteBkProc(VOID);
IMPORT	UWORD Comp_GetAnyKey(VOID);
IMPORT	UWORD Comp_GetKey(VOID);
IMPORT  UWORD Comp_GetOffset(UWORD *val_ptr);
IMPORT  UWORD Comp_GetSegment(UWORD *val_ptr);
IMPORT  VOID far *Comp_GetVector(UWORD vec_num);
IMPORT  WORD  Comp_GetVideoAdaptor(VOID );
IMPORT  WORD  Comp_GetVideoMode(VOID );
IMPORT  WORD  Comp_GetVideoInfo(WORD *adapter, WORD *monitor, WORD *mode, UWORD far **segaddr);
IMPORT  VOID  Comp_InstallBkProc(WORD (*bk_proc)(VOID));
IMPORT  WORD  Comp_Interrupt86(WORD intno,UWORD *axreg,UWORD *bxreg,UWORD *cxreg,UWORD *dxreg,UWORD *sireg,UWORD *direg);
IMPORT  WORD  Comp_Interrupt86ext(WORD intno,UWORD *axreg,UWORD *bxreg,UWORD *cxreg,UWORD *dxreg,UWORD *sireg,UWORD *direg,UWORD *dsreg,UWORD *esreg);
IMPORT	FLAG  Comp_Kbhit(VOID);
IMPORT  WORD  Comp_ModifyColors(UBYTE row, UBYTE col, UBYTE height, UBYTE width, DWORD txtcol_mask, DWORD txtcol, DWORD bkcol_mask, DWORD bkcol);
IMPORT  VOID  Comp_OutText(TEXT *msg);
IMPORT  DWORD Comp_SetBkColor(DWORD bkcol);
IMPORT  WORD  Comp_SetScreenRows(UBYTE rows);
IMPORT  DWORD Comp_SetTextColor(DWORD txtcol);
IMPORT  VOID  Comp_SetTextPosition(UBYTE row,UBYTE col);
IMPORT  VOID  Comp_SetTextWindow(UBYTE row,UBYTE col,UBYTE botrow,UBYTE rightcol);
IMPORT  WORD  Comp_SetVideoMode(WORD mode,UWORD far **VideoSeg);
IMPORT  VOID  Comp_TextCursor(FLAG on_off);
IMPORT  VOID  Comp_VertScroll(UBYTE top_row, UBYTE left_col, UBYTE height, UBYTE width, UBYTE direct, UBYTE lines);
IMPORT  FLAG  Comp_WrapOn(FLAG onoff);

#endif
