home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / acksrc.zip / MEMOUSE.C < prev    next >
Text File  |  1993-06-10  |  6KB  |  242 lines

  1. /* Last modified DATE= 06/10/93 at TIME= 01:15:38 */
  2. /*   Title vga18.c */
  3.  
  4. #include <dos.h>
  5.  
  6. #define MINT __int__(0x33)
  7.  
  8.     int vga_mouse_modifier = 2;
  9.  
  10.  
  11.  
  12.  
  13. /*doc*/
  14. /****************************************************************************
  15. ** Returns a -1 if mouse IS installed                       **
  16. ****************************************************************************/
  17. /*enddoc*/
  18. /*header cpmouse.hh */
  19. /*funct*/
  20. int mouse_installed(void)
  21. {
  22. _AX = 0;
  23. MINT;
  24. return(_AX);
  25. }
  26.  
  27. /*doc*/
  28. /****************************************************************************
  29. ** Shows the mouse cursor                           **
  30. ****************************************************************************/
  31. /*enddoc*/
  32. /*header cpmouse.hh */
  33. /*funct*/
  34. void mouse_show_cursor(void)
  35. {
  36. _AX = 1;
  37. MINT;
  38. }
  39.  
  40. /*doc*/
  41. /****************************************************************************
  42. ** Turns mouse cursor off                           **
  43. ****************************************************************************/
  44. /*enddoc*/
  45. /*header cpmouse.hh */
  46. /*funct*/
  47. void mouse_hide_cursor(void)
  48. {
  49. _AX = 2;
  50. MINT;
  51. }
  52.  
  53.  
  54. /*doc*/
  55. /****************************************************************************
  56. ** Returns button status, mouse row and column (passed by &mrow,&mcol)       **
  57. ** 640 x 200 even if in text mode.                       **
  58. ****************************************************************************/
  59. /*enddoc*/
  60. /*header cpmouse.hh */
  61. /*funct*/
  62. void mouse_read_cursor(int *bstatus,int *mrow,int *mcol)
  63. {
  64. _AX = 3;
  65. MINT;
  66. _AX = _BX;
  67. *bstatus = _AX;
  68. *mcol = _CX;
  69. *mrow = _DX;
  70. *mcol /= vga_mouse_modifier;        /* Modify according to video mode */
  71.  
  72. }
  73.  
  74. /*doc*/
  75. /****************************************************************************
  76. ** Sets mouse cursor to desired row, column                   **
  77. ****************************************************************************/
  78. /*enddoc*/
  79. /*header cpmouse.hh */
  80. /*funct*/
  81. void mouse_set_cursor(int mrow,int mcol)
  82. {
  83. mcol *= vga_mouse_modifier;
  84. _CX = mcol;
  85. _DX = mrow;
  86. _AX = 4;
  87. MINT;
  88. }
  89.  
  90. /*doc*/
  91. /****************************************************************************
  92. ** Returns button status for desired button (in bstatus)           **
  93. ** column is modified for current vga video mode               **
  94. ****************************************************************************/
  95. /*enddoc*/
  96. /*header cpmouse.hh */
  97. /*funct*/
  98. void mouse_press_info(int *bstatus,int *bcount,int *mrow,int *mcol)
  99. {
  100.     int        temp;
  101.  
  102. _BX = *bstatus;
  103. _AX = 5;
  104. MINT;
  105. temp = _BX;
  106. *bstatus = _AX;
  107. *bcount = temp;
  108. *mcol = _CX;
  109. *mrow = _DX;
  110. *mcol /= vga_mouse_modifier;        /* Modify according to video mode */
  111.  
  112. }
  113.  
  114.  
  115. /*doc*/
  116. /****************************************************************************
  117. ** Returns button release status for desired button (in bstatus)       **
  118. ** column is modified for current vga video mode               **
  119. ****************************************************************************/
  120. /*enddoc*/
  121. /*header cpmouse.hh */
  122. /*funct*/
  123. void mouse_release_info(int *bstatus,int *bcount,int *mrow,int *mcol)
  124. {
  125.     int        temp;
  126.  
  127. _BX = *bstatus;
  128. _AX = 6;
  129. MINT;
  130. temp = _BX;
  131. *bstatus = _AX;
  132. *bcount = temp;
  133. *mcol = _CX;
  134. *mrow = _DX;
  135. *mcol /= vga_mouse_modifier;        /* Modify according to video mode */
  136.  
  137. }
  138.  
  139.  
  140.  
  141. /*doc*/
  142. /****************************************************************************
  143. ** Defines left and right columns for mouse to travel in.           **
  144. ** Uses mouse coordinates 0-639                           **
  145. ****************************************************************************/
  146. /*enddoc*/
  147. /*header cpmouse.hh */
  148. /*funct*/
  149. void mouse_set_minmax_columns(int mincol,int maxcol)
  150. {
  151. _CX = mincol;
  152. _DX = maxcol;
  153. _AX = 7;
  154. MINT;
  155. }
  156.  
  157.  
  158. /*doc*/
  159. /****************************************************************************
  160. ** Defines top and bottom rows for mouse to travel in.               **
  161. ** Uses mouse coordinates 0-349                           **
  162. ****************************************************************************/
  163. /*enddoc*/
  164. /*header cpmouse.hh */
  165. /*funct*/
  166. void mouse_set_minmax_rows(int minrow,int maxrow)
  167. {
  168. _CX = minrow;
  169. _DX = maxrow;
  170. _AX = 8;
  171. MINT;
  172. }
  173.  
  174.  
  175. /*doc*/
  176. /****************************************************************************
  177. ** Set shape of graphics mouse cursor.    8 byte mask, Hot Spot row, col.       **
  178. ****************************************************************************/
  179. /*enddoc*/
  180. /*header cpmouse.hh */
  181. /*funct*/
  182. void mouse_set_graphics_cursor(int hsrow,int hscol,char far *mask)
  183. {
  184. _DX = FP_OFF(mask);
  185. _ES = FP_SEG(mask);
  186. _CX = hsrow;
  187. _BX = hscol;
  188. _AX = 9;
  189. MINT;
  190. }
  191.  
  192.  
  193. /*doc*/
  194. /****************************************************************************
  195. ** Setup function to be called by mouse interrupt (** NEAR model only **)  **
  196. **                                       **
  197. ** mflag contains the following bit pattern                   **
  198. **                                       **
  199. ** BIT     CALL SUBROUTINE ON                           **
  200. **  0     CURSOR POSN CHANGED                           **
  201. **  1     LEFT BUTTON PRESSED                           **
  202. **  2     LEFT BUTTON RELEASED                           **
  203. **  3     RIGHT BUTTON PRESSED                           **
  204. **  4     RIGHT BUTTON RELEASED                           **
  205. **  5-15 NOT USED                               **
  206. **                                       **
  207. ****************************************************************************/
  208. /*enddoc*/
  209. /*header cpmouse.hh */
  210. /*funct*/
  211. void mouse_set_subroutine(int mflag,void far *func)
  212. {
  213. _CX = mflag;            /* bit pattern to call subroutine */
  214. _ES = FP_SEG(func);
  215. _DX = FP_OFF(func);        /* ES:DX -> function to call with mask */
  216. _AX = 12;
  217. MINT;
  218. }
  219.  
  220.  
  221. /*doc*/
  222. /****************************************************************************
  223. ** Set mickey to pixel ratio. Default ratio is 8 mickeys to 8 pixels for   **
  224. ** columns and 16 mickeys to 8 pixels for rows.                   **
  225. ** ratcol = ratio for columns (8/8 = 1)                       **
  226. ** ratrow = ratio for rows (16/8 = 2)                       **
  227. ** This routine controls speed at which cursor moves per mouse movement.   **
  228. **                                       **
  229. **                                       **
  230. ****************************************************************************/
  231. /*enddoc*/
  232. /*header cpmouse.hh */
  233. /*funct*/
  234. void mouse_set_mickey_pixel_ratio(int ratrow,int ratcol)
  235. {
  236. _CX = ratcol;
  237. _DX = ratrow;
  238. _AX = 15;
  239. MINT;
  240. }
  241.  
  242.