home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_05 / 2n05046a < prev    next >
Text File  |  1991-04-04  |  20KB  |  804 lines

  1.  
  2. TITLE   MicroSoft Mouse Library Module
  3. PAGE    60,132
  4.  
  5.  
  6. COMMENT !
  7.  
  8. TITLE:          MicroSoft Mouse Library Module;
  9. FILENAME:       MOUSELIB.ASM;
  10. AUTHOR:         Michael Kelly
  11.                 254 Gold Street
  12.                 Boston, MA 02127;
  13.  
  14. COPYRIGHT:  May be distributed freely if not modified;
  15. ASSEMBLER:  Tasm V.2.0;
  16. ASSEMBLY NOTES:
  17.  
  18. Utilizes Turbo Assembler-specific directives 
  19. ( TASM V.2.0 ) to enable assembly for Turbo Pascal or 
  20. Turbo C/C++
  21. For Turbo Pascal Module:  
  22.  ( All routines are "far" calls )
  23.     tasm mouselib
  24.  
  25. For C/C++ Module:   
  26.  ( Memory Model dependencies auto-adjusted )
  27.     tasm /dCPROG /d__MODEL__ /ml mouselib
  28.  
  29.    where __MODEL__ is one of:
  30.                 __TINY__
  31.                 __SMALL__
  32.                 __MEDIUM__
  33.                 __COMPACT__
  34.                 __LARGE__
  35.                 __HUGE__
  36.  
  37. if not  specified, __MODEL__ defaults to __SMALL__
  38.  
  39. Note:   Leading and trailing underlines consist 
  40.         of two underscore characters each.
  41.  
  42. You will notice that many procedures have conditional-
  43. assembly directives determining which ARG directive 
  44. and block of code to use.  The IFE FAR_PTRS block will 
  45. be assembled if FAR_PTRS is defined as 0, otherwise 
  46. the ELSE block will be assembled.
  47.  
  48. This accomodates the size of pointer arguments passed 
  49. to the procedure.  Also the "ret" instruction at the 
  50. close of each procedure does not specify the number 
  51. of bytes to discard from the stack on return.  Turbo 
  52. Assembler uses the ARG directive to determine the 
  53. number of bytes to discard if the Pascal calling 
  54. convention is used, and assembles the proper "ret n" 
  55. instruction. Underbars are automatically prepended 
  56. to the public and extrn declarations if the C calling 
  57. convention is in effect.  Using these features, one 
  58. source file can produce an object module for either
  59. Turbo Pascal or Turbo C/C++.
  60.  
  61. !
  62.  
  63. ;****************************************
  64. ; Set up calling convention and memory 
  65. ; model for Turbo Pascal or Turbo C/C++.
  66. ;****************************************
  67.  
  68. IFNDEF  CPROG
  69.     .MODEL  TPASCAL
  70.     FAR_PTRS EQU 1
  71. ENDIF
  72.  
  73. IFDEF CPROG
  74.  
  75. IFDEF    __TINY__
  76.  
  77.     .MODEL  TINY,C
  78.     FAR_PTRS EQU 0
  79.  
  80. ELSEIFDEF   __MEDIUM__
  81.  
  82.     .MODEL  MEDIUM,C
  83.     FAR_PTRS EQU 0
  84.  
  85. ELSEIFDEF   __COMPACT__
  86.  
  87.     .MODEL  COMPACT,C
  88.     FAR_PTRS EQU 1
  89.  
  90. ELSEIFDEF   __LARGE__
  91.  
  92.     .MODEL  LARGE,C
  93.     FAR_PTRS EQU 1
  94. ELSEIFDEF   __HUGE__
  95.  
  96.     .MODEL  HUGE,C
  97.     FAR_PTRS EQU 1
  98. ELSE
  99.     .MODEL  SMALL,C
  100.     FAR_PTRS EQU 0
  101. ENDIF
  102. ENDIF
  103.  
  104. ;****************************************
  105. ; Make procedures visible to the linker.
  106. ;****************************************
  107.  
  108. public mouse_reset
  109. public mouse_show
  110. public mouse_hide
  111. public mouse_get_pos
  112. public mouse_set_pos
  113. public mouse_button_press
  114. public mouse_button_rel
  115. public mouse_limit_x
  116. public mouse_limit_y
  117. public mouse_set_graphcursor
  118. public mouse_set_textcursor
  119. public mouse_get_movement
  120. public mouse_set_eventhandler
  121. public mouse_start_pen_emul
  122. public mouse_stop_pen_emul
  123. public mouse_set_movement_ratio
  124. public mouse_conditional_off
  125. public mouse_set_speed
  126. public mouse_swap_vector
  127. public mouse_get_bufsize
  128. public mouse_save_state
  129. public mouse_restore_state
  130. public mouse_set_alt_handler
  131. public mouse_get_alt_handler
  132. public mouse_set_sens
  133. public mouse_get_sens
  134. public mouse_set_crt_page
  135. public mouse_get_crt_page
  136. public mouse_disable_drvr
  137. public mouse_enable_drvr
  138. public mouse_soft_reset
  139.  
  140.  
  141.     LOCALS      ;enable local procedure labels
  142.  
  143.     .CODE
  144.  
  145. ;****************************************
  146. ; mouse_reset   PROC:
  147. ;    Description:   initialize the mouse driver
  148. ; int mouse_reset(int *num_buttons);
  149. ; Function mouse_reset(Var num_buttons : Integer) : Integer;
  150. ;****************************************
  151.  
  152. mouse_reset PROC
  153.     xor ax,ax
  154.     int 33h
  155.     ret
  156. mouse_reset ENDP
  157.  
  158. ;****************************************
  159. ; mouse_show    PROC:
  160. ;    Description:   display the mouse cursor
  161. ; void mouse_show(void);
  162. ; Procedure mouse_show;
  163. ;****************************************
  164.  
  165. mouse_show  PROC
  166.     mov ax,1
  167.     int 33h
  168.     ret
  169. mouse_show  ENDP
  170.  
  171. ;****************************************
  172. ; mouse_hide    PROC:
  173. ;    Description:   hide the mouse cursor
  174. ; void mouse_hide(void);
  175. ; Procedure mouse_hide;
  176. ;****************************************
  177.  
  178. mouse_hide  PROC
  179.     mov ax,2
  180.     int 33h
  181.     ret
  182. mouse_hide  ENDP
  183.  
  184. ;****************************************
  185. ; mouse_get_pos PROC:
  186. ;    Description:   get the mouse cursor position
  187. ; int mouse_get_pos(int *x, int *y);
  188. ; Function mouse_get_pos(Var x, y : Integer) : Integer;
  189. ;****************************************
  190.  
  191. mouse_get_pos   PROC    USES ES     ;preserve ES segment register
  192.  
  193. IFE FAR_PTRS
  194.     ARG x:NEAR PTR, y:NEAR PTR
  195.  
  196. ELSE
  197.     ARG x:FAR PTR, y:FAR PTR
  198. ENDIF
  199.     mov ax,3
  200.     int 33h
  201.     mov ax,bx
  202.  
  203. IFE  FAR_PTRS
  204.  
  205.     mov bx,x
  206.     mov [bx],cx
  207.     mov bx,y
  208.     mov [bx],dx
  209. ELSE
  210.     les bx,x
  211.     mov word ptr es:[bx],cx
  212.     les bx,y
  213.     mov word ptr es:[bx],dx
  214. ENDIF
  215.     ret
  216. mouse_get_pos   ENDP
  217.  
  218. ;****************************************
  219. ; mouse_set_pos PROC:
  220. ;    Description:   set the mouse cursor position;
  221. ; void mouse_set_pos(int x, int y);
  222. ; Procedure mouse_set_pos(x, y : Integer);
  223. ;****************************************
  224.  
  225. mouse_set_pos   PROC
  226.     ARG x, y
  227.  
  228.     mov ax,4
  229.     mov cx,x
  230.     mov dx,y
  231.     int 33h
  232.     ret
  233. mouse_set_pos   ENDP
  234.  
  235. ;****************************************
  236. ; mouse_button_press    PROC:
  237. ;    Description:   get mouse button press information
  238. ; int mouse_button_press(int *x, int *y, int *count, int button);
  239. ; Function mouse_button_press
  240. ;   (Var x, y, count : Integer; button : Integer)   : Integer;
  241. ;****************************************
  242.  
  243. mouse_button_press  PROC    USES ES
  244.  
  245. IFE FAR_PTRS
  246.         ARG x:NEAR PTR, y:NEAR PTR, count:NEAR PTR, button
  247. ELSE
  248.         ARG x:FAR PTR, y:FAR PTR, count:FAR PTR, button
  249. ENDIF
  250.         mov ax,5
  251.         mov bx,button
  252.         int 33h
  253.         push    bx
  254.  
  255. IFE FAR_PTRS
  256.  
  257.         mov bx,count
  258.         pop [bx]
  259.         mov bx,y
  260.         mov [bx],dx
  261.         mov bx,x
  262.         mov [bx],cx
  263.  
  264. ELSE
  265.         les bx,count
  266.         pop word ptr es:[bx]
  267.         les bx,y
  268.         mov word ptr es:[bx],dx
  269.         les bx,x
  270.         mov word ptr es:[bx],cx
  271. ENDIF
  272.         ret
  273. mouse_button_press  ENDP
  274.  
  275. ;****************************************
  276. ; mouse_button_rel  PROC:
  277. ;    Description:   get mouse button release information
  278. ;
  279. ; int mouse_button_rel(int *x, int *y, int *count, int button);
  280. ; Function mouse_button_rel
  281. ;   (Var x, y, count : Integer; button : Integer)   : Integer;
  282. ;****************************************
  283.  
  284. mouse_button_rel    PROC    USES ES
  285.  
  286. IFE FAR_PTRS
  287.         ARG x:NEAR PTR, y:NEAR PTR, count:NEAR PTR, button
  288. ELSE
  289.         ARG x:FAR PTR, y:FAR PTR, count:FAR PTR, button
  290. ENDIF
  291.         mov ax,6
  292.         mov bx,button
  293.         int 33h
  294.         push    bx
  295.  
  296. IFE FAR_PTRS
  297.  
  298.         mov bx,count
  299.         pop [bx]
  300.         mov bx,y
  301.         mov [bx],dx
  302.         mov bx,x
  303.         mov [bx],cx
  304.  
  305. ELSE
  306.         les bx,count
  307.         pop word ptr es:[bx]
  308.         les bx,y
  309.         mov word ptr es:[bx],dx
  310.         les bx,x
  311.         mov word ptr es:[bx],cx
  312. ENDIF
  313.         ret
  314. mouse_button_rel    ENDP
  315.  
  316. ;****************************************
  317. ; mouse_limit_x PROC:
  318. ;    Description:   limit mouse cursor movement on 
  319. ;                   the x axis (column)
  320. ; void mouse_limit_x(int min_x, int max_x);
  321. ; Procedure mouse_limit_x(min_x, max_x : Integer);
  322. ;****************************************
  323.  
  324. mouse_limit_x   PROC
  325.     ARG min_x, max_x
  326.     mov ax,7
  327.     mov cx,min_x
  328.     mov dx,max_x
  329.     int 33h
  330.     ret
  331. mouse_limit_x   ENDP
  332.  
  333. ;****************************************
  334. ; mouse_limit_y PROC:
  335. ;    Description:   limit mouse cursor movement on 
  336. ;                   the y axis (row)
  337. ; void mouse_limit_y(int min_y, int max_y);
  338. ; Procedure mouse_limit_y(min_y, max_y : Integer);
  339. ;****************************************
  340.  
  341. mouse_limit_y   PROC
  342.     ARG min_y, max_y
  343.     mov ax,8
  344.     mov cx,min_y
  345.     mov dx,max_y
  346.     int 33h
  347.     ret
  348. mouse_limit_y   ENDP
  349.  
  350.  
  351. ;****************************************
  352. ; mouse_set_graphcursor   PROC    USES ES:
  353. ;    Description:   set mouse graphics cursor shape
  354. ; void mouse_set_graphcursor(int xspot,int yspot,void far *masks);
  355. ; Procedure mouse_set_graphcursor(xspot, yspot : Integer; 
  356. ;          masks : pointer);
  357. ;****************************************
  358.  
  359. mouse_set_graphcursor   PROC    USES ES
  360.         ARG xspot, yspot, masks:FAR PTR
  361.         mov ax,9
  362.         mov bx,xspot
  363.         mov cx,yspot
  364.         les dx,masks
  365.         int 33h
  366.         ret
  367. mouse_set_graphcursor   ENDP
  368.  
  369.  
  370. ;****************************************
  371. ; mouse_set_textcursor  PROC:
  372. ;    Description:   set mouse text cursor shape
  373. ; void mouse_set_textcursor(int cursor_type,int scr_mask,
  374. ;           int curs_mask);
  375. ; Procedure mouse_set_textcursor(cursor_type, scr_mask, 
  376. ;           curs_mask : Integer);
  377. ;****************************************
  378.  
  379. mouse_set_textcursor    PROC
  380.         ARG cursor_type, scr_mask, curs_mask
  381.  
  382.         mov ax,0Ah
  383.         mov bx,cursor_type
  384.         mov cx,scr_mask
  385.         mov dx,curs_mask
  386.         int 33h
  387.         ret
  388. mouse_set_textcursor    ENDP
  389.  
  390. ;****************************************
  391. ; mouse_get_movement    PROC:
  392. ;    Description:   get mouse cursor movement information
  393. ; void mouse_get_movement(int *x,int *y);
  394. ; Procedure mouse_get_movement(Var x, y : Integer);
  395. ;****************************************
  396.  
  397. mouse_get_movement  PROC    USES ES
  398.  
  399. IFE FAR_PTRS
  400.         ARG x:NEAR PTR, y:NEAR PTR
  401. ELSE
  402.         ARG x:FAR PTR, y:FAR PTR
  403. ENDIF
  404.         mov ax,0Bh
  405.         int 33h
  406.  
  407. IFE FAR_PTRS
  408.  
  409.         mov bx,x
  410.         mov [bx],cx
  411.         mov bx,y
  412.         mov [bx],dx
  413. ELSE
  414.         les bx,x
  415.         mov word ptr es:[bx],cx
  416.         les bx,y
  417.         mov word ptr es:[bx],dx
  418. ENDIF
  419.         ret
  420. mouse_get_movement  ENDP
  421.  
  422. ;****************************************
  423. ; mouse_set_eventhandler    PROC:
  424. ;    Description:   set up a mouse event handler to be called by
  425. ;            by the mouse driver.
  426. ; void mouse_set_eventhandler(int event_mask, 
  427. ;                             void far (*mhandler)());
  428. ; Procedure mouse_set_eventhandler(event_mask : Integer; 
  429. ;                             mhandler : pointer);
  430. ;****************************************
  431.  
  432. mouse_set_eventhandler  PROC    USES ES
  433.         ARG event_mask, mhandler:FAR PTR
  434.  
  435.         mov ax,0Ch
  436.         mov cx,event_mask
  437.         les dx,mhandler
  438.         int 33h
  439.         ret
  440. mouse_set_eventhandler  ENDP
  441.  
  442. ;****************************************
  443. ; mouse_start_pen_emul  PROC:
  444. ;    Description:   start mouse light-pen emulation
  445. ; void mouse_start_pen_emul(void);
  446. ; Procedure mouse_start_pen_emul;
  447. ;****************************************
  448.  
  449. mouse_start_pen_emul    PROC
  450.         mov ax,0Dh
  451.         int 33h
  452.         ret
  453. mouse_start_pen_emul    ENDP
  454.  
  455. ;****************************************
  456. ; mouse_stop_pen_emul   PROC:
  457. ;    Description:   stop mouse light-pen emulation
  458. ; void mouse_stop_pen_emul(void);
  459. ; Procedure mouse_stop_pen_emul;
  460. ;****************************************
  461.  
  462. mouse_stop_pen_emul PROC
  463.         mov ax,0Eh
  464.         int 33h
  465.         ret
  466. mouse_stop_pen_emul ENDP
  467.  
  468. ;****************************************
  469. ; mouse_set_movement_ratio  PROC:
  470. ;    Description:   set mouse cursor movement ratio
  471. ; void mouse_set_movement_ratio(int x_ratio,int y_ratio);
  472. ; Procedure mouse_set_movement_ratio(x_ratio, y_ratio : Integer);
  473. ;****************************************
  474.  
  475. mouse_set_movement_ratio    PROC
  476.             ARG x_ratio, y_ratio
  477.  
  478.             mov ax,0Fh
  479.             mov cx,x_ratio
  480.             mov dx,y_ratio
  481.             int 33h
  482.             ret
  483. mouse_set_movement_ratio    ENDP
  484.  
  485. ;****************************************
  486. ; mouse_conditional_off PROC:
  487. ;    Description: conditionally turn the mouse cursor off
  488. ; void mouse_conditional_off(int left,int top,int right,int bottom);
  489. ; Procedure mouse_conditional_off(left, top, right, 
  490. ;                                 bottom : Integer);
  491. ;****************************************
  492.  
  493. mouse_conditional_off   PROC    USES SI DI
  494.  
  495.         ARG left, top, right, bottom
  496.  
  497.         mov ax,10h
  498.         mov cx,left
  499.         mov dx,top
  500.         mov si,right
  501.         mov di,bottom
  502.         int 33h
  503.         ret
  504. mouse_conditional_off   ENDP
  505.  
  506. ;****************************************
  507. ; mouse_set_speed   PROC:
  508. ;    Description:   set mouse cursor speed
  509. ; void mouse_set_speed(int threshold);
  510. ; Procedure mouse_set_speed(threshold : Integer);
  511. ;****************************************
  512.  
  513. mouse_set_speed PROC
  514.     ARG threshold
  515.  
  516.     mov ax,13h
  517.     mov bx,threshold
  518.     int 33h
  519.     ret
  520. mouse_set_speed ENDP
  521.  
  522. ;****************************************
  523. ; mouse_swap_vector PROC:
  524. ;    Description:   swap mouse interrupt vectors
  525. ; void far *mouse_swap_vector(int new_mask,int *old_mask,
  526. ;                             void far *new_vector);
  527. ; Function mouse_swap_vector
  528. ; (new_mask : Integer; Var old_mask : Integer; 
  529. ;                            new_vector : pointer) : pointer;
  530. ;****************************************
  531.  
  532. mouse_swap_vector   PROC USES ES
  533.  
  534. IFE FAR_PTRS
  535.  
  536.     ARG new_mask, old_mask:NEAR PTR, new_vector:FAR PTR
  537. ELSE
  538.     ARG new_mask, old_mask:FAR PTR, new_vector:FAR PTR
  539. ENDIF
  540.  
  541.         mov ax,14h
  542.         mov cx,new_mask
  543.  
  544. IFE FAR_PTRS
  545.  
  546.         mov bx,old_mask
  547.         mov [bx],cx
  548. ELSE
  549.         les bx,old_mask
  550.         mov word ptr es:[bx],cx
  551. ENDIF
  552.         les dx,new_vector
  553.         int 33h
  554.         mov ax,es
  555.         xchg    ax,dx
  556.         ret
  557. mouse_swap_vector   ENDP
  558.  
  559. ;****************************************
  560. ; mouse_get_bufsize PROC:
  561. ;   Description: get buffer size needed to store mouse state info
  562. ; int mouse_get_bufsize(void);
  563. ; Function mouse_get_bufsize : Integer;
  564. ;****************************************
  565.  
  566. mouse_get_bufsize   PROC
  567.         mov ax,15h
  568.         int 33h
  569.         mov ax,bx
  570.         ret
  571. mouse_get_bufsize   ENDP
  572.  
  573. ;****************************************
  574. ; mouse_save_state  PROC:
  575. ;    Description:   save the "state" of the mouse driver
  576. ; void mouse_save_state(void far *state_buf);
  577. ; Procedure mouse_save_state(state_buf : pointer);
  578. ;****************************************
  579.  
  580. mouse_save_state    PROC    USES ES
  581.         ARG state_buf:FAR PTR
  582.  
  583.         mov ax,16h
  584.         les dx,state_buf
  585.         int 33h
  586.         ret
  587. mouse_save_state    ENDP
  588.  
  589. ;****************************************
  590. ; mouse_restore_state   PROC:
  591. ;    Description:   restore the mouse driver "state"
  592. ; void mouse_restore_state(void far *state_buf);
  593. ; Procedure mouse_restore_state(state_buf : pointer);
  594. ;****************************************
  595.  
  596. mouse_restore_state PROC    USES ES
  597.         ARG state_buf:FAR PTR
  598.  
  599.         mov ax,17h
  600.         les dx,state_buf
  601.         int 33h
  602.         ret
  603. mouse_restore_state ENDP
  604.  
  605. ;****************************************
  606. ; mouse_set_alt_handler PROC:
  607. ;    Description:   set an alternate mouse event handler
  608. ; void mouse_set_alt_handler(int alt_mask,void far (*func)());
  609. ; Procedure mouse_set_alt_handler(alt_mask : Integer; 
  610. ;                                 func : pointer);
  611. ;****************************************
  612.  
  613. mouse_set_alt_handler   PROC    USES ES
  614.         ARG alt_mask, func:FAR PTR
  615.  
  616.         mov ax,18h
  617.         mov cx,alt_mask
  618.         les dx,func
  619.         int 33h
  620.         ret
  621. mouse_set_alt_handler   ENDP
  622.  
  623. ;****************************************
  624. ; mouse_get_alt_handler PROC:
  625. ;    Description:   get address of alternate mouse event handler
  626. ; int mouse_get_alt_handler(int alt_mask,void far *handler);
  627. ; Function mouse_get_alt_handler
  628. ;   (alt_mask : Integer; handler : pointer) : pointer;
  629. ;****************************************
  630.  
  631. mouse_get_alt_handler   PROC    USES ES DI
  632.         ARG alt_mask, handler:FAR PTR
  633.  
  634.         mov ax,19h
  635.         mov cx,alt_mask
  636.         int 33h
  637.         les di,handler
  638.         mov word ptr es:[di],dx
  639.         mov word ptr es:[di+2],bx
  640.         mov ax,cx
  641.         ret
  642. mouse_get_alt_handler   ENDP
  643.  
  644. ;****************************************
  645. ; mouse_set_sens    PROC:
  646. ;    Description:   set mouse sensitivity
  647. ; void mouse_set_sens(int x_ratio,int y_ratio,int threshold);
  648. ; Procedure mouse_set_sens(x_ratio, y_ratio, 
  649. ;                          threshold : Integer);
  650. ;****************************************
  651.  
  652. mouse_set_sens  PROC
  653.     ARG x_ratio, y_ratio, threshold
  654.  
  655.     mov ax,1Ah
  656.     mov bx,x_ratio
  657.     mov cx,y_ratio
  658.     mov dx,threshold
  659.     int 33h
  660.     ret
  661. mouse_set_sens  ENDP
  662.  
  663. ;****************************************
  664. ; mouse_get_sens    PROC:
  665. ;    Description:   get mouse sensitivity
  666. ; void mouse_get_sens(int *x_ratio,int *y_ratio,
  667. ;                     int *threshold);
  668. ; Procedure mouse_get_sens(Var x_ratio, y_ratio, 
  669. ;                     threshold : Integer);
  670. ;****************************************
  671.  
  672. mouse_get_sens  PROC    USES ES
  673.  
  674. IFE FAR_PTRS
  675.  
  676. ARG x_ratio:NEAR PTR, y_ratio:NEAR  PTR, threshold:NEAR PTR
  677. ELSE
  678. ARG x_ratio:FAR PTR, y_ratio:FAR PTR, threshold:FAR PTR
  679. ENDIF
  680.     mov ax,1Bh
  681.     int 33h
  682.     push    bx
  683.  
  684. IFE FAR_PTRS
  685.  
  686.     mov bx,x_ratio
  687.     pop [bx]
  688.     mov bx,y_ratio
  689.     mov [bx],cx
  690.     mov bx,threshold
  691.     mov [bx],dx
  692. ELSE
  693.     les bx,x_ratio
  694.     pop word ptr es:[bx]
  695.     les bx,y_ratio
  696.     mov word ptr es:[bx],cx
  697.     les bx,threshold
  698.     mov word ptr es:[bx],dx
  699. ENDIF
  700.     ret
  701. mouse_get_sens  ENDP
  702.  
  703. ;****************************************
  704. ; mouse_set_crt_page    PROC:
  705. ;    Description:   set mouse crt page (video page)
  706. ; void mouse_set_crt_page(int crt_page);
  707. ; Procedure mouse_set_crt_page(crt_page : Integer);
  708. ;****************************************
  709.  
  710. mouse_set_crt_page  PROC
  711.         ARG crt_page
  712.         mov ax,1Dh
  713.         mov bx,crt_page
  714.         int 33h
  715.         ret
  716. mouse_set_crt_page  ENDP
  717.  
  718. ;****************************************
  719. ; mouse_get_crt_page    PROC:
  720. ;    Description:   get mouse crt page (video page)
  721. ; int mouse_get_crt_page(void);
  722. ; Function mouse_get_crt_page : Integer;
  723. ;****************************************
  724.  
  725. mouse_get_crt_page  PROC
  726.         mov ax,1Eh
  727.         int 33h
  728.         mov ax,bx
  729.         ret
  730. mouse_get_crt_page  ENDP
  731.  
  732. ;****************************************
  733. ; mouse_disable_drvr    PROC:
  734. ;    Description:   disable mouse driver
  735. ; int mouse_disable_drvr(void far *vector_33h);
  736. ; Function mouse_disable_drvr(vector_33h : pointer) : Integer;
  737. ;****************************************
  738.  
  739. mouse_disable_drvr  PROC    USES ES
  740.         ARG vector_33h:FAR PTR
  741.  
  742.         mov ax,1Fh
  743.         int 33h
  744.         cmp ax,-1
  745.         je  @@exit
  746.         mov dx,es
  747.         mov cx,bx
  748.         les bx,vector_33h
  749.         mov word ptr es:[bx],cx
  750.         mov word ptr es:[bx+2],dx
  751.     @@exit:
  752.         ret
  753. mouse_disable_drvr  ENDP
  754.  
  755. ;****************************************
  756. ; mouse_enable_drvr PROC:
  757. ;    Description:   enable mouse driver
  758. ; void mouse_enable_drvr(void);
  759. ; Procedure mouse_enable_drvr;
  760. ;****************************************
  761.  
  762. mouse_enable_drvr   PROC
  763.         mov ax,20h
  764.         int 33h
  765.         ret
  766. mouse_enable_drvr   endp
  767.  
  768. ;****************************************
  769. ; mouse_soft_reset  PROC:
  770. ;    Description:   mouse software reset
  771. ; int mouse_soft_reset(int *nbuttons);
  772. ; Function mouse_soft_reset(Var nbuttons : Integer):Integer;
  773. ;****************************************
  774.  
  775. mouse_soft_reset    PROC    USES ES
  776.  
  777. IFE FAR_PTRS
  778.         ARG nbuttons:NEAR PTR
  779. ELSE
  780.         ARG nbuttons:FAR PTR
  781. ENDIF
  782.         mov ax,21h
  783.         int 33h
  784.         cmp ax,-1
  785.         jne @@exit
  786.         push    bx
  787.  
  788. IFE FAR_PTRS
  789.  
  790.         mov bx,nbuttons
  791.         pop [bx]
  792.  
  793. ELSE
  794.         les bx,nbuttons
  795.         pop word ptr es:[bx]
  796.  
  797. ENDIF
  798.  
  799.     @@exit:
  800.         ret
  801. mouse_soft_reset    ENDP
  802.  
  803.         END
  804.