Page 1 of 1

My fork of Basilisk II

Posted: Mon Apr 16, 2018 1:37 am
by uyjulian
https://github.com/uyjulian/macemu
Check out the "core_cleanup" branch.

I personally want to do the following:
1. remove all support code for other platforms for BasiliskII except macOS/SDL (already done)
2. convert BasiliskII build system to CMake, like Hatari and Previous are doing (already done)
3. Backport CPU from old BasiliskII (this will reduce the amount of differences when porting a new CPU core) (already done)
4. Port JIT from ARAnyM (partially done; currently hangs.)
5. Modularize the Toolbox traps, so that it's easy for anybody to accelerate Toolbox functions with just a trap number and a function definition.

I'll clean up and send #4 and #5 in a PR after those are finished. #1, #2, and #3 are just to get familiar with the source code.

Also, check out my Basilisk II FLTK GUI. viewtopic.php?f=6&t=9467

These are "far off" ideas:
Port Dolphin JIT to SheepShaver
AOT compiler with LLVM
UAE emulation when 68k code is executed in Sheepshaver
Boot from folder in shared directory instead of disk image
Toolbox windows managed by WindowServer/Wayland/X compositor

Re: My fork of Basilisk II

Posted: Mon Apr 16, 2018 4:30 am
by adespoton
Thanks, Julia! That's a lot of progress already!

Re: My fork of Basilisk II

Posted: Mon Apr 23, 2018 3:05 am
by uyjulian
Okay, I decided to put latest BasiliskII uae_core back in, but I used the ARAnyM JIT compiler.
ARM JIT still needs some work to be done.

Oh, and as a bonus, JIT compiler works again on the latest macOS and compilers! pagezero_size was changed to 0x2000; JIT compilers don't work on 64-bit macOS if pagezero_size isn't set properly. Also, the CPUID function was replaced with the one from ARAnyM, which allows the CPUID check to work again.

Also, if you are attempting to compile it yourself, you can just use CMake. Be sure you set CMAKE_BUILD_TYPE to Release to optimize the executable. Also, LTO will just result in an abort trap for some reason.

Also, the "sleep when idle"/"idlewait" functions will result in the Toolbox hanging since no events are processed randomly. Be sure to turn it off/uncheck the option.

Also, if it hangs while you are trying to launch, just do

Code: Select all

killall -KILL BasiliskII
and try again. It takes a few tries.

Here's a benchmark from the 1 March 2014 build for reference:
Image

Initial try with 8192 Translation Cache Size:
Image
Now, processor speed is slow... but look at the disk scores!

Second try with 16384 Translation Cache Size:
Image
The processor speed comes back... but disk scores are lower than even the 1 March 2014 build...
I'm going to mess with it more next week.

Re: My fork of Basilisk II

Posted: Thu Jun 07, 2018 4:20 am
by uyjulian
Temporary test build 2018-06-06, including fltkbasiliskgui: https://transfer.sh/jg3ZQ/BasiliskII-test1.zip

Source code repository has also been updated. Disable "idlewait" or "Don't use CPU when idle" or events, such as mouse click/keyboard type will stop working randomly.

If my build hangs immediately while you are trying to run it, kill it with

Code: Select all

killall -KILL BasiliskII
then try running it again. It takes a few tries.

Now for some benchmarks:
Image

Re: My fork of Basilisk II

Posted: Mon Jun 11, 2018 10:34 am
by rickyzhang
Boy, I missed you thread completely! Great work!

1. remove all support code for other platforms for BasiliskII except macOS/SDL (already done)
2. convert BasiliskII build system to CMake, like Hatari and Previous are doing (already done)
Why? You want to pissed off Power PC Mac and Linux folks?
3. Backport CPU from old BasiliskII (this will reduce the amount of differences when porting a new CPU core) (already done)
Why are you doing this? Can you give me more technical background on this?
4. Port JIT from ARAnyM (partially done; currently hangs.)
Very interesting project. What is your motivation? Can you point to me more details so that I can take a quick look?
5. Modularize the Toolbox traps, so that it's easy for anybody to accelerate Toolbox functions with just a trap number and a function definition.
Nice work. But what toolbox function is a deal breaker in emulated OS that need acceleration? TBH, in my dated Intel i7 2600k box I have zero performance problem at all in all apps I'm running. Even I can't use JIT.

So far there are some compatible issues that is hard to figure it out why in emulator. That's why I improved the run time debugger last year. Because it crashed in some application. It is a real show stopper to me.

Glad that you make some serious coding work. Please keep us posted!

Re: My fork of Basilisk II

Posted: Tue Jun 12, 2018 5:23 am
by uyjulian
rickyzhang wrote:Boy, I missed you thread completely! Great work!

1. remove all support code for other platforms for BasiliskII except macOS/SDL (already done)
2. convert BasiliskII build system to CMake, like Hatari and Previous are doing (already done)
Why? You want to pissed off Power PC Mac and Linux folks?
I'm planning on also looking at support for E-UAE PowerPC JIT compiler.
rickyzhang wrote:
3. Backport CPU from old BasiliskII (this will reduce the amount of differences when porting a new CPU core) (already done)
Why are you doing this? Can you give me more technical background on this?
Most of the work on this point has been undone. It didn't work very well.
rickyzhang wrote:
4. Port JIT from ARAnyM (partially done; currently hangs.)
Very interesting project. What is your motivation? Can you point to me more details so that I can take a quick look?
Make JIT work on 64-bit x86, ARM, and on newer compilers. Look here for source code -> https://github.com/uyjulian/macemu on core_cleanup branch
rickyzhang wrote:
5. Modularize the Toolbox traps, so that it's easy for anybody to accelerate Toolbox functions with just a trap number and a function definition.
Nice work. But what toolbox function is a deal breaker in emulated OS that need acceleration? TBH, in my dated Intel i7 2600k box I have zero performance problem at all in all apps I'm running. Even I can't use JIT.
QuickDraw mainly. It would be nice to GPU-accelerate it. I also want to get rid of or work around nested EmulOp calls and JIT, since it causes problems with the "idlewait" function of BasiliskII.
rickyzhang wrote: So far there are some compatible issues that is hard to figure it out why in emulator. That's why I improved the run time debugger last year. Because it crashed in some application. It is a real show stopper to me.

Glad that you make some serious coding work. Please keep us posted!

Re: My fork of Basilisk II

Posted: Tue Jun 12, 2018 12:29 pm
by rickyzhang
To accelerate quick draw, I think SDL 2 is an answer not the alternative emulator nor improve JIT.

The pixel from guest OS is written to frame buffer in host OS directly. It is host OS (thus SDL) determine how to plot in host OS screen. It doesn't seem to relate to JIT.

Re: My fork of Basilisk II

Posted: Sun Sep 01, 2019 10:35 pm
by uyjulian
Synchronized with latest ARAnyM compiler sources.

Image

I'm still having the issue where the program may sometimes hang before showing the window, and a SIGKILL is needed to kill the program. It appears that ARAnyM is using fixed addressing with JIT instead of direct addressing, so maybe I'll try that.

Re: My fork of Basilisk II

Posted: Mon Sep 02, 2019 4:06 am
by adespoton
This is looking really promising! Thanks for sharing :)

Maybe eventually we can merge your fork back into mainline BII....

Re: My fork of Basilisk II

Posted: Mon Sep 02, 2019 7:49 pm
by uyjulian
The rest of uae_cpu from ARAnyM was merged.

There's still the issue of the program sometimes hanging on startup, and I'm not sure where to start on debugging that issue.

Re: My fork of Basilisk II

Posted: Sun Jan 12, 2020 3:52 pm
by uyjulian
I synchronized changes with ARAnyM again.

There's still the following issues:
1. Program randomly hanging on startup
2. Program not working properly with idlewait option (no events except mouse movement events are delivered)

Re: My fork of Basilisk II

Posted: Mon Jun 29, 2020 4:43 am
by uyjulian
Okay, it seems like the random hang on startup is caused by the SDL2 code. See https://github.com/cebix/macemu/issues/203

Re: My fork of Basilisk II

Posted: Mon Jun 29, 2020 1:12 pm
by rickyzhang
If you compile with addressing mode in memory banks in configure, it should workaround the hangs.

Code: Select all

--enable-addressing=banks
I'm working on the permanent fix now.

Re: My fork of Basilisk II

Posted: Tue Jun 30, 2020 10:25 am
by rickyzhang
uyjulian wrote:Okay, it seems like the random hang on startup is caused by the SDL2 code. See https://github.com/cebix/macemu/issues/203
I proposed several solutions in the issue. I will go for the solution that use memory banks addressing.

But I dont know the performance hit, compared to direct addressing. I downloaded MacBench 4.0 from macintoshrepository.com. But the app crashed in BII from System7.5.

where do you get your MacBench 4.0?

Re: My fork of Basilisk II

Posted: Tue Jun 30, 2020 11:51 am
by uyjulian
rickyzhang wrote:
uyjulian wrote:Okay, it seems like the random hang on startup is caused by the SDL2 code. See https://github.com/cebix/macemu/issues/203
I proposed several solutions in the issue. I will go for the solution that use memory banks addressing.

But I dont know the performance hit, compared to direct addressing. I downloaded MacBench 4.0 from macintoshrepository.com. But the app crashed in BII from System7.5.

where do you get your MacBench 4.0?
Macintosh Garden

Re: My fork of Basilisk II

Posted: Tue Jun 30, 2020 4:15 pm
by rickyzhang
Image

I benchmark two addressing: direct and memory banks. As I expected, the memory banks is a little bit slower than direct. But in general, there are no noticeable issues at all to run any Apps in BII under direct or memory banks.

But what makes the huge performance differences is the GCC compiler optimization flag:

  1. No optimization at all:

    Code: Select all

    -O0
  2. Optimization at level 3 and native code:

    Code: Select all

    -O3 -march=native
As you can see, memory banks is 10x slower in no optimization flag.

Re: My fork of Basilisk II

Posted: Wed Aug 12, 2020 5:38 am
by kanjitalk755
uyjulian wrote:Okay, it seems like the random hang on startup is caused by the SDL2 code. See https://github.com/cebix/macemu/issues/203
The issue will be fixed with the following commit:

https://github.com/kanjitalk755/macemu/ ... c82f828bac

Re: My fork of Basilisk II

Posted: Wed Aug 12, 2020 6:42 am
by uyjulian
kanjitalk755 wrote:
uyjulian wrote:Okay, it seems like the random hang on startup is caused by the SDL2 code. See https://github.com/cebix/macemu/issues/203
The issue will be fixed with the following commit:

https://github.com/kanjitalk755/macemu/ ... c82f828bac
Cool. I'll check it out

Re: My fork of Basilisk II

Posted: Wed Aug 12, 2020 3:12 pm
by adespoton
While we're integrating, any chance of integrating Vasi's date offset patch from a few years back into BII/SS?

Re: My fork of Basilisk II

Posted: Sun Aug 23, 2020 11:18 pm
by uyjulian
Updated with latest ARAnyM changes.

I still need to figure out why "idlewait" hangs randomly…

Re: My fork of Basilisk II

Posted: Wed Sep 22, 2021 3:04 am
by uyjulian
It seems like Hatari UAE core is more updated then ARAnyM's core. I'll see if I can integrate the changes...

Re: My fork of Basilisk II

Posted: Wed Sep 22, 2021 6:47 pm
by adespoton
uyjulian wrote: Wed Sep 22, 2021 3:04 am It seems like Hatari UAE core is more updated then ARAnyM's core. I'll see if I can integrate the changes...
Sounds good... last time I checked, Hatari UAE core was the most up to date one of the different forks out there.