home *** CD-ROM | disk | FTP | other *** search
- ;
- ; ms_drive.asm
- ;
- ; Purpose: Mouse primitives.
- ;
- ; Blackstar C Function Libarary
- ; (c) Copyright 1985,1989 Sterling Castle Software
- ;
-
- include model
- include blackstr.mac
-
-
- dseg 'DATA'
-
- public ms_ax_,ms_bx_,ms_cx_,ms_dx_,ms_func_,ms_seg_,ms_off_,ms_dseg_
-
- ifdef asm_386
- ALIAS _ms_ax_ DWORD
- ms_ax_ dd 00
- ALIAS _ms_bx_ DWORD
- ms_bx_ dd 00
- ALIAS _ms_cx_ DWORD
- ms_cx_ dd 00
- ALIAS _ms_dx_ DWORD
- ms_dx_ dd 00
-
- else
- ALIAS _ms_ax_ WORD
- ms_ax_ dw 00
- ALIAS _ms_bx_ WORD
- ms_bx_ dw 00
- ALIAS _ms_cx_ WORD
- ms_cx_ dw 00
- ALIAS _ms_dx_ WORD
- ms_dx_ dw 00
- endif
-
- ; address of C function to call on interrupt
-
- ifdef asm_386
- ALIAS _ms_func_ DWORD
- ALIAS ms_func_ DWORD
- else
- ifdef Large_code
- ALIAS _ms_func_ DWORD
- ALIAS ms_func_ DWORD
- else
- ALIAS _ms_func_ WORD
- ALIAS ms_func_ WORD
- endif
- endif
-
- ifdef asm_386
- ALIAS _ms_off_ DWORD
- ms_off_ dd 00
- else
- ALIAS _ms_off_ WORD
- ms_off_ dw 00
- endif
-
- ALIAS _ms_seg_ WORD
- ms_seg_ dw 00 ; for Lattice access in P model
- ALIAS _ms_dseg_ WORD
- ms_dseg_ dw 00 ; data segment for service routine
-
- ; local stack for interrupt
-
- sstk db 'Start of stack';start of stack
- stck_m db 512 dup(?)
- pstack equ $-2 ;start it here
- estk db 'End of stack' ;end of stack
-
- enddseg
-
-
- cseg ms_intsvc_
-
- ;-----------------
- ; ms_intsvc mouse interrupt service routine
- ;-----------------
- ;
- ; Notes: The mouse driver provides NO stack space for the service
- ; routine. Therefore, this routine is NOT RE-ENTRANT.
- ;
-
- public ms_intsvc_
-
- ms_intsvc_ proc far
- push eax
- push ebx
- push ecx
-
- ifdef Large_data
- mov ax,seg dgroup
- mov ds,ax
- endif
-
- ; save regs from mouse
-
- mov ms_ax_,eax
- mov ms_bx_,ebx
- mov ms_cx_,ecx
- mov ms_dx_,edx
-
- ; save old stack on new stack
-
- mov bx,ss
- mov ecx,esp
-
- cli
-
- ifndef asm_386
- mov ax,seg dgroup ;stack is in this seg
- mov ss,ax ;set stack segment to here
- endif
-
- mov esp,offset dgroup:pstack ;and offset
- sti
-
- push ebx
- push ecx
-
- ; save other registers in case they're used
-
- push edi
- push esi
- push ebp
- push ds
- push es
- mov ax,ms_dseg_ ;get data segment
- cmp ax,0
- jne int1
-
- ifndef asm_386
- mov ax,seg dgroup ;use dgroup for default
- int1:
- mov ds,ax ;point ds to dgroup
- mov es,ax ;and es
- else
- int1:
- endif
-
- mov ebx,offset dgroup:ms_func_
-
- ifdef Large_code
- call dword ptr [ms_func_]
- else
- call [ms_func_]
- endif
-
- ; exit from print screen interrupt
-
- int_exit:
- pop es
- pop ds
- pop ebp
- pop esi
- pop edi
-
- ; restore beginning stack
-
- pop ecx
- pop ebx
-
- cli
- mov esp,ecx
- ifndef asm_386
- mov ss,bx
- endif
- sti
-
- pop ecx
- pop ebx
- pop eax
-
- int_x: return
- ms_intsvc_ endp
-
- endcseg ms_intsvc_
- end
-
-
-