home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / genapps / hp22de.arj / EXTERN / MOUSE.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-04-16  |  1.9 KB  |  142 lines

  1. DOSSEG
  2. .MODEL        LARGE
  3.  
  4. .DATA
  5.  
  6. .CODE
  7.  
  8. version        dw        0
  9. msarea        db        1024 dup (0)
  10. msthere        db        0
  11.  
  12.         public        _show
  13. _show:
  14.         cmp byte ptr    cs:msthere,0    ;is the mouse installed?
  15.         je        S1
  16.         mov        ax,1        ;AX = show mouse function num
  17.         int        33h        ;show the mouse
  18. S1:        retf
  19.  
  20.         public        _hide
  21. _hide:
  22.         cmp byte ptr    cs:msthere,0    ;is the mouse installed?
  23.         je        H1
  24.         mov        ax,2        ;AX = hide mouse function num
  25.         int        33h        ;hide the mouse
  26. H1:        retf
  27.  
  28.         public        _button
  29. _button:    
  30.         xor        ax,ax        ;return NO BUTTON by default
  31.         cmp byte ptr    cs:msthere,0    ;mouse there?
  32.         je        B1
  33.         mov        ax,3        ;AX = get button info func num
  34.         int        33h        ;BX = get button info in
  35.         mov        ax,bx        ;AX = button status
  36. B1:
  37.         retf
  38.  
  39.         public        _savemouse
  40. _savemouse:
  41.         push        di
  42.         push        si
  43.         push        ds
  44.  
  45.         xor        ax,ax
  46.         mov        es,ax        ;ES = 0
  47.         mov        al,'m';        ;undoc call to get mouse area
  48.         int        33h        ;get mouse save area
  49.         mov        ax,es
  50.         or        ax,ax        ;any change?
  51.         jz        SM1
  52.  
  53.         mov        al,1
  54.         mov        cs:msthere,al
  55.  
  56.         cli
  57.         mov        ax,es:[di]
  58.         mov        cs:version,ax
  59.  
  60.         mov        si,es:[di+8]
  61.  
  62.         mov        di,offset cs:msarea
  63.  
  64.         push        es
  65.         push        cs
  66.         pop        es
  67.         pop        ds
  68.  
  69.         ;ES:DI = destination for mouse stuff
  70.         ;DS:SI = source
  71.  
  72. SM2:
  73.         mov        bx,[si]
  74.         mov        cx,[si+2]
  75.         mov        si,[si+4]
  76.  
  77.         rep        movsb
  78.         mov        si,bx
  79.         or        bx,bx
  80.         jnz        SM2
  81.  
  82.         ;disable user defined sub-routine
  83.  
  84.         mov        ax,12
  85.         mov        cx,0
  86.         int        33h
  87.  
  88.         sti
  89.  
  90. SM1:
  91.         pop        ds
  92.         pop        si
  93.         pop        di
  94.         retf
  95.  
  96.  
  97.  
  98.         public        _restoremouse
  99. _restoremouse:
  100.         push        si
  101.         push        di
  102.         push        ds
  103.  
  104.         cmp byte ptr    cs:msthere,0
  105.         je        RM1
  106.  
  107.         cli
  108.  
  109.         mov        ax,'m'
  110.         int        33h
  111.  
  112.         mov        si,es:[di+8]
  113.         mov        di,offset cs:msarea
  114.  
  115.         xchg        di,si
  116.  
  117.         push        cs
  118.         pop        ds
  119.  
  120.         ;DS:SI = local mouse storage
  121.         ;ES:DI = mouse area
  122.  
  123. RM2:
  124.         mov        bx,es:[di]
  125.         mov        cx,es:[di+2]
  126.         mov        di,es:[di+4]
  127.  
  128.         rep        movsb
  129.  
  130.         mov        di,bx
  131.         or        bx,bx
  132.         jnz        RM2
  133.  
  134.         sti
  135. RM1:
  136.         pop        ds
  137.         pop        di
  138.         pop        si
  139.         retf
  140.  
  141. END
  142.