[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] FPU question



On Wed, 3 Feb 1999 21:28:09 +0100 (EET), Konrad Kokoszkiewicz wrote:
 
> I have a question regarding memory mapped FPU's in 68000 machines (e.g.
> MegaSTE): how does the _FPU cookie look like on such a machine?

I'm not 100% sure about this, but I believe that the cookie doesn't
indicate the FPU-interface. However, it's rather easy to figure it out:

1. If CPU == 68000 and FPU is present, then the FPU is memory mapped.
2. If CPU >= 68020 and FPU is present, then the FPU is a coprocessor.

(1) is 100% accurate (if you trust the cookie that is), I'm not sure
about (2). Is the memory-mapped FPU still usable on 68000-machines with
a 020 or 030 accelerator?

However, you can detect the type of FPU with the following piece of
code (stolen from the Atari Compendium):

/* Number of iterations before an error is triggered */
#define FPCOUNT     0x80

#define FPCIR           ((WORD *)(0xFFFFFA40L))

WORD fpcount;

/* fperr() is user-defined */

#define FPwait() {  fpcount = FPCOUNT; \
                    while((*FPCIR & 0xBFFF) != 0x0802) \
                        if(!(--fpcount)) fperr();}

This checks the memory-mapped FPU's status-register a number of time,
if this test fails then the FPU is either malfunctioning or not
memory-mapped.

Please note that I don't have any machines with a memory-mapped FPU so
I can't verify that this code works.

> 3) But 68000 has no coprocessor mode, thus a memory mapped FPU has to be
>    handled via Line-F handler (correct me if I am wrong).

I'm no expert in this area (either), but it appears that the FPU is handled
by reading/writing to a set of memory-mapped FPU-registers and waiting for
the result using busy-waiting.

The 020 (and upwards) does use Line F to handle unknown FPU-instructions
though, this is how the 68882-emulator for the 040 and 060 works.

> 4) However, MiNT itself does not install Line-F FPU emulation, and
>    to my knowledge, doesn't pass Line-F exceptions to the TOS.

This might be the case, since the 68882-emulator I use on my Afterburner
must be started after MiNT in order to work.


/*
** Jo Even Skarstein    http://www.stud.ntnu.no/~josk/
**
**    beer - maria mckee - atari falcon - babylon 5
*/