Initialization Sequence For 80C187 Math Coprocessor - Intel 80C186XL User Manual

Intel microprocessor user's manual
Table of Contents

Advertisement

$mod186
name
example_80C187_init
;
;FUNCTION:
This function initializes the 80C187 numerics coprocessor.
;
;SYNTAX:
extern unsigned char far 187_init(void);
;
;INPUTS:
None
;
;OUTPUTS:
unsigned char - 0000h -> False -> coprocessor not initialized
;
;
;NOTE:
Parameters are passed on the stack as required by
;
high-level languages.
;
lib_80186
segment public 'code'
assume cs:lib_80186
public
_187_initproc far
push
bp
mov
bp, sp
cli
fninit
fnstcw
[bp-2]
sti
mov
ax, [bp-2]
and
ax, 0300h
cmp
ax, 0300h
je
Ok
xor
ax, ax
pop
bp
ret
Ok:
and
[bp-2], 0fffeh
fldcw
[bp-2]
mov
ax,0ffffh
pop
bp
ret
_187_initendp
lib_80186ends
end
Example 11-1. Initialization Sequence for 80C187 Math Coprocessor
ffffh -> True
_187_init
;save caller's bp
;get current top of stack
;disable maskable interrupts
;init 80C187 processor
;get current control word
;enable interrupts
;mask off unwanted control bits
;PC bits = 11
;yes: processor ok
;return false (80C187 not ok)
;restore caller's bp
;unmask possible exceptions
;return true (80C187 ok)
;restore caller's bp
MATH COPROCESSING
-> coprocessor initialized
11-15

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c188xl

Table of Contents