summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/ndpcheck.asm
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2008-01-27 11:37:44 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2008-01-27 11:37:44 +0100
commit7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch)
treeb1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/CONTRIB/SNIP/ndpcheck.asm
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/CONTRIB/SNIP/ndpcheck.asm')
-rwxr-xr-xreference/C/CONTRIB/SNIP/ndpcheck.asm44
1 files changed, 44 insertions, 0 deletions
diff --git a/reference/C/CONTRIB/SNIP/ndpcheck.asm b/reference/C/CONTRIB/SNIP/ndpcheck.asm
new file mode 100755
index 0000000..4f788ef
--- /dev/null
+++ b/reference/C/CONTRIB/SNIP/ndpcheck.asm
@@ -0,0 +1,44 @@
+ 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