⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 int33h.asm

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
@@SaveState:    ;Preserve mouse driver state.
        ;
        pushm   eax,ebx,ecx,edx,esi,edi,ebp
        pushm   ds,es,fs
        ;
        push    eax
        xor     eax,eax
        mov     ax,es
        lsl     eax,eax
        cmp     eax,10000h
        jnc     @@Use32Bit58
        movzx   edx,dx
@@Use32Bit58:   pop     eax
        ;
        pushm   edx,es
        mov     edi,offset Int33Buffer
        mov     es,cs:Int33hDseg
        assume es:_cwMain
        mov     fs,es:PSPSegment
        xor     edx,edx
        mov     es:[edi].Real_EAX,eax
        mov     es:[edi].Real_EDX,edx
        mov     ax,fs:w[EPSP_TransReal]
        mov     es:[edi].Real_ES,ax
        assume es:nothing
        mov     bl,33h
        sys     IntXX
        mov     es:Real_EAX[edi],15h
        mov     bl,33h
        sys     IntXX
        mov     ecx,es:Real_EBX[edi]
        movzx   ecx,cx
        popm    edi,es
        ;
        mov     ds,cs:Int33hDDseg
        assume ds:_Int33h
        mov     eax,d[Int33hUserCode]
        mov     es:[edi],eax
        add     edi,4
        mov     ax,w[Int33hUserCode+4]
        mov     es:[edi],ax
        add     edi,2
        mov     ax,w[Int33hUserOK]
        mov     es:[edi],ax
        add     edi,2
        mov     ax,w[Int33hUserMask]
        mov     es:[edi],ax
        add     edi,2
        assume ds:nothing
        ;
        mov     ds,cs:Int33hDseg
        assume ds:_cwMain
        xor     esi,esi
        mov     ds,fs:w[EPSP_TransProt]
        assume ds:nothing
        cld
        rep     movsb
        popm    ds,es,fs
        popm    eax,ebx,ecx,edx,esi,edi,ebp
        jmp     @@Done
        ;
@@ResState:     ;Restore mouse driver state.
        ;
        pushm   eax,ebx,ecx,edx,esi,edi,ebp
        pushm   ds,es,fs
        push    eax
        xor     eax,eax
        mov     ax,es
        lsl     eax,eax
        cmp     eax,10000h
        jnc     @@Use32Bit59
        movzx   edx,dx
@@Use32Bit59:   pop     eax
        ;
        pushm   eax,edx,es
        pushm   eax,edx,es
        mov     es,cs:Int33hDseg
        mov     edi,offset Int33Buffer
        mov     es:Real_EAX[edi],15h
        mov     bl,33h
        sys     IntXX
        mov     ecx,es:Real_EBX[edi]
        movzx   ecx,cx
        popm    eax,esi,ds
        ;
        mov     es,cs:Int33hDseg
        assume es:_cwMain
        mov     fs,es:PSPSegment
        xor     edi,edi
        mov     es,fs:w[EPSP_TransProt]
        assume es:nothing
        ;
        pushm   ds,es
        mov     es,cs:Int33hDDSeg
        assume es:_Int33h
        mov     eax,[esi]
        mov     es:d[Int33hUserCode],eax
        add     esi,4
        mov     ax,[esi]
        mov     es:w[Int33hUserCode+4],ax
        add     esi,2
        mov     ax,[esi]
        mov     es:w[Int33hUserOK],ax
        add     esi,2
        mov     ax,[esi]
        mov     es:w[Int33hUserMask],ax
        add     esi,2
        assume es:nothing
        popm    ds,es
        cld
        rep     movsb
        ;
        popm    eax,edx,es
        mov     edi,offset Int33Buffer
        mov     es,cs:Int33hDseg
        assume es:_cwMain
        xor     edx,edx
        mov     es:[edi].Real_EAX,eax
        mov     es:[edi].Real_EDX,edx
        mov     ax,fs:w[EPSP_TransReal]
        mov     es:[edi].Real_ES,ax
        assume es:nothing
        mov     bl,33h
        sys     IntXX
        ;
        popm    ds,es,fs
        popm    eax,ebx,ecx,edx,esi,edi,ebp
        jmp     @@Done
        ;
@@Done: ;Now update stacked flags.
        ;
        pushm   eax,ebx
        pushf
        pop     ax                      ;get new flags.
        push    ds
        mov     ds,cs:Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@Use32Bit8
        mov     bx,sp
        mov     bx,ss:[bx+(4+4)+(2+2)]          ;get origional flags.
        jmp     @@Use16Bit8
@@Use32Bit8:    mov     bx,ss:[esp+(4+4)+(4+4)]         ;get origional flags.
@@Use16Bit8:    and     bx,0000011000000000b            ;retain IF.
        and     ax,1111100111111111b            ;lose IF.
        or      ax,bx                   ;get old IF.
        push    ds
        mov     ds,cs:Int33hDseg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@Use32Bit9
        mov     bx,sp
        mov     ss:[bx+(4+4)+(2+2)],ax          ;modify stack flags.
        jmp     @@Use16Bit9
@@Use32Bit9:    mov     ss:[esp+(4+4)+(4+4)],ax         ;modify stack flags.
@@Use16Bit9:    popm    eax,ebx
        push    ds
        mov     ds,cs:Int33hDseg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@Use32Bit10
        iret
@@Use32Bit10:   ;
        iretd
        ;
@@NotOurs:      ;Not a function recognised by us so pass control to previous handler.
        ;
        push    ds
        mov     ds,cs:Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@Use32Bit11
        db 66h
        jmp     cs:f[OldInt33h]         ;pass it onto previous handler.
@@Use32Bit11:   jmp     cs:f[OldInt33h]         ;pass it onto previous handler.
Int33h  endp


;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
MouseEvent      proc    far
        push    ax
        push    ds
        mov     ds,cs:Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@start32
        ;
        mov     ax,[si]         ;get stacked offset.
        mov     es:Real_IP[di],ax
        mov     ax,2[si]
        mov     es:Real_CS[di],ax
        add     es:Real_SP[di],4
        jmp     @@start0
        ;
@@start32:
;       mov     ax,[esi]                ;get stacked offset.
        mov     ax,[si]         ;get stacked offset., MED 01/24/95

        mov     es:Real_IP[edi],ax
;       mov     ax,2[esi]
        mov     ax,2[si]        ; MED 01/24/95

        mov     es:Real_CS[edi],ax
        add     es:Real_SP[edi],4
        ;
@@start0:       pop     ax
        pushm   ds,es,fs,gs
        pushad
        mov     ds,cs:Int33hDDSeg
        assume ds:_Int33h
        ;
        cmp     w[MouseEventStack+4],0
        jz      @@ok
        mov     al,1
        call    bord33
@@shit: jmp     @@shit
        mov     ax,-1
        mov     es,ax
        jmp     @@exit
        ;
@@ok:   cmp     w[Int33hUserOK],0
        jz      @@exit
        ;
        mov     d[MouseEventStack],esp
        mov     w[MouseEventStack+4],ss
        mov     ax,ds
        mov     ss,ax
        mov     esp,offset MouseEventStack
        push    ds
        mov     ds,Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:_Int33h
        pop     ds
        jz      @@its32
        movzx   edi,di
@@its32:        mov     eax,es:Real_EAX[edi]
        movsx   eax,ax
        mov     ebx,es:Real_EBX[edi]
        movsx   ebx,bx
        mov     ecx,es:Real_ECX[edi]
        movsx   ecx,cx
        mov     edx,es:Real_EDX[edi]
        movsx   edx,dx
        mov     esi,es:Real_ESI[edi]
        movsx   esi,si
        mov     edi,es:Real_EDI[edi]
        movsx   edi,di
        ;
        mov     ds,Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        jz      @@Use32Bit
        db 66h
        call    cs:f[Int33hUserCode]
        jmp     @@OldStack
@@Use32Bit:     call    cs:f[Int33hUserCode]
@@OldStack:     ;
        lss     esp,cs:f[MouseEventStack]
        push    ds
        mov     ds,cs:Int33hDDSeg
        assume ds:_Int33h
        mov     w[MouseEventStack+4],0
        assume ds:nothing
        pop     ds
@@Exit: ;
        popad
        mov     ds,cs:Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        popm    ds,es,fs,gs
        jz      @@Use32Bit2
        iret
@@Use32Bit2:    ;
        iretd
MouseEvent      endp


;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Int33hDummy     proc    near
        push    ds
        mov     ds,cs:Int33hDSeg
        assume ds:_cwMain
        test    SystemFlags,1
        assume ds:nothing
        pop     ds
        jz      @@32bit
        db 66h
        retf
@@32Bit:        ;
        retf
Int33hDummy     endp


;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Bord33  proc    near
        pushm   ax,dx
        mov     ah,al
        mov     dx,3dah
        in      al,dx
        mov     dl,0c0h
        mov     al,11h
        out     dx,al
        mov     al,ah
        out     dx,al
        mov     al,20h
        out     dx,al
        popm    ax,dx
        ret
Bord33  endp


MouseEventTab   db size RealRegsStruc dup (0)
        db 1024 dup (0)
MouseEventStack df 0
;
OldInt33h       df 0
Int33hCSeg      dw ?
Int33hDSeg      dw ?
Int33hDDSeg     dw ?
;
Int33hCallBack  dd 0
Int33hUserCode  df 0
Int33hUserMask  dw 0
Int33hUserOK    dw 0
;
        db 4 dup (0)
Int33hEnd       label byte
_Int33h ends
        .286




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -