FPU emulator

All about the serious stuff.

Moderators: Mug UK, Zorro 2, Moderator Team

Post Reply
User avatar
Arne
Atari Super Hero
Atari Super Hero
Posts: 746
Joined: Thu Nov 01, 2007 10:01 am

FPU emulator

Post by Arne »

Lately I stumbled across an old article in the c't magazine (04/1990) about a FPU emulator.
Now you may know that there exist two different ways of attaching a 68881/882 FPU to a ST/STE.
  • use a 68020/030 (like PAK68/2, /3) with FPU socket and just put a 68881/882 in
  • use a SFP004 on the MegaBus, MegaSTE internal FPU socket, or some other extension that attaches the FPU in the same way as Atari's own SFP004
So why two ways?
The 68020/030 know so-called Line-F instructions. They decode these and immediately know that these are meant to be handled by a FPU. Via a specific protocol the FPU catches these instructions, and calculates the result. It's done that way in TT and Falcon030.
But 68000 cannot handle Line-F instructions. Atari decided to attach the FPU to the system like any other I/O device: memory mapped i.e. the FPU occupies some registers in the CPU's memory space.

Those who program in Turbo C/Pure C know about the compiler's ability to create 68881/882 code. But this code uses LineF instructions and therefore is not compatible with the SFP004 solution.
And code written for the SFP004 is not compatible with the LineF solution.
The aforementioned FPU emulator catches LineF instructions (read: programs with FPU code written for TT, Falcon030,...) on a 68000 ST/STE, decodes the instructions and pokes the values into the appropriate registers of a SFP004 (compatible) extension.
The other way (using SFP004 programs on a TT) is not possible with this emulator.

I cannot check the emulator as it says in the ASM comments that it is only for 68881 FPUs as 68882 need passing of the PC at some locations.
Unfortunately I only have 68882 at hand :-(

So: maybe someone can check the attached FPU emulator (on a 68881) equipped MegaSTE or some 68000 speeder with 68881.
FPU.zip
You do not have the required permissions to view the files attached to this post.
Image
mikro
Hardware Guru
Hardware Guru
Posts: 2378
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: FPU emulator

Post by mikro »

Is that really true about 68882? I thought it's 100% software compatible, it has only a different stack frame size or so.

Btw I find usefullness of this program very questionable, any FPU application for TT/Falcon would most likely use 030 code as well, therefore unable to run it on memory-mapped FPU in a ST/STE.
czietz
Hardware Guru
Hardware Guru
Posts: 1539
Joined: Tue May 24, 2016 6:47 pm

Re: FPU emulator

Post by czietz »

mikro wrote: Wed May 19, 2021 3:19 pm Is that really true about 68882? I thought it's 100% software compatible, it has only a different stack frame size or so.
It is true. When they say SW-compatible, they mean w.r.t. to the FPU instructions. However, with the 68000 / SFP-004 you have to emulate the coprocessor HW-interface between 68020/68030 and FPU in software. The data exchanged over this interface differs in some details. Of course, the FPU emulator could be made compatible to 68882, too, by emulating the parts of the interface only required by the 68882 (but not the 68881). But the author did not bother with that.

Sidenote: I've written a few pages about SW-emulation of that interface: https://www.chzsoft.de/site/site/assets ... sfp_en.pdf. But the document doesn't cover the differences between 68881 and 68882, either.
mikro wrote: Wed May 19, 2021 3:19 pm Btw I find usefullness of this program very questionable, any FPU application for TT/Falcon would most likely use 030 code as well, therefore unable to run it on memory-mapped FPU in a ST/STE.
I agree.
czietz
Hardware Guru
Hardware Guru
Posts: 1539
Joined: Tue May 24, 2016 6:47 pm

Re: FPU emulator

Post by czietz »

If you look into my document (see previous post), you'll see that the response primitive sent by the FPU has a bit called "PC". Probably the incompatibility that Arne mentions is caused by the FPU emulator not handling this bit, which has different effects on a 68881 and a 68882:
68881-vs-68882.png
You do not have the required permissions to view the files attached to this post.
seedy1812
Atari freak
Atari freak
Posts: 68
Joined: Tue May 18, 2010 2:04 pm

Re: FPU emulator

Post by seedy1812 »

If you look at the page 7-10 just above what you showed is figure 7.7 M68000 Coprocessor response Primitive General Format where bit 14 is labeled PC which is described.

Where you image starts "Bit [14]" is the description of the PC bit
ThorstenOtto
Atari God
Atari God
Posts: 1521
Joined: Sun Aug 03, 2014 5:54 pm

Re: FPU emulator

Post by ThorstenOtto »

I wonder whether the SFP004 really needs a valid address. Of course you may have to transfer one to prevent it of generating a protocol violation, but since that memory-mapped interface cannot access the RAM, i would think the value of that address does not matter. Maybe a look at the source of PML (which implemented some functions for the SFP004), or a dissassembly of the PCFLTLIB may help.
Rustynutt
Atari God
Atari God
Posts: 1280
Joined: Wed Mar 21, 2012 7:38 am
Location: Oregon

Re: FPU emulator

Post by Rustynutt »

Just sharing an experience. Installed the GAL (and mod) required for FPU in an MSTE with 68882 and didn't have luck using programs that could utilize it.
Only thing I could come up with, was whatever it was (long forgotten) I used to test it with couldn't utilize it. Didn't have an 881 to try. ExtenDos exinfo did I fact report an 882 installed. Brad told me when I purchased the GAL, good luck.
DarkLord has that machine, maybe he has some feed back.
Not really on topic, as usual :)
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Huh. Don't think I've run any benchmarking software on it.

I'll try Gembench later - it should report something.

I do know that when I put a 68882 in my Pak 68/3 equipped STacy that
I was told by several people that I should go with the 68881 because of
software...so maybe there is something to it?
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Okay, ran both Gembench and SysInfo.

Both report -no- FPU on this Mega STe...

Maybe it was a different machine?
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
mikro
Hardware Guru
Hardware Guru
Posts: 2378
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: FPU emulator

Post by mikro »

Christian - thank you for such a great explanation, much appreciated.

I actually do have a Mega STE + 68881 (as well as Mega STE + 68882) so I'll give it a try in near future but most likely I will have to recompile some open source application, perhaps some benchmark to make it interesting.
Rustynutt
Atari God
Atari God
Posts: 1280
Joined: Wed Mar 21, 2012 7:38 am
Location: Oregon

Re: FPU emulator

Post by Rustynutt »

DarkLord wrote: Thu May 20, 2021 4:35 am Okay, ran both Gembench and SysInfo.

Both report -no- FPU on this Mega STe...

Maybe it was a different machine?
It was the stand alone motherboard you bought from eBay about 6 years ago.
It has an 882 and FPU GAL installed.
Could be wrong about sysinfo report. It's been a while :)
czietz
Hardware Guru
Hardware Guru
Posts: 1539
Joined: Tue May 24, 2016 6:47 pm

Re: FPU emulator

Post by czietz »

One program that does work with the FPU redirector/emulator posted by Arne (even if the FPU is a 68882, BTW), is dml's excellent FPU tester: https://www.atari-forum.com/viewtopic.p ... 85#p410785. This is nice if you suspect to have a faulty/fake FPU in your SFP-004 or MegaSTE.
ThorstenOtto
Atari God
Atari God
Posts: 1521
Joined: Sun Aug 03, 2014 5:54 pm

Re: FPU emulator

Post by ThorstenOtto »

Interesting. Does that tester maybe catch the protocol violation exceptions?
czietz
Hardware Guru
Hardware Guru
Posts: 1539
Joined: Tue May 24, 2016 6:47 pm

Re: FPU emulator

Post by czietz »

ThorstenOtto wrote: Sat May 22, 2021 3:58 pm Interesting. Does that tester maybe catch the protocol violation exceptions?
I assume they just don't happen during the test. But I didn't test that theory.
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Guys, I'm wondering about something.../

https://www.atari-forum.com/viewtopic.p ... st#p304768

DML's first line says it's for TT's and Falcon's...or am I reading that wrong.

FPUTEST fails horribly with the 68882 in my Pak 68/3 board and crashes out (6-7 bombs) on
my 68881 equipped Mega STe... The 68881 in the Mega STe is brand new, just got it from Best
Electronics, along with the GAL.

Thanks.
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
czietz
Hardware Guru
Hardware Guru
Posts: 1539
Joined: Tue May 24, 2016 6:47 pm

Re: FPU emulator

Post by czietz »

DarkLord wrote: Tue Jun 01, 2021 12:18 am Guys, I'm wondering about something.../

https://www.atari-forum.com/viewtopic.p ... st#p304768

DML's first line says it's for TT's and Falcon's...or am I reading that wrong.
This is why you need the FPU emulator/redirector that is the main subject of this thread on a MegaSTe. Like I said: With that, I was able to run the test (all passing, of course) on my MegaSTe. Without it, the test does indeed crash, with a Line-F exception. The PAK 68/3, on the other hand, is compatible to the TT and Falcon when it comes to the FPU.
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Okay, gotcha.

I downloaded the file in the first post and will try it out later on my
Mega STe with the 68881.

What I take away from this is that it's compatible with the Pak but
most likely is accurately finding a faulty 68882 there.

Thanks.

PS I didn't see any text in the zip file - do you just run this program
from the desktop? Or maybe put it in the AUTO folder? Thanks!
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Okay, I ran the emulator then ran FPUTEST on my Mega STe with the 68881.

Everything passed with flying colors.

So I guess I do have a bad 68882 in my Pak equipped STacy.

Bummer... :(
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
Rustynutt
Atari God
Atari God
Posts: 1280
Joined: Wed Mar 21, 2012 7:38 am
Location: Oregon

Re: FPU emulator

Post by Rustynutt »

DarkLord wrote: Tue Jun 01, 2021 5:28 pm Okay, I ran the emulator then ran FPUTEST on my Mega STe with the 68881.

Everything passed with flying colors.

So I guess I do have a bad 68882 in my Pak equipped STacy.

Bummer... :(
Imagine that's like digging for diamonds as deep as it must be buried in that machine!
User avatar
DarkLord
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4717
Joined: Mon Aug 16, 2004 12:06 pm
Location: Prestonsburg, KY - USA
Contact:

Re: FPU emulator

Post by DarkLord »

Rustynutt wrote: Tue Jun 01, 2021 6:49 pm Imagine that's like digging for diamonds as deep as it must be buried in that machine!
You ain't wrong... :)
Welcome To DarkForce! http://www.darkforce.org "The Fuji Lives.!"
Atari SW/HW based BBS - Telnet:darkforce-bbs.dyndns.org 520
Post Reply

Return to “Applications”