home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / SOURCE / IBMLIB / MS_DRIVE.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-14  |  3.0 KB  |  184 lines

  1. ;
  2. ;  ms_drive.asm
  3. ;
  4. ;  Purpose: Mouse primitives.
  5. ;
  6. ;  Blackstar C Function Libarary
  7. ;  (c) Copyright 1985,1989 Sterling Castle Software
  8. ;
  9.  
  10.     include model
  11.     include blackstr.mac
  12.  
  13.  
  14.     dseg    'DATA'
  15.  
  16.     public ms_ax_,ms_bx_,ms_cx_,ms_dx_,ms_func_,ms_seg_,ms_off_,ms_dseg_
  17.  
  18.     ifdef   asm_386
  19.     ALIAS _ms_ax_   DWORD
  20.     ms_ax_  dd      00
  21.     ALIAS _ms_bx_   DWORD
  22.     ms_bx_  dd      00
  23.     ALIAS _ms_cx_   DWORD
  24.     ms_cx_  dd      00
  25.     ALIAS _ms_dx_   DWORD
  26.     ms_dx_  dd      00
  27.  
  28.     else
  29.     ALIAS _ms_ax_   WORD
  30.     ms_ax_  dw      00
  31.     ALIAS _ms_bx_   WORD
  32.     ms_bx_  dw      00
  33.     ALIAS _ms_cx_   WORD
  34.     ms_cx_  dw      00
  35.     ALIAS _ms_dx_   WORD
  36.     ms_dx_  dw      00
  37.     endif
  38.  
  39.     ; address of C function to call on interrupt
  40.  
  41.     ifdef    asm_386
  42.         ALIAS _ms_func_ DWORD
  43.         ALIAS ms_func_  DWORD
  44.     else
  45.         ifdef   Large_code
  46.         ALIAS _ms_func_ DWORD
  47.         ALIAS ms_func_  DWORD
  48.         else
  49.         ALIAS _ms_func_ WORD
  50.         ALIAS ms_func_  WORD
  51.         endif
  52.     endif
  53.  
  54.     ifdef   asm_386
  55.         ALIAS _ms_off_  DWORD
  56.         ms_off_ dd 00
  57.     else
  58.         ALIAS _ms_off_  WORD
  59.         ms_off_ dw 00
  60.     endif
  61.  
  62.     ALIAS _ms_seg_  WORD
  63.     ms_seg_ dw 00        ; for Lattice access in P model
  64.     ALIAS _ms_dseg_    WORD
  65.     ms_dseg_ dw 00        ; data segment for service routine
  66.  
  67.     ; local stack for interrupt
  68.  
  69.     sstk    db    'Start of stack';start of stack
  70.     stck_m    db    512 dup(?)
  71.     pstack    equ    $-2        ;start it here
  72.     estk    db    'End of stack'    ;end of stack
  73.  
  74.     enddseg
  75.  
  76.  
  77.     cseg    ms_intsvc_
  78.  
  79. ;-----------------
  80. ;   ms_intsvc        mouse interrupt service routine
  81. ;-----------------
  82. ;
  83. ;    Notes:    The mouse driver provides NO stack space for the service
  84. ;        routine.  Therefore, this routine is NOT RE-ENTRANT.
  85. ;
  86.  
  87.     public  ms_intsvc_
  88.  
  89. ms_intsvc_ proc far
  90.     push    eax
  91.     push    ebx
  92.     push    ecx
  93.  
  94.     ifdef   Large_data
  95.     mov     ax,seg dgroup
  96.     mov     ds,ax
  97.     endif
  98.  
  99.     ; save regs from mouse
  100.  
  101.     mov     ms_ax_,eax
  102.     mov     ms_bx_,ebx
  103.     mov     ms_cx_,ecx
  104.     mov     ms_dx_,edx
  105.  
  106.     ; save old stack on new stack
  107.  
  108.     mov     bx,ss
  109.     mov     ecx,esp
  110.  
  111.     cli
  112.  
  113.     ifndef    asm_386
  114.     mov     ax,seg dgroup   ;stack is in this seg
  115.     mov     ss,ax           ;set stack segment to here
  116.     endif
  117.  
  118.     mov     esp,offset dgroup:pstack ;and offset
  119.     sti
  120.  
  121.     push    ebx
  122.     push    ecx
  123.  
  124.     ; save other registers in case they're used
  125.  
  126.     push    edi
  127.     push    esi
  128.     push    ebp
  129.     push    ds
  130.     push    es
  131.     mov     ax,ms_dseg_    ;get data segment
  132.     cmp     ax,0
  133.     jne     int1
  134.  
  135.     ifndef    asm_386
  136.     mov     ax,seg dgroup   ;use dgroup for default
  137. int1:   
  138.     mov     ds,ax           ;point ds to dgroup
  139.     mov     es,ax           ;and es
  140.     else
  141. int1:
  142.     endif
  143.  
  144.     mov     ebx,offset dgroup:ms_func_
  145.  
  146.     ifdef   Large_code
  147.         call    dword ptr [ms_func_]
  148.     else
  149.         call    [ms_func_]
  150.     endif
  151.  
  152.     ; exit from print screen interrupt
  153.  
  154. int_exit:
  155.     pop     es
  156.     pop     ds
  157.     pop     ebp
  158.     pop     esi
  159.     pop     edi
  160.  
  161.     ; restore beginning stack
  162.  
  163.     pop     ecx
  164.     pop     ebx
  165.  
  166.     cli
  167.     mov     esp,ecx
  168.     ifndef  asm_386
  169.     mov     ss,bx
  170.     endif
  171.     sti
  172.  
  173.     pop     ecx
  174.     pop     ebx
  175.     pop     eax
  176.  
  177. int_x:  return
  178. ms_intsvc_ endp
  179.  
  180.     endcseg ms_intsvc_
  181.     end
  182.  
  183.  
  184.