[comp.sys.m68k] Need help with 68881

jonasf@kuling.UUCP (Jonas Flygare) (08/16/89)

I am writing some programs using the 68881, and have a small problem..
I have tried to get documentation on the 68881, and so far the best one
is the technical summary BRE265R3. On the front page it states that
the FPU have 22 constants available in the on-chip ROM.
"How nice I thought, _just_ what I need.." However, I cannot find any 
reference to HOW I access those available constants.. ;-)
Anyone know how? Also, pointers to better documents describing the FPU 
would be appreciated. email preferred.

Thanks in advance.-- 
Jonas Flygare (aka Flax)        |If God had wanted me to have opinions he 
email: jonasf@kuling.UUCP       |would have given me UseNet access..
real:  Vaktargatan 32 F:621     |
       S-754 22 Uppsala Sweden  |


schmitz@fas.ri.cmu.edu (Donald Schmitz) (08/18/89)

In article <1135@kuling.UUCP> jonasf@kuling.UUCP (Jonas Flygare) writes:
>I am writing some programs using the 68881, and have a small problem..
>I have tried to get documentation on the 68881, and so far the best one
>is the technical summary BRE265R3. On the front page it states that
>the FPU have 22 constants available in the on-chip ROM.
>"How nice I thought, _just_ what I need.." However, I cannot find any 
>reference to HOW I access those available constants.. ;-)

There is an entire user's manual available from Motorola, the only
publication information on mine is MC68881UM/AD, "MC68881 Floating-Point
Coprocessor User's Manual".  There is a newer edition that covers both the
'881 and '882.  If you have a choice, get the 2nd generation '882.  It is
software compatible, usually 2x as fast on C code, about the same price,
but generates more state on an fsave, so it may break some OS context switch
software.  To get the constants, you need the fmovecr instruction, the
syntax is:

	fmovecr	#N,fpN

Where #N is the constant to look up, and fpN is the floating point register
to put it in.  #0 is pi, #11 is log(2), #12 is e, #13 is log2(e), #14 is
log(e), #15 is 0, #48 is ln(2), #49 is ln(10), and the rest are 10 raised to
assorted binary powers. Also, there are lots more entries in the table than
22, but they are used by the microcode and probably aren't useful to user
code or maybe even consistent between chip revisions.

Don

low@melair.UUCP (Rick Low) (08/19/89)

In article <1135@kuling.UUCP>, jonasf@kuling.UUCP (Jonas Flygare) writes:
> I am writing some programs using the 68881, and have a small problem..
> I have tried to get documentation on the 68881, and so far the best one
> is the technical summary BRE265R3.

Try to get
	MC68881/MC68882 Floating-Point Coprocessor User's Manual,
	Englewood Cliffs, NJ, USA 07632, Prentice Hall Inc., 1987.
	ISBN 0-13-566936-7
I got mine from the local Motorola office.

> On the front page it states that
> the FPU have 22 constants available in the on-chip ROM.
> "How nice I thought, _just_ what I need.." However, I cannot find any 
> reference to HOW I access those available constants.. ;-)
> Anyone know how? Also, pointers to better documents describing the FPU 
> would be appreciated. email preferred.

The FMOVECR instruction (Move Constant ROM) can load the following
constants from 68881 ROM into a coprocessor register:

	pi
	log10(2)
	e
	log2(e)
	log10(e)
	0.0
	ln(2)
	ln(10)
	10^n, n=0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096

That makes 22 constants.

> Thanks in advance.-- 
> Jonas Flygare (aka Flax)        |If God had wanted me to have opinions he 
> email: jonasf@kuling.UUCP       |would have given me UseNet access..
> real:  Vaktargatan 32 F:621     |
>        S-754 22 Uppsala Sweden  |

Rick Low
MEL Defence Systems Limited, Ottawa, Canada
+1 613 836 6860
mitel!melair!low@uunet.UU.NET
-- 
Rick Low
MEL Defence Systems Limited, Ottawa, Canada
+1 613 836 6860
mitel!melair!low@uunet.UU.NET