Fix for "black screen" in Basilisk II for Windows

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

User avatar
ClockWise
Site Admin
Posts: 4397
Joined: Mon May 20, 2002 4:37 am
Location: Uiwang

Fix for "black screen" in Basilisk II for Windows

Post by ClockWise »

If you have the "black screen" problem when starting Basilisk II in Windows please update to the latest build available here: http://www.emaculation.com/forum/viewto ... f=6&t=5282

For anyone interested, there is also an old "pre-jit" build of Basilisk II ( also known as Basilisk II "build 142") available. There is a setup guide provided:
http://emaculation.com/doku.php/basilisk_142_setup
Last edited by Cat_7 on Tue Mar 05, 2013 5:55 pm, edited 4 times in total.
Reason:  
DickeFix
Space Cadet
Posts: 7
Joined: Thu Sep 09, 2010 4:14 pm
Location: Sweden

Fix for Basilisk JIT "black screen"

Post by DickeFix »

I have found after extensive research that the service "BTTray.exe" for bluetooth interferes with all JIT-compiling versions of Basilisk II so that the screen becomes black, at least on my Lenovo X201 running Windows 7. It doesn´t interfere with older non-JIT versions of Basilisk. By stopping the service or preventing it from starting, either by running "msconfig" or by doing it in the administrative tools in the control panel, the problem is solved. Apart from this problem the latest compiled versions of both BasiliskII JIT and Sheepshaver by Alexandre Daigle works perfectly on my computer. The old problems that I experienced with the JIT version, that the cursor hanged when moved outside the window or that text editing didn´t work in Think Pascal are fixed. In order to get full speed of the emulator the setting "Don´t Use CPU When Idle" should be disabled. Thanks a lot Alexandre!
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Fix for Basilisk JIT "black screen"

Post by Ronald P. Regensburg »

DickeFix wrote:Apart from this problem the latest compiled versions of both BasiliskII JIT and Sheepshaver by Alexandre Daigle works perfectly on my computer.
I suppose you refer to the build by Cat_7. Alexandre Daigle is a very good hockey player but I doubt he is able to compile software. :lol:
http://en.wikipedia.org/wiki/Alexandre_Daigle

In this forum 'Alexandre Daigle' is the highest rank. The more you have posted, the higher your rank.

Anyway, welcome to the forum and thanks for sharing your findings.
User avatar
ClockWise
Site Admin
Posts: 4397
Joined: Mon May 20, 2002 4:37 am
Location: Uiwang

Post by ClockWise »

Thanks for that solution/suggestion Dickefix. I hope that helps some people. But the black screen bug seems so random... I wonder if EVERYONE who has experienced it has been running BTTTray? Maybe not?

PS: Eight years ago I thought that using "Alexandre Daigle" as the top user-rank was very very funny. Because he was the top pick in the NHL draft. Ha ha, right?
DickeFix
Space Cadet
Posts: 7
Joined: Thu Sep 09, 2010 4:14 pm
Location: Sweden

Post by DickeFix »

I suppose you refer to the build by Cat_7. Alexandre Daigle is a very good hockey player but I doubt he is able to compile software
Haha, well I guess that tells something about my interest in hockey. The sad thing is that I am neither good at hockey nor at compiling Basilisk.

I found later that the black screen still occurs even without BTtray but rarely, if I e.g. start Basilisk too quickly after I have shut it down. It did that when I ran Basilisk JIT on XP also. But if I turn on BTtray it occurs almost every time and it is not possible to use the emulator. So although the problem is not completely solved the frequency of it is very different. I have tested to turn on and off BTtray and the effect is very repeatable. I just wonder why the Bluetooth tray process affects Basilisk.

I have today installed Codewarrior on Mac OS 9.04 running with Sheepshaver in Windows 7. I am now able to compile a big Pascal project without major problems. Fantastic! There were only a few minor issues.

-I couldn't create a virtual hard drive over 2GB.
-I like to work in full screen mode but if I go back to Windows application using the Windows button without shutting Sheepshaver down , the mouse pointer get stuck in upper left corner of the screen.
-I also didn´t manage to get TCP/IP working in Sheepshaver despite I use the same settings as in Basilisk. Maybe I miss some extension in the Mac environment.

I know these problems are out of the topic of this thread but any help is welcome.
Broman
Student Driver
Posts: 10
Joined: Sat Oct 09, 2010 7:52 pm

Post by Broman »

I fixed the black screen problem completely by using an idea from a very old thread:

Right-click BasiliskII.exe, click Run as..., and run it as an administrator. Strangely enough, I was logged into the administrator account (the real one) on XP when I was getting black screens, yet running it this way bypasses the black screen issue completely. The only thing is if you're on the adminstrator account and you uncheck "Protect my computer and data", you get the black screen once again.

Does this work for anyone else? If so this should definitely be listed at the top of this thread.
Jorpho
Master Emulator
Posts: 380
Joined: Fri Sep 17, 2004 4:22 am

Post by Jorpho »

Isn't the black screen also fixed by disabling the emulated serial ports, so that it doesn't try to do anything with COM1 or COM2? That actually sort of fits with the other things posted here so far.
User avatar
ClockWise
Site Admin
Posts: 4397
Joined: Mon May 20, 2002 4:37 am
Location: Uiwang

Post by ClockWise »

See what I mean (in the other thread) Broman? Everyone has their own solution for this problem. It's odd. But I'm happy to list as many as possible in this sticky.
Broman
Student Driver
Posts: 10
Joined: Sat Oct 09, 2010 7:52 pm

Post by Broman »

Jorpho wrote:Isn't the black screen also fixed by disabling the emulated serial ports, so that it doesn't try to do anything with COM1 or COM2? That actually sort of fits with the other things posted here so far.
How do you disable those? I tried deleting COM1 and COM2 from the prefs file but it still black screens.
af2412
Space Cadet
Posts: 9
Joined: Wed Nov 26, 2008 1:14 pm
Location: Oregon

Post by af2412 »

Server 2003 -- I finally got past JIT BlackScreen by setting compatibility mode for the application
(right click : Properties : Compatibility : NT).
User avatar
ClockWise
Site Admin
Posts: 4397
Joined: Mon May 20, 2002 4:37 am
Location: Uiwang

Re: Fix for "black screen" in Basilisk II for Windows

Post by ClockWise »

I simplified the "black screen" suggestions by just linking to the 142 build setup guide. The original post had some unhelpful information that could just lead people astray.
Silent Flamer
Master Emulator
Posts: 430
Joined: Tue Feb 23, 2010 7:35 am

Black-Screen Tip

Post by Silent Flamer »

Just so you people know, I have been experiencing the black screen problem in Basilisk II for a long time.

My solution was simply using Task Manager to quit Basilisk II when it gets the black screen, and restart it. Rinse and repeat until it successfully boots (Yes, it eventually does boot correctly). Useful if you've gone through a lot of troubleshooting and still can't get rid of the problem.
DickeFix
Space Cadet
Posts: 7
Joined: Thu Sep 09, 2010 4:14 pm
Location: Sweden

Re: Fix for "black screen" in Basilisk II for Windows

Post by DickeFix »

The only solution to the black screen problem on Windows 7 that works reliable for me is to start the computer in "Safe Mode".

In Windows 7 you can do this by running msconfig.exe. Select Boot tab, check Safe Boot and select Network. Then restart the computer, change the resolution if needed and run Basilisk II. When you have finished you need to undo the changes and restart again.

Certain services running in Vista and Windows 7 seem to interfer with the Basilisk II.

I run mostly the PPC-emulator SheepShaver instead of Basilisk II now, partly because of the black screen problem but also because it has better stability. It runs most 68k programs also, especially if you install SoftwareFPU to emulate the floating point processor. I have however not been able to use PowerFPU which is much faster.
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

Hi all, I'm new here!

I have been playing with the Basilisk II code for the past week and believe I have fixed the Windows 7 black screen problem. Here is a link to the github pull request with my comments on what the cause was. In summary: it was a fairly random-ish thing that totally depended on the ordering of the addresses being returned by Windows when allocating space for the emulated machine's RAM and ROM. The OS X and Linux ports already eliminated the possibility of this wrong order, but the Windows port didn't have the same logic, so I added it. I don't yet understand why the order of the addresses mattered, but the end result was if it was in the wrong order, the video and ethernet drivers wouldn't load. The emulated machine was still running in the background just fine, but without a video card.

I'm curious if anyone else is interested in trying this build out to see if it fixes the black screen problem for you. It has JIT enabled, so I would assume it should have better performance than the pre-JIT build--although it was plenty fast even without JIT!

https://www.dropbox.com/s/f50nzqsurmhyz ... 3-02.exe?m

Note: One thing I've noticed with these newer builds is that if you have an invalid path to a disk image or CD image in your preferences file, it will cause Basilisk II to crash immediately. So make sure all of your disk and cdrom paths in the pref file point to actual files. Also if the mouse seems jerky compared to before, make sure your frameskip is set to 0. Mine was set to 6, but the older pre-JIT Basilisk didn't seem to pay attention to it.

Let me know how it goes! I'm excited for other people to test it out. :-)
User avatar
ClockWise
Site Admin
Posts: 4397
Joined: Mon May 20, 2002 4:37 am
Location: Uiwang

Re: Fix for "black screen" in Basilisk II for Windows

Post by ClockWise »

Nice work! It's great that someone has finally identified the problem and submitted a patch. It will benefit a lot of users. As you've said, the problem is pretty random, so I hope that some people who have (randomly) experienced the black-screen issue can post with feedback.

Have you looked at the SheepShaver code? I guess that the issue is not present there, either, since no one has reported black screen issues with that emulator.
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

Hey, thanks! I'm really excited to hear everyone's feedback.

I did check the SheepShaver code. It appears that the SheepShaver in Windows, OS X, and Linux, when running in a mode other than real addressing mode (which isn't supported on Windows, AFAIK), does it in the way that can cause the black screen in Basilisk II. Since nobody has reported black screen problems in SheepShaver, maybe the PowerPC ROMs aren't affected by the same problem. The problem in Basilisk seemed to originate either in the Mac ROM or in the patches that Basilisk applies to the Mac ROM for adding video/ethernet support--I didn't go into depth to discover exactly where because it would be a lot of work and I had code that made the problem go away :-)
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Fix for "black screen" in Basilisk II for Windows

Post by Cat_7 »

Hi,

Thanks! I haven't seen a black screen anymore since I've been using your build!

Best,
Cat_7
User avatar
24bit
Forum All-Star
Posts: 1424
Joined: Wed Nov 11, 2009 5:47 pm
Location: Germany

Re: Fix for "black screen" in Basilisk II for Windows

Post by 24bit »

Many thanks for your work, dougg3!
I´m not using BII much on Windows hosts any more, but I had black screens occasionally too in the past.
I will sure give your build a go.
Cheers!
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

Cat_7 wrote:Thanks! I haven't seen a black screen anymore since I've been using your build!
Glad it's working for you! Woohoo!
24bit wrote:Many thanks for your work, dougg3!
No problem! I hope it works.

For fun, I compiled the Linux version of Basilisk II, modified it to put ROM below RAM, and what do you know -- the black screen problem happened on Linux too. So the underlying problem is not specific to Windows, it's just that the other operating system ports didn't allow that situation to ever happen.

For anyone interested, the source code of the modification for Windows is available at the github link I gave earlier. So if we want to make a new official build to distribute on this site, that will describe what has to be changed to fix the bug.

Edit: After more research, it appears the root problem is that when ROM happens to be allocated below RAM, the emulated Mac's internal representation of the ROM base address has a high byte of 0xFF, and that causes the slot manager to think it's an invalid slot number when the Mac ROM attempts to load its slot ROM that Basilisk patches (containing the setup for video and ethernet).
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Fix for "black screen" in Basilisk II for Windows

Post by Cat_7 »

For anyone interested, the source code of the modification for Windows is available at the github link I gave earlier. So if we want to make a new official build to distribute on this site, that will describe what has to be changed to fix the bug.
Good idea, I'll wait until your patch is accepted in the git repository before attempting a new build. In the meantime Basilisk users can use your build.
However, I haven't been able to build Basilisk for Windows in Windows with either Cygwin or MinGW lately.
Might be due to me not setting up Cygwin correctly (most likely ;-) ) or the GCC version MinGW uses.

Best,
Cat_7
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

Sounds good!

Hmm, I'm not sure why it hasn't succeeded for you lately. I actually cross-compiled this build in Linux using a MinGW cross-compiler (I'm not a huge fan of having to install cygwin on Windows). If anyone's interested I would be happy to provide instructions for cross-compiling Basilisk II for Windows in Ubuntu -- it was actually surprisingly simple!
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Fix for "black screen" in Basilisk II for Windows

Post by Cat_7 »

Hi,

If you would, please! Then I would only need to start my virtual machine.

Best,
Cat_7
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

OK -- here goes nothing! These instructions are based on Ubuntu 12.10. Make sure some prerequisites are installed (hopefully I got them all!)

Code: Select all

sudo apt-get install build-essential automake autoconf mingw32
First of all we are going to cross-compile a static version of SDL for Windows.

Code: Select all

wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar -xzf SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure --host=i586-mingw32msvc --disable-shared --prefix=/opt/basilisk
make
sudo make install
You can configure it to be installed in any folder other than /opt/basilisk. Whatever you prefer, I just picked that for convenience. After this you should now have SDL compiled and ready to link against Basilisk.

Now we need to add /opt/basilisk/bin to our PATH:

Code: Select all

export PATH=/opt/basilisk/bin:$PATH
Now in the Basilisk II src/Windows directory:

Code: Select all

NO_CONFIGURE=1 ../Unix/autogen.sh
echo ac_cv_have_win32_exceptions=yes > extra.cache
./configure --host=i586-mingw32msvc --prefix=/opt/basilisk --cache-file=extra.cache
Now, edit sigsegv.cpp so it includes basetsd.h rather than BaseTsd.h -- a case sensitivity issue on Linux that I also included in my github patch.

Finally you should be able to build it:

Code: Select all

make
And that will give you BasiliskII.exe. This .exe will not even depend on SDL.dll being installed next to Basilisk because it's statically compiled into it.

For the super brave:

I have also succeeded at cross-compiling BasiliskIIGUI.exe, although it's a bit more complicated--I got most of the info from https://live.gnome.org/GTK+/Win32/Apps. I'll add those directions now too (start at this point after installing SDL):

Code: Select all

wget http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip
extract the contents into /opt/basilisk

Create a file /opt/basilisk/bin/pkg-config containing:

Code: Select all

#!/bin/sh

PKG_CONFIG_LIBDIR=/opt/basilisk/lib/pkgconfig \
PKG_CONFIG_PATH=/opt/basilisk/lib/pkgconfig /usr/bin/pkg-config $*
and chmod +x it to make it executable.

Patch up the libraries:

Code: Select all

cd /opt/basilisk
sed -i 's|^prefix=.*$|prefix=/opt/basilisk|g' lib/pkgconfig/*.pc
cd ./lib
for f in *.lib; do mv $f lib${f%%lib}a; done
Use this configure command for Basilisk II:

Code: Select all

./configure --host=i586-mingw32msvc --prefix=/opt/basilisk --cache-file=extra.cache --with-gtk --disable-gtktest
You will also have to edit the Makefile because I found another case sensitivity issue -- change a reference to b2ether/Packet32.cpp to b2ether/packet32.cpp

With those commands you should end up with BasiliskIIGUI.exe -- then just put all the .dll files in /opt/basilisk/bin next to BasiliskIIGUI.exe and it should run fine on Windows.

Whew! I hope these instructions help out :) Hopefully I didn't miss anything.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Fix for "black screen" in Basilisk II for Windows

Post by Cat_7 »

Hi,

Thanks! Works as advertised ;-) Added benefit: these instructions can also be used to create a SheepShaver.exe that will run with the JIT compiler enabled, something MinGW in Windows wouldn't do.

Best,
Cat_7
dougg3
Student Driver
Posts: 20
Joined: Sat Mar 02, 2013 10:20 pm

Re: Fix for "black screen" in Basilisk II for Windows

Post by dougg3 »

Excellent, glad my instructions worked for you! BTW, my patch has been accepted into the Basilisk II github project. Woohoo!
Post Reply