ndpcheck.asm

来自「由8051/8096/8099/8048单片机汇编工具、 汇编语言、摩托罗拉m」· 汇编 代码 · 共 45 行

ASM
45
字号
        page    55, 132

;
;  FUNCTION:  ndp_check
;
;  Require MASM 5.1 or later, or equivalent
;
;  Assemble with:       MASM /Mx /z ...
;                       TASM /jMASM /mx /z ...
;

%       .MODEL  memodel,C               ;Add model support via
                                        ;command line macros, e.g.
                                        ;MASM /Mx /Dmemodel=LARGE

        .CODE

control dw      0

;---------------------------------------------------------------
;
; Check for an NDP.
;
;  Returns 0 if no coprocessor
;  Returns 1 if coprocessor present

        PUBLIC  ndp_check

ndp_check       PROC    USES BX
        xor     BX,BX                    ; set up zero return
        fninit                           ; try to initialize the NDP
        mov     byte ptr control+1,0     ; clear memory byte
        fnstcw  control                  ; put control word in memory
        mov     AH,byte ptr control+1    ; if AH is 03h, you got
        cmp     AH,03h                   ;   an NDP on board !!
        jne     SHORT NDPbye
        inc     BX
NDPbye:
        mov     AX,BX
        ret

ndp_check       ENDP

        end

⌨️ 快捷键说明

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