I'd like to know how to check for an FPU using ASM. Thanks.
.data myword dw 1234h ;anything nonzero ... .code ... fninit ;initialize copro if any fnstsw myword ;if copro present, this will put 0 to mem mov ecx,myword jcxz HasCopro
Wouldn't the code you suggested above cause a problem to a CPU that doesn't have an FPU?
It should cause no trouble. I got it from Intel documentation some years back.
I thought the FPU was built in all pentium and aove processor anyway? If a floating point unit is not present, but is being emulated, then the above code will return incorrect results. A much better way (to make sure the FPU CHIP is present), on a pentium or later is to use the CPUID instruction.
With the above, there may be a problem with a non-intel processor, as the flags returned in EDX may or may not be different. Im trying to find the docs now.
mov eax,1 ;CPUID code to use cpuid ;Execute instruction test edx,1 ;Test if bit 1 in EDX is set jz NoFPU ;If not, there is no FPU
CPUID is an invalid opcode on early machines. Dettman & Wyatt "DOS Programmer's Reference" is a good source on identifying cpu's, copros, and video capacity on the earlier machines. (Edit) Oops, that should be "Dettmann" This message was edited by Larry Hammick, on 6/4/2001 2:11:23 PM