Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 68010 and 68020 #728

Closed
dirkwhoffmann opened this issue Aug 13, 2022 · 16 comments
Closed

Add support for 68010 and 68020 #728

dirkwhoffmann opened this issue Aug 13, 2022 · 16 comments
Labels
Enhancement New feature or request v2.2

Comments

@dirkwhoffmann
Copy link
Owner

Recently, I had another look at the Musashi core and noticed that supporting the 68010 and 68020 isn't as difficult as I originally thought. As a starting point, I've decided to add a 68010 and 68020 mode to Moira that tries to replicate Musashi to 100%. This worked quite well and I'm already able to run Sysinfo in vAmiga:

Bildschirmfoto 2022-08-13 um 10 16 06

As already stated, this is only a starting point. A lot of stuff is missing (the 68020 deals with all kinds of different stack frames, has multiple trace modes etc.). All these features are not emulated yet.

@dirkwhoffmann dirkwhoffmann added the Enhancement New feature or request label Aug 13, 2022
@Alessandro1970
Copy link

Alessandro1970 commented Aug 13, 2022

Great!
…so it could be added the 68882 with 68020 ✌🏻

@Vweber73
Copy link

Hi,

Excellent news, thanks!

  1. I tried it with The Settlers and it works fine, 68020 reported. Now map size can be up to 7 (against 5 for 68000). The absolute max (size 8) would need a 68030. Is 030 planned as well?
  2. I tried Dungeon Master II, which is one of these very few games marked as AGA but actually don't need AGA, just a 68020, so a good test case (actually the only one I know). It starts working, then freezes, it seems that it eats up a lot of ressources, the UI becomes very slow until you restart vAmigaWeb. It is using one of these net yet implemented 020 features?

Cheers

@dirkwhoffmann
Copy link
Owner Author

It is using one of these net yet implemented 020 features?

I don't know yet. Which DM2 version did you use (please don't upload the game, just the exact filename)? Does it boot from floppy disk? I'm asking, because I found a version that needs to be installed on HD.

@Vweber73
Copy link

@mithrendal
Copy link
Contributor

mithrendal commented Aug 15, 2022

I tried it and it actually works ...

image

but it does flood the console with thousands of log output ... seems as if every cpu instruction is logged ...

execBitFieldEa(137,5,4,e9eb)
(Index):876 execExtb(155,0,4,49c3)
(Index):876 execBitFieldEa(137,5,4,e9eb)
(Index):876 execExtb(155,0,4,49c3)
(Index):876 execBitFieldEa(137,5,4,e9eb)
(Index):876 execExtb(155,0,4,49c3)
2(Index):876 execBitFieldEa(137,5,4,e9eb)
4(Index):876 execBitFieldEa(137,5,4,e9e8)

...

thats why it seems to freeze

the line which is responsible for that logging is here I guess

if constexpr (cpu == M68020) { printf("%s(%d,%d,%d,%x)\n", __func__, I, M, S, opcode); }\

BTW: nice side effect of 68020 support is, that now also kickstart meant for A1200 is usable (which contains probably 68020 instructions)

@dirkwhoffmann
Copy link
Owner Author

the line which is responsible for that logging is here I guess

Yes. This is a debug statement which gets active if a 68020-only instruction is executed. It's only meant to be used during debugging.

@Vweber73
Copy link

Vweber73 commented Aug 15, 2022

Yeah! I had the console still on, I switched it off and now it is working fine! So it seems that this 020 emulation is quite complete and reliable after all? I think the main item is the bitfields instructions?

It also seems that The Settlers detects the processor type but doesn't use extra instructions, otherwise it would have lagged as well when I tried?

@Vweber73
Copy link

When I wrote that it worked fine... I hadn't switched the sound on. Now I have done it, and it is pretty sluggish. I guess that the system is still slowed on with this logging even though I turned the console off!?

@mithrendal
Copy link
Contributor

if you turn debugging console off reduces maybe the slow down a bit, but that extensive logging will still happen in background so, maybe I better will comment that printf statment out ...

@dirkwhoffmann what is the proper way to remove the logging ? maybe some config setting e.g. in MoiraConfig.h?

@dirkwhoffmann
Copy link
Owner Author

I guess that the system is still slowed on with this logging even though I turned the console off!?

Yes, the logging statement has to be removed. It's a performance killer.

It also seems that The Settlers detects the processor type but doesn't use extra instructions

True. I think it simply uses the CPU modes as an estimate for overall system performance

@dirkwhoffmann
Copy link
Owner Author

@dirkwhoffmann what is the proper way to remove the logging ? maybe some config setting e.g. in MoiraConfig.h?

Change the code to

// if constexpr ((cpu) == M68020) { printf("%s(%d,%d,%d,%x)\n", __func__, I, M, S, opcode); }

#define AVAILABILITY(cpu) \
if constexpr (WILL_EXECUTE) willExecute(__func__, I, M, S, opcode); \
assert(C >= (cpu)); \
if constexpr (C == M68020) cp = 0;

@Vweber73
Copy link

I understand that the only differences between the 020 and 030 are not in the instruction set but in the MMU which is not useful in emulation, and data cache + burst mode which probably add nothing much in performance either in emulation, so could it be possible to have a 030 setting that would be identical to the 020 emulation save for the identification bits? So that Settlers can have map size to 8...

@mras0
Copy link

mras0 commented Aug 15, 2022

Roots 2.0 by Sanity is another good test case for 020 without AGA (requires ECS).

@Vweber73
Copy link

Roots 2.0 by Sanity is another good test case for 020 without AGA (requires ECS).

Excellent stuff, thanks! Seems to work quite well. Except that after the credits the screen goes black and you only have the music... Is it normal? Or maybe the start of the AGA part?

@dirkwhoffmann
Copy link
Owner Author

Brief update:

  • vAmiga passes all 68000, 68010, and 68020 tests from the SIMPLE test suite now.

Next steps:

  • Merge changes back to the Moira repo and fix Musashi compatibility mode (which is obviously broken now).
  • Generate more sophisticated test cases with cputester.

@dirkwhoffmann
Copy link
Owner Author

Fixed in v2.2b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request v2.2
Projects
None yet
Development

No branches or pull requests

5 participants