/*------------------------- SHARMOUS.H -------------------------*/
/*								*/
/*  This file contains definitions used for the mouse library	*/
/*  that are needed both internally by the library and also	*/
/*  by the user of the library.					*/
/*								*/
/*	    Copyright 1990 Dan Vogel & David Bernazzani		*/
/*								*/
/*								*/
/*		Revision History				*/
/*								*/
/*  07/25/90   DCV	Release.				*/
/*								*/
/*--------------------------------------------------------------*/

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

#define SHARMOUS_H   1

#include <stddef.h>


/*----------------------------------------*/
/* International version driver languages */
/*----------------------------------------*/
#define ENGLISH		0
#define FRENCH		1
#define DUTCH		2
#define GERMAN		3
#define SWEDISH		4
#define FINNISH		5
#define SPANISH		6
#define PORTUGUESE	7
#define ITALIAN		8


/*-------------------------------------------------*/
/* Bit masks for button press return from INT 0x33 */
/*-------------------------------------------------*/
#define LEFT_BUTTON_MASK   0x0001
#define RIGHT_BUTTON_MASK  0x0002



/*---------------------------------*/
/* Mouse cursor interface commands */
/*---------------------------------*/
#define DISPLAY_CURSOR	   1
#define HIDE_CURSOR	   2


/*----------------------------*/
/* Text cursor type slections */
/*----------------------------*/
#define TEXT_SOFT_CURSOR   0
#define TEXT_HARD_CURSOR   1


/*-------------------------*/
/* Button specifier values */
/*-------------------------*/
#define LEFT_BUTTON    (WORD)0
#define RIGHT_BUTTON   (WORD)1



/*--------------------------------------------*/
/* Limits on graphics cursor hot spot offsets */
/*--------------------------------------------*/
#define GRAPHICS_HOT_SPOT_MIN    -128
#define GRAPHICS_HOT_SPOT_MAX     127


/*----------------------------------------*/
/* Bounds on mouse sensitivity parameters */
/*----------------------------------------*/
#define SENSITIVITY_LOW    1
#define SENSITIVITY_HIGH 100

		     
/*---------------------------*/
/* Mouse interrupt mask bits */
/*---------------------------*/
#define CURSOR_POS_BIT	   0x01
#define LBUTTON_PRESS_BIT  0x02
#define LBUTTON_REL_BIT    0x04
#define RBUTTON_PRESS_BIT  0x08
#define RBUTTON_REL_BIT    0x10
#define SHIFT_KEY_BIT	   0x20
#define CNTRL_KEY_BIT	   0x40
#define ALT_KEY_BIT	   0x80


/*-------------*/
/* Error Codes */
/*-------------*/
#define MOUSE_ERR_NO_ERR      ERR_NONE	      /* Success		      */

#define MOUSE_ERR_NO_MOUSE     (ERR_MOUSE-0)  /* Unable to find mouse to init */
#define MOUSE_ERR_NOT_INIT     (ERR_MOUSE-1)  /* Mouse not initialized yet.   */
#define MOUSE_ERR_BAD_BUTTON   (ERR_MOUSE-2)  /* Button press is bad	      */
#define MOUSE_ERR_BAD_CURS     (ERR_MOUSE-3)  /* Illegal cursor command       */
#define MOUSE_ERR_ILL_BUTTON   (ERR_MOUSE-4)  /* Illegal button number	      */
#define MOUSE_ERR_BAD_LIMITS   (ERR_MOUSE-5)  /* Limits for cursor illegal    */
#define MOUSE_ERR_BAD_HSPOT    (ERR_MOUSE-6)  /* Bad hot spot specification   */
#define MOUSE_ERR_BAD_CURSEL   (ERR_MOUSE-7)  /* Bad text cursor selection    */
#define MOUSE_ERR_BAD_SLINES   (ERR_MOUSE-8)  /* Bad scan lines selected      */
#define MOUSE_ERR_BAD_LIGHT    (ERR_MOUSE-9)  /* Bad light pen mode passed    */
#define MOUSE_ERR_BAD_RATIO    (ERR_MOUSE-10) /* Bad value for mickey ratio   */
#define MOUSE_ERR_ALT_BAD      (ERR_MOUSE-11) /* Int call to set alt error    */
#define MOUSE_ERR_BAD_SENSE    (ERR_MOUSE-12) /* Illegal mouse sens. params   */
#define MOUSE_ERR_NO_ALT       (ERR_MOUSE-13) /* No alt. routine defined      */
#define MOUSE_ERR_BAD_IRATE    (ERR_MOUSE-14) /* Bad interrupt rate selected  */
#define MOUSE_ERR_BAD_PAGE     (ERR_MOUSE-15) /* Bad CRT page # parameter     */
#define MOUSE_ERR_BAD_MODE     (ERR_MOUSE-16) /* Bad driver mode parameter    */
#define MOUSE_ERR_CANT_DISABLE (ERR_MOUSE-17) /* Unable to disable mouse      */
#define MOUSE_ERR_BAD_LANGUAGE (ERR_MOUSE-18) /* Illegal language parameter   */
#define MOUSE_ERR_NOT_RESET    (ERR_MOUSE-19) /* Mouse reset command error    */
#define MOUSE_ERR_BAD_ALLOC    (ERR_MOUSE-20) /* Unable to alloc state buffer */



		/*  Routine Definitions  */

IMPORT  WORD Mouse_AllocAndSave(UBYTE *(*buffer));
IMPORT  WORD Mouse_ClearButtons(VOID);
IMPORT  WORD Mouse_ConditOff(UWORD topx,UWORD topy,UWORD botx,UWORD boty);
IMPORT  WORD Mouse_CursorControl(WORD cursor_set);
IMPORT  WORD Mouse_CursorLimits(UWORD ymin,UWORD xmin,UWORD height,UWORD width);
IMPORT  WORD Mouse_DriverOnOff(WORD mode,UWORD *old_seg,UWORD *old_off);
IMPORT  WORD Mouse_GetAlternateRoutine(BITS *call_mask,WORD (* *WORD_routine)());
IMPORT  WORD Mouse_GetButtonPress(WORD button,FLAG *b_status,UWORD *b_press,UWORD *last_hor,UWORD *last_vrt);
IMPORT  WORD Mouse_GetButtonRel(WORD button,FLAG *b_status,UWORD *b_rel,UWORD *last_hor,UWORD *last_vrt);
IMPORT  WORD Mouse_GetCRTpage(UWORD *page_num);
IMPORT  WORD Mouse_GetLanguage(UWORD *lang_num);
IMPORT  WORD Mouse_GetSensitivity(UWORD *horiz,UWORD *vert,UWORD *thresh);
IMPORT  WORD Mouse_GetStore(UWORD *buff_size);
IMPORT  WORD Mouse_GetVersion(UWORD *version,UWORD *mouse_type,UWORD *irq_num);
IMPORT  WORD Mouse_Init(VOID);
IMPORT  WORD Mouse_LightPen(FLAG mode);
IMPORT  VOID Mouse_PhysToVir(UWORD ycoor,UWORD xcoor,UWORD *virty,UWORD *virtx);
IMPORT  WORD Mouse_ReadMotion(WORD *horiz,WORD *vert);
IMPORT  WORD Mouse_Reset(VOID);
IMPORT  WORD Mouse_RestoreState(UBYTE *buffer);
IMPORT  WORD Mouse_SaveState(UBYTE *buffer);
IMPORT  WORD Mouse_SetAlternateRoutine(BITS call_mask,WORD (*WORD_routine)());
IMPORT  WORD Mouse_SetCRTpage(UWORD page_num);
IMPORT  WORD Mouse_SetGCursor(WORD horiz,WORD vert,UWORD *masks);
IMPORT  WORD Mouse_SetIntRate(UWORD rate);
IMPORT  WORD Mouse_SetIntRoutine(BITS call_mask,WORD (*WORD_routine)());
IMPORT  WORD Mouse_SetLanguage(UWORD lang_num);
IMPORT  WORD Mouse_SetMickey(UWORD hor_ratio,UWORD ver_ratio);
IMPORT  WORD Mouse_SetPos(UWORD vert,UWORD horiz);
IMPORT  WORD Mouse_SetSensitivity(UWORD horiz,UWORD vert,UWORD thresh);
IMPORT  WORD Mouse_SetTCursor(WORD cur_type,UWORD scrn_mask,UWORD cur_mask,UWORD start_ln,UWORD stop_ln);
IMPORT  WORD Mouse_SoftReset(VOID );
IMPORT  WORD Mouse_SpeedThresh(UWORD thresh);
IMPORT  WORD Mouse_Status(FLAG *left,FLAG *right,UWORD *horiz,UWORD *vert);
IMPORT  WORD Mouse_SwapIntRoutine(BITS call_mask,WORD (*WORD_routine)(),BITS *old_mask,WORD (* *old_routine)());
IMPORT  WORD Mouse_TextCursorLimits(UBYTE top_y, UBYTE top_x, UBYTE hite, UBYTE width, FLAG on_off);
IMPORT  VOID Mouse_VirToPhys(UWORD xcoor,UWORD ycoor,UWORD *physx,UWORD *physy);

#endif
