English Amiga Board


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

 
 
Thread Tools
Old 29 November 2015, 12:14   #1
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
Best 68040 emulator

Hi,

I've got a long shot project planned. My requirements:

- I want to run some 68040 code on a windows machine
- I don't care for any custom stuff (blitter, copper...), it's not amiga code
- The emulation solution must be open-source
- I must be able to install some "hooks" on traps/illegal/PC=such or such address to call "native" windows functions

Any serious candidate?

thanks
jotd is offline  
Old 29 November 2015, 13:56   #2
Locutus
Registered User

 
Join Date: Jul 2014
Location: Finland
Posts: 969
there is QEMU 68k support nowadays, it wont do calling to windows stuff out of the box but its opensource and the closest to your feature request box you are going to find.

Check:

https://github.com/vivier/qemu-m68k

and https://wiki.debian.org/M68k/sbuildQEMU

I cant tell you exactly how accurate it is yet, but ive not run into any problems with gcc compiled code (including recompiling gcc itself).

Also, its quite a bit faster then WinUAE/Aranym :-)
Locutus is offline  
Old 29 November 2015, 14:52   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 44
Posts: 23,359
Does "68040" mean = "68020 + added 68040 instructions" or full 68040 including MMU and FPU and all?

UAE (or QEMU) probably is far too complex if simple 68020 (+some extra instructions) is all you need.
Toni Wilen is offline  
Old 29 November 2015, 15:52   #4
Locutus
Registered User

 
Join Date: Jul 2014
Location: Finland
Posts: 969
QEMU has a Usermode target for that though, which greatly cuts down on complexity. I'm not sure what other 68k emulator you would use otherwise.
Locutus is offline  
Old 29 November 2015, 17:08   #5
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
Qemu is the one! I ll probably need fpu. Thanks guys!

Edit: QEMU usermode sounds interesting but it needs linux...

Well if address spaces are compatible, I'd like to try playing with WinUAE:

- boot without startup sequence with a lot of memory i.e. the widest addressing space possible
- load the chunk in memory with allocabs() if possible or a memcpy (with a resident program like whdload in case the memory zone destroys the OS)
- zero VBR, SR... and start the proggy

The part I'm puzzled about is how to plug some "native" events: ex: I reach a given PC or zone: winuae calls some of my code/scripts (like python, C??). That would allow me to connect my program to the outside world (windows)
I'm sure it is possible with WinUAE right?

Last edited by jotd; 01 December 2015 at 00:15.
jotd is offline  
Old 23 December 2015, 11:21   #6
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 46
Posts: 3,620
Quote:
Originally Posted by jotd View Post
Edit: QEMU usermode sounds interesting but it needs linux...
I'd like to play with some cpu emulation as well, like trying to add new instructions in the cpu, and call some kind of "native" features.
It seems QEMU won't do it with a windows compiler...


Quote:
Originally Posted by jotd View Post
Well if address spaces are compatible, I'd like to try playing with WinUAE:

- boot without startup sequence with a lot of memory i.e. the widest addressing space possible
Just configure the mem in winuae's settings and you're done.
You can get 1.5GB of Z3 fastmem

However you won't have a direct access to the host's address space.


Quote:
Originally Posted by jotd View Post
- load the chunk in memory with allocabs() if possible or a memcpy (with a resident program like whdload in case the memory zone destroys the OS)
- zero VBR, SR... and start the proggy
If you don't need any OS on the Amiga side, perhaps you can just replace the Amiga ROM by other code.


Quote:
Originally Posted by jotd View Post
The part I'm puzzled about is how to plug some "native" events: ex: I reach a given PC or zone: winuae calls some of my code/scripts (like python, C??). That would allow me to connect my program to the outside world (windows)
I'm sure it is possible with WinUAE right?
From what i've read WinUae has the ability to call native x86 code.
But i don't know how to do that.

Hacking winuae is possible as well, because sources are available... even though it's far from being easy.
meynaf is offline  
Old 25 December 2015, 00:22   #7
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,781
Where relevant:

I optimize for the worst case (68000) and use 68020+ instructions only when needed for performance on 68020+, but I can see that fallback compatibility is more important to me and I'm a bit extreme in the way that I only really care about 68000 and 68060.

But it's good advice to avoid if you can instructions removed in the 68060 (which IMO is even better designed than the very nice 68040!), and also to not rely on Copyback Cache features. While both these helped with performance, they're also the reason for software requiring patches. If a CPU emulator or compiler has a 68060 mode (is there one??), do use it and it might warn you so you can avoid it.
Photon is offline  
Old 19 November 2019, 11:07   #8
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
reviving an old thread.

I've finally use Basilisk (using winuae core) but now we're stuck because it's GPL so we cannot use it in our commercial product (yes, I'm working on a 680x0 related thing at my job )

I've checked musashi which is completely non GPL but also completely 68020 max

Any other ideas?
jotd is offline  
Old 19 November 2019, 13:00   #9
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 37
Posts: 3,406
Quote:
Originally Posted by jotd View Post
I've checked musashi which is completely non GPL but also completely 68020 max
Quote:
Originally Posted by https://github.com/kstenerud/Musashi
Musashi is a Motorola 68000, 68010, 68EC020, 68020 and 68040 emulator written in C. This emulator was written with two goals in mind: portability and speed.
But I see what you mean, 68040 can not be selected.
Hewitson is offline  
Old 19 November 2019, 13:00   #10
Cyprian
Registered User

 
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 36
what about ARAnyM https://aranym.github.io/
It offers emulation - CPU: 68040 with MMU and FPU 68882

Last edited by Cyprian; 19 November 2019 at 13:00. Reason: ARAnyM
Cyprian is offline  
Old 19 November 2019, 14:33   #11
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 611
Quote:
Originally Posted by Cyprian View Post
what about ARAnyM https://aranym.github.io/
It offers emulation - CPU: 68040 with MMU and FPU 68882
It's also GPL, so that's a no-go
britelite is offline  
Old 19 November 2019, 14:45   #12
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
I don't need MMU. 'Just' the 040 instructions and FPU. Adding 040 support to Musashi would be the best option.

And if there's a non-GPL 680x0-binary software which is able to emulate 040 instructions by software on a 68020 that could work too. Speed isn't too much of an issue, we can use fast machines to emulate that, we're a company
jotd is offline  
Old 19 November 2019, 22:07   #13
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 44
Posts: 23,359
If not including MMU, 68040 in instruction level has very few new instructions: MOVE16 and cache instructions (CINVx, CPUSHx). CACR bits have changed. Cache instruction can be ignored unless you need to run some kind of OS or program that uses CACR bits to detect CPU model.

FPU is also almost same except D and S (FDADD, FSADD etc) instruction variants are new and not supported by 68881/68882. (But 6888x emulation may still support them)

Both should be relatively easy to implement in existing 68020/030 + 6888x emulation.
Toni Wilen is offline  
Old 19 November 2019, 22:49   #14
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
Thanks Toni. I don't need cache instructions either or CACR. Actually I'm emulating an application. It's running in supervisor mode (I know it sucks!) but not as an operating system (it handles some traps, peeks into the VBR to get some OS vector (dirty, I have stubbed that), so it seems that I can start from musashi 020. At least 95% of the instructions are correct. And the ones that aren't, I can compare in/out with UAE core.

Actually it's the fact that I have plugged one of our proprietary OS (simulated) that renders the whole GPL thing impossible since I'm not allowed to disclose the source for the simulated proprietary OS. Joys of open source.

Now I have to provide an estimate and I'll have to code that IN MY OFFICE TIME oh dear… At least we won't be needing to provide the source of the thing. I'm regaining hope, and the project managers will be pleased because they don't like GPL too much.
jotd is offline  
Old 20 November 2019, 11:35   #15
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,001
Can't you package the emulator and the proprietary OS separately to get around the GPL thing? I mean, if you only need minor mods on the emulator (which hardly would be worth protecting as your IP if they're just a few 68040 add-ons), then implement those and contribute them back to the community...
hooverphonique is offline  
Old 20 November 2019, 19:59   #16
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,304
> if you only need minor mods on the emulator

that's not minor mods. that's plugging the emulator on our custom OS API & removing everything but the CPU emulation We had a talk with legal dep and we can't. And I can't disagree with that.

Of course I didn't mind provide the source of the modified thing, but that's not enough.
jotd 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
T-zer0 and 68040 PopoCop support.Games 0 06 July 2013 16:08
68040 vs 68060 tesla support.Hardware 10 20 April 2013 20:13
68040/60 speed Seiya support.WinUAE 2 19 January 2010 11:28
Replace 68040 cybernoid support.Hardware 5 17 May 2007 22:33
Frederic's Emulator inside and Emulator thread Fred the Fop Retrogaming General Discussion 22 09 March 2006 08:31

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 05:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.08289 seconds with 15 queries