English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 09 April 2016, 08:16   #1
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
68040 emulation using a 68020

Hi,

I have some 68040 code that I want to emulate using Musashi, and there are a lot of 040 specific / FPU instructions in it.

I don't really care about speed, I can use a fast machine to run it, so I was wondering if some native 68020 code existed to emulate those FPU/040 instructions, maybe possibly an amiga program, and even better, some source.

I guess the code would install itself on the ILLEGAL instruction vector (like MOVEP handler does on 68060 library) to manually decode 040 instructions and do something similar, slowly, but would work.

I liked the musashi design. Simple to understand and documented for integration in another project, but if you know of a 68040/FPU emu that can be adapted to a project, even better (not WinUAE which is very good but emulation core is not designed to be re-used but maybe I'm mistaken...)


thx
jotd is offline  
Old 09 April 2016, 13:09   #2
chb
Registered User
 
Join Date: Dec 2014
Location: germany
Posts: 446
Hi,

there was Pseud040 for the Macintosh, which did exactly what you want, but (to my knowledge) the source was never released. Maybe you could contact the author and try to convince him to release the source?
chb is offline  
Old 09 April 2016, 13:58   #3
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,375
Quote:
Originally Posted by jotd View Post
I guess the code would install itself on the ILLEGAL instruction vector (like MOVEP handler does on 68060 library) to manually decode 040 instructions and do something similar, slowly, but would work.
68060 library doesn't use ILLEGAL vector to handle MOVEP and friends
(there is a specific emu vector for this)

Aside of the FPU there isn't much 040 specific stuff (move16, cpush, cinv).
AFAIK everything 040-only goes to line-F, fpu or not.
I guess i could do the non-fpu stuff quite easily if i knew exactly what to do.

I remember having tried an FPU emulator for Mac under Shapeshifter but i couldn't make it work (at least not for Amiga apps).
No source for it of course.

I may be interested in fpu emulation as well, but so far all my researching on the matter remained fruitless.
meynaf is offline  
Old 09 April 2016, 15:53   #4
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
you're right, it would be exactly what I need. I could also use some native C source too. I'm not making it run on a real 68020. If FPU 040 instructions were emulated by C code it would be just fine!
jotd is offline  
Old 09 April 2016, 16:09   #5
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,909
perhaps? http://aranym.sourceforge.net/
pandy71 is offline  
Old 11 April 2016, 23:32   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
Maybe. Basilik looks better to me. I think the author wrote Shapeshifter at the time, and he explains how his emulator works in a nice document. I think I'll settle for that. Thanks.

BTW I found this opcode: 50fa 00a2 => traptw #162
(HRTMon sees TRAPT.W)

Never heard about this trap instruction. I only knew TRAP, TRAPcc, did not find it in the ref manuals... anyone?
jotd is offline  
Old 12 April 2016, 00:43   #7
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
It's just TRAPcc with a condition of True.
Leffmann is offline  
Old 12 April 2016, 01:10   #8
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by jotd View Post
BTW I found this opcode: 50fa 00a2 => traptw #162
(HRTMon sees TRAPT.W)

Never heard about this trap instruction. I only knew TRAP, TRAPcc, did not find it in the ref manuals... anyone?
It looks to me like a TRAPcc.W with cc=True. ADIS, D68k and IRA all decode it as "TRAPT #$a2" for 68020. The 68000PRM encoding documentation is incorrect for TRAPcc which may have resulted in your confusion. There are several incorrect encodings documented in the 68000PRM but most are FPU instruction encodings.

Last edited by matthey; 12 April 2016 at 01:11. Reason: Leffmann was quicker ;).
matthey is offline  
Old 13 April 2016, 00:56   #9
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by jotd View Post
Hi,

I have some 68040 code that I want to emulate using Musashi, and there are a lot of 040 specific / FPU instructions in it.
Did you get the DLL for Musashi to work that I attached in the other thread? If it didn't work then you must probably build it yourself on the computer you intend to use it on, but I can write it all up if you don't mind installing Visual C++ and a bunch of other tools.
Leffmann is offline  
Old 13 April 2016, 21:19   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
Thanks leffman but musashi wont do me any good for this coee which heavily uses 68040 fpu. The most affordable seems to be Basilik, and there is even some documentation on how to use uae cpu core.
jotd is offline  
Old 19 April 2016, 16:18   #11
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
Hi,

I butchered Basilik sources and got a bare 040+FPU emulation (not tested yet, but will do)

I have one question: when CPU encounters a TRAPTW (or TRAPEQW, or any W-type TRAP) what vector is called? (not the conventional $80->$BC TRAP vectors for sure)

thanks
jotd is offline  
Old 19 April 2016, 16:30   #12
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
It should be vector 7.
Leffmann is offline  
Old 19 April 2016, 19:40   #13
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,410
it is!! VBR+$1C is the offset. Thanks.

So how to make the difference between, say TRAPV and TRAPT.W ? Do I have to read the stack and check for the instruction that triggered the trap?
There should be some info better than that in the stackframe right?
jotd is offline  
Old 20 April 2016, 08:38   #14
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,375
Quote:
Originally Posted by jotd View Post
There should be some info better than that in the stackframe right?
There is AFAIK no difference. TRAPV is just a special case of TRAPcc, this means TRAPV and TRAPVS are exactly the same. TRAPV is still there for 68000 compatibility.
meynaf is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
UAE4All 68020-emulation fix john4p support.OtherUAE 16 17 January 2014 08:18
68020 33 MHz Leandro Jardim support.WinUAE 2 02 January 2012 19:21
Questions about 68020 CE Maren support.WinUAE 11 09 December 2009 21:01
68020 and cycle-exact FOL support.WinUAE 4 23 July 2007 22:10
Barfly misidentifies 68020 under emulation DJ Mike support.WinUAE 10 02 March 2007 06:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:12.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10077 seconds with 13 queries