$mod186 name example_80C187_init ; ; FUNCTION: This function initializes the 80C187 numerics ; co-processor. ; ; SYNTAX: extern unsigned char far 187_init(void); ; ; INPUTS: None ; ; OUTPUTS: unsigned char - 0000h -> False -> coprocessor not ; initialized ; ffffh -> True -> coprocessor ; 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_init _187_init proc far push bp ;save caller's bp mov bp, sp ;get current top of stack cli ;disable maskable ;interrupts fninit ;init 80C187 processor fnstcw [bp-2] ;get current control word sti ;enable interrupts mov ax, [bp-2] and ax, 0300h ;mask off unwanted control ;bits cmp ax, 0300h ;PC bits = 11 je Ok ;yes: processor ok xor ax, ax ;return false (80C187 not ;ok) pop bp ;restore caller's bp ret Ok: and [bp-2], 0fffeh ;unmask possible exceptions fldcw [bp-2] mov ax,0ffffh ;return true (80C187 ok) pop bp ;restore caller's bp ret _187_init endp lib_80186 ends end
Legal Stuff © 1997 Intel Corporation