[net.micro.pc] 8087 opcodes needed

mnl@cernvax.UUCP (mnl) (04/03/86)

subject: 8087 opcodes needed
Newsgroups: net.micro.pc

I'm trying to write a pair of routines to convert 64-bit floating
point (which is what our Modula-2 compiler uses) to and from 32-bit
floating point.  Unfortunately, I can't seem to find any list of
8087 opcodes, and Masm doesn't seem to know about the 8087. What I
need are the opcodes for:

	FLD     ;32-bit and 64-bit, i.e. DWORD and QWORD
	FSTP    ;       as above

Thanks in advance
-- 
mnl@cernvax.bitnet or ...!seismo!mcvax!cernvax!mnl
"This function is occasionally useful as the arguement to a function
which requires a function as an arguement."  Guy Steele, Jr.

apn@gilbbs.UUCP (Alex Novikis) (04/07/86)

In article <292@cernvax.UUCP>, mnl@cernvax.UUCP (mnl) writes:
> subject: 8087 opcodes needed
> Newsgroups: net.micro.pc
> 
> I'm trying to write a pair of routines to convert 64-bit floating
> point (which is what our Modula-2 compiler uses) to and from 32-bit
> floating point.  Unfortunately, I can't seem to find any list of
> 8087 opcodes, and Masm doesn't seem to know about the 8087. What I
> need are the opcodes for:
> 
> 	FLD     ;32-bit and 64-bit, i.e. DWORD and QWORD
> 	FSTP    ;       as above
> 
> Thanks in advance
> -- 
> mnl@cernvax.bitnet or ...!seismo!mcvax!cernvax!mnl
> "This function is occasionally useful as the arguement to a function
> which requires a function as an arguement."  Guy Steele, Jr.


    Here are the macros for FLD and FSTP...


codemacro       FLD     src:Mb
        segfix  src
        db      0d9h
        modrm   0,src
endm

codemacro       FLD     src:Mw
        segfix  src
        db      0ddh
        modrm   0,src
endm

codemacro       FLD     src:Db(0,7)
        db      0d9h
        dbit    5(18h),3(src(0))
endm

codemacro       FSTP    dst:Mb
        segfix  dst
        db      0d9h
        modrm   3,dst
endm

codemacro       FSTP    dst:Mw
        segfix  dst
        db      0ddh
        modrm   3,dst
endm

codemacro       FSTP    dst:Db(0,7)
        db      0ddh
        dbit    5(1bh),3(dst(0))
endm




---------------------------------------------------------------


Hope these may be of some use..,


-- 
==============================================

    Alex Paul Novickis		(707) 575 8672
    Fulcrum Computers, Inc.	1635 Ditty Ave. Santa Rosa, CA 95401-2636

    {ihnp4, dual}!ptsfa!gilbbs!apn

"Almost doesn't count...      but it almost does"

DISCLAIMER:  The opinions contained herein may not be of anyone that I know.

kent@uokvax.UUCP (04/09/86)

	I have Microsoft Macro Assembler v4.0 and it came with a
	small Intel handbook that has all the codes for the 8088/86/286
	and all the 8087/287 in it. If this was not included with 
	your assembler then I am sure that you could get a copy through
	Intel (since this handbook was printed by them).
	I hope this helps you.
					Kent Malave'
					uokvax!kent
					

herman@ti-csl (04/11/86)

Have you tried using the .8087 pseudo-op to tell Masm that you're
using 8087 opcodes?  Effective Masm 2.x, the assembler no longer
automatically recognizes 8087 opcodes.  The following should work

	.8087
	FLD	DWORD PTR [SI]

Information about the 8087 opcodes themselves can be found in the
Intel documentation.  For integer versions of 8087 commands, Microsoft
has added an "I" version of some commands, i.e. to store and pop a
result in 32-bit integer format, use the instruction

	FISTP	<dword destination>

Also, Masm will automatically add FWAIT instructions to
8087 commands, i.e. FINIT will assemble into 9B DB E3.  To use
the "no-wait" form, use FNINIT, which assembles into DB E3.

	-- Herman