/* * games/_shared/ - shared routines for games * * mouse.c - interrupt 0x33 handler (mouse service) * ____________________________________________________________ * * Developed by Ondrej Jombik * Copyright (c) 1997-2000 Condy software inc. * Copyright (c) 2001-2004 Platon SDG, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/games/ */ /* $Platon: games/_shared/mouse.c,v 1.3 2003/08/03 21:34:18 nepto Exp $ */ #include #include "mouse.h" /* Mouse handler implementation */ BYTE initmouse(void) /* {{{ */ { struct REGPACK rg; rg.r_ax=0x0; intr(0x33,&rg); return(rg.r_ax&rg.r_bx); } /* }}} */ void showmouse(void) /* {{{ */ { struct REGPACK rg; rg.r_ax=0x1; intr(0x33,&rg); } /* }}} */ void hidemouse(void) /* {{{ */ { struct REGPACK rg; rg.r_ax=0x2; intr(0x33,&rg); } /* }}} */ BYTE getmousepos(WORD*x,WORD*y) /* {{{ */ { struct REGPACK rg; rg.r_ax=0x3; intr(0x33,&rg); *x=rg.r_cx; *y=rg.r_dx; return(rg.r_bx); } /* }}} */ void setmousepos(WORD x,WORD y) /* {{{ */ { struct REGPACK rg; rg.r_cx=x; rg.r_dx=y; rg.r_ax=0x4; intr(0x33,&rg); } /* }}} */ BYTE pressbutton(BYTE but,WORD*x,WORD*y) /* {{{ */ { struct REGPACK rg; rg.r_bx=but; rg.r_ax=0x5; intr(0x33,&rg); *x=rg.r_cx; *y=rg.r_dx; return(rg.r_bx); } /* }}} */ BYTE releasebutton(BYTE but,WORD*x,WORD*y) /* {{{ */ { struct REGPACK rg; rg.r_bx=but; rg.r_ax=0x6; intr(0x33,&rg); *x=rg.r_cx; *y=rg.r_dx; return(rg.r_bx); } /* }}} */ void rangex(WORD a_min,WORD a_max) /* {{{ */ { struct REGPACK rg; rg.r_cx=a_min; rg.r_dx=a_max; rg.r_ax=0x7; intr(0x33,&rg); } /* }}} */ void rangey(WORD a_min,WORD a_max) /* {{{ */ { struct REGPACK rg; rg.r_cx=a_min; rg.r_dx=a_max; rg.r_ax=0x8; intr(0x33,&rg); } /* }}} */ void setmousecur(WORD x,WORD y,void *p) /* {{{ */ { struct REGPACK rg; rg.r_es=FP_SEG(p); rg.r_dx=FP_OFF(p); rg.r_cx=y;rg.r_bx=x; rg.r_ax=0x9; intr(0x33,&rg); } /* }}} */ void exclude(WORD x1,WORD y1,WORD x2,WORD y2) /* {{{ */ { struct REGPACK rg; rg.r_cx=x1; rg.r_dx=y1; rg.r_si=x2; rg.r_di=y2; rg.r_ax=0x10; intr(0x33,&rg); } /* }}} */ void mousesensitive(WORD x,WORD y) /* {{{ */ { struct REGPACK rg; rg.r_cx=x; rg.r_dx=y; rg.r_ax=0xf; intr(0x33,&rg); } /* }}} */ void setmousespeed(WORD speed) /* {{{ */ { struct REGPACK rg; rg.r_dx=speed; rg.r_ax=0x13; intr(0x33,&rg); } /* }}} */ /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=0: * }}} */