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

📄 tstfint.asm

📁 一个能处理中断的vxd例子
💻 ASM
字号:
; COPYRIGHT:
;
;   (C) Copyright Microsoft Corp. 1993.  All rights reserved.
;
;   You have a royalty-free right to use, modify, reproduce and
;   distribute the Sample Files (and/or any modified version) in
;   any way you find useful, provided that you agree that
;   Microsoft has no warranty obligations or liability for any
;   Sample Application Files which are modified.
;
;
        name    vfintd
;
;       This is a small test app which calls the VxD API for the 
;       VFINTD device.

        include vfintd.inc
;
cr      equ     0dh
lf      equ     0ah

_DATA   segment word public 'DATA'
hellow  db      'VxD Version = '
vfintdx db      4 dup (?)
        db      cr,lf
hellowl equ     $-hellow

no_support_msg db 'Can not function.  Are we in a DOS box under Windows?  ',\
                  'Is VFINTD installed?', cr,lf
no_support_msg_len equ $ - no_support_msg

VxDFunc dd      ?
_DATA   ends



_TEXT   segment word public 'CODE'
        assume cs:_TEXT,ds:_DATA

;*--------------------------------------------------------------------*
;       This routine will get the VxD Device API entry point via 
;       an INT 2F call. Then, calling that entry point, it will 
;       retrieve the version number of the VxD, and more importantly
;       set the focus for floppy interrupts.
;

vfintd proc    far
        mov     ax,_DATA
        mov     ds,ax

        mov     bx,VFINTD_Dev_ID        ; get VxD ID
        mov     ax,1684h                ; Get Device API Entry Point
        int     2fh
        mov     ax,es
        or      ax,di                   ; installed?
        jz      no_support              ; no

        mov     WORD PTR [VxDFunc], di
        mov     WORD PTR [VxDFunc+2], es

        mov     ax,0                    ; get version
        call    VxDFunc

        mov     bx,offset vfintdx      
        call    hexasc

        mov     dx,offset hellow        ;Print VxD version number
        mov     cx,hellowl
        mov     bx,1                    ;stdout
        mov     ah,40h                  ;write
        int     21h
        
        mov     ax,100h                 ; Set focus
        call    VxDFunc
        jmp     short ByeBye

no_support:
        mov     dx,offset no_support_msg  ;Print error message
        mov     cx,no_support_msg_len
        mov     bx,1                    ;stdout
        mov     ah,40h                  ;write
        int     21h
        
ByeBye:
        mov     ax,4c00h
        int     21h
vfintd endp


;--------------------------------------------------------------------
;
;       hexasc
;
;       convert hex to ascii
;
;--------------------------------------------------------------------
hexasc  proc    near            ; converts word to hex ASCII
                                ; call with AX = value,
                                ; DS:BX = address for string
                                ; returns AX, BX destroyed

        push    cx              ; save registers
        push    dx

        mov     dx,4            ; initialize character counter
hexasc1:
        mov     cx,4            ; isolate next four bits
        rol     ax,cl
        mov     cx,ax
        and     cx,0fh
        add     cx,'0'          ; convert to ASCII
        cmp     cx,'9'          ; is it 0-9?
        jbe     hexasc2         ; yes, jump
        add     cx,'A'-'9'-1    ; add fudge factor for A-F

hexasc2:                        ; store this character
        mov     [bx],cl
        inc     bx              ; bump string pointer

        dec     dx              ; count characters converted
        jnz     hexasc1         ; loop, not four yet

        pop     dx              ; restore registers
        pop     cx
        ret                     ; back to caller

hexasc  endp



_TEXT   ends

        end     vfintd

⌨️ 快捷键说明

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