[comp.sys.m68k] 68000 <-> 68881 rutines

jgabriel@mtecv2.mty.itesm.mx (Juan Gabriel Ruiz Pinto) (03/26/90)

    Hi,

      I'm trying to install a FPCP (Floating Point Co-processor) 68881 card
   to a 68000 based kit. I made the card, but when I read the 68881 manual
   I saw that I need some special protocol to comunicate the 68000 with
   the co-processor.

      I don't understand so very well that mechanism, the manual talks
   about a trap routine that hands the protocol.

      I have some MACROS to do some operations, but I think that this is
   no so very efficient, because I have the protocol included in all the
   MACROS.

      Can anybody help me with that? I'm looking for the trap routine,
   is there some public domain routines to use the co-processor? Can
   anybody explain me the mechanism of the trap routine?

      Suggestions are welcome!

      Thank's in advance!


   
--
*****   Greetings from Mexico !!   *****
Juan Gabriel Ruiz Pinto                Internet:                    
Ing. Sistemas Electronicos             jgabriel@mtecv2.mty.itesm.mx 
I.T.E.S.M. Campus Monterrey                        

tomj@oakhill.UUCP (Tom Johnson) (03/26/90)

In article <JGABRIEL.90Mar25153604@mtecv2.mty.itesm.mx> jgabriel@mtecv2.mty.itesm.mx (Juan Gabriel Ruiz Pinto) writes:
>
>      Can anybody help me with that? I'm looking for the trap routine,
>   is there some public domain routines to use the co-processor? Can
>   anybody explain me the mechanism of the trap routine?
>
>--
>Juan Gabriel Ruiz Pinto                Internet:                    
>Ing. Sistemas Electronicos             jgabriel@mtecv2.mty.itesm.mx 
>I.T.E.S.M. Campus Monterrey                        

Check out the January 23rd, 1986 issue of EDN magazine.  In this issue is
an article:  "Software Links Math Chip to 68000-family uPs", written by
myself and Sarah Harris.  It explains the coprocessor interface protocol
relatively well, and also gives the source for sample assembly language
macros AND sample trap handlers.  Note that trap handlers are usually some-
what more difficult to write since it is more difficult to handle a general
case of addressing modes.

Tom Johnson	(tomj@oakhill.UUCP)
Motorola, Inc.
Austin, TX

Disclaimer:  <insert standard disclaimer here>

mollers.pad@nixpbe.uucp (Moellers) (03/27/90)

jgabriel@mtecv2.mty.itesm.mx (Juan Gabriel Ruiz Pinto) writes:


>    Hi,

>      I'm trying to install a FPCP (Floating Point Co-processor) 68881 card
>   to a 68000 based kit. I made the card, but when I read the 68881 manual
>   I saw that I need some special protocol to comunicate the 68000 with
>   the co-processor.

>      I don't understand so very well that mechanism, the manual talks
>   about a trap routine that hands the protocol.

>      I have some MACROS to do some operations, but I think that this is
>   no so very efficient, because I have the protocol included in all the
>   MACROS.

>      Can anybody help me with that? I'm looking for the trap routine,
>   is there some public domain routines to use the co-processor? Can
>   anybody explain me the mechanism of the trap routine?

Actually, the '881 interfaces directly to the '020 who, in turn, uses a
special protocol to communicate with the '881.
The protocol uses special function codes (referring to "CPU space")
and addresses to address the '881.
If You want to attach the '881 to a '000 or '010, You'll have to
simulate an '020.

The '020 has instructions with most significant nibble F(hex), so-called
Line-F-instructions.
These have the following format:
	1111 ccct ttxx xxxx
ccc = Co-Processor ID (001 == '881)
ttt = Instruction Type (000 = General, 001 = Conditionals, etc)
xxxxxx = Type dependent (eff. address, Register, Mode, etc)
(Refer to the '881 manual for the exact instruction encodings)

When a 68000 or an '010 executes an F-line-instruction, it gets an
"Line-F Exception". The Trap Handler (in supervisor mode) must decode
this instruction and then emulate an '020 to program the '881.

There are 11 Registers in the '881 which You'll have to take care of
(Control, Response, Save, Restore, Operation, Command, Condition,
Operand, Register Select, Instruction Address and Operand Address)
Not all will be of importance, though. Again, please refer to the '881's
manual.
The nice thing about Motorola's Coprocessor Interface is that the actual
communication is more or less controlled by the Coprocessor: it knows
exactly when to expect what kind of information rather than the CPU
telling the CP what it will need. So You'll spend most of the time
waiting for the '881 to ask for data.
Beware: the '881 operates asynchronously with the CPU. which means that
it can (sort-of) detach from the CPU without really being done (e.g.
when You ask it to calculate a sine from a register into a register).

Hope this helps


| Josef Moellers		|	c/o Nixdorf Computer AG	|
|  USA: mollers.pad@nixbur.uucp	|	Abt. PXD-S21		|
| !USA: mollers.pad@nixbur.uucp	|	Pontanusstr		|
| Phone: (+49) 5251 146245	|	D-4790 Paderborn	|