Category Archives: 68040

For anyone who is interested in classical 680×0 based NeXT emulation, I build the latest snapshot of Previous for Windows. You can find it here: Previous-1.6_build_767.7z

When I had a cube, I was like everyone else, without a working magnetic optical disc. And I was a (and still am) a diehard 3.3 fan, but it’s still fun loading up version 0.8 under emulation.

1.0a

The problem was several fold, from the drives turning out to be VERY sensitive to dust, the NeXT’s sucking air through the MO drive, trapping quite a bit of dust in the drives, mechanisms breaking, the optics being sensitive to heat, and of course our old friend, bad capacitors. The build disk application warns it can take upwards of 3 hours to create a MO of the operating system. They clearly were not fast either. I think it took 30 minutes under emulation.

Oops!

At the end of the day, I guess it didn’t matter. Optical discs came and went in the 80’s , and re surged with CD’s and re-writable discs up until this decade. Now we’ve pretty much gone either all solid state, or only large capacity disks with moving parts.

Oh well, I was looking for sample code, to see if there were other driver examples for the driverkit. I didn’t think there was anything far back when NeXTSTEP was a black box, 68030 thing, but it never hurts to look.

telnet

It is cool that TCP/IP won out in the protocol wars. It’s very convenient to have a current 2017 desktop, being able to communicate with operating systems nearly 30 years old. Especially when it comes to things like NFS, making it even better for mapping drives, and sharing data.

And much to my surprise, with the bad reputation the SLiRP code has, I’m able to mount my Synology’s NFS share just fine from my virtual cube.

I had just added some parameters to lower retry times, and resize the blocksize to be much smaller than a single packet so I don’t have to worry about any issues with MTU resizing. Maybe it’s not optimal, but being able to copy data in and out is all I want to do, and it’s been reliable.

Oh yeah, since it was burred in the messages, for people who like old dmesg’s

This one should have been much easier to build, it has support for SDL built in, however the include files are a nested mess, and configure fails part of the way in the process leaving the source kinda messy. But a few hours over a couple of days, and here we are.

This version doesn’t run at warp speed, has sound, and is great. It wants a config file though. You can find the specs in the readme, but something like this:

works fine. This later (and seemingly last) branch of UAE incorporates lots from WinUAE, except for the JIT. It’s dated 2008, so it does include support for the 68030, 68040, and the 68881 and 68882. It doesn’t have MMU support, so things like Linux/AMIX/NetBSD/Enforcer are out of the question.

I am happy to annouce the release of Previous v1.4! Simon did lots of work on emulating the NeXTdimension and he considerably improved timings and efficiency of Previous. Furthermore there is now a mode to accelerate the emulation beyond the performance of real systems. Other improvements and bugfixes are listed in the readme.

Emulating the NeXTdimension board was something i thought would not be feasible. But thanks to the i860 emulator from Jason Eckhardt and the work of Simon, who improved and completed parts of it, it finally came true. I hope you enjoy it!

The NeXT community has been about this old Mac emulator, daydream making a comeback onto NeXT hardware. Branded as darkmatter it runs on the bare metal of the NeXT cube/stations and can run MacOS in much the same way that Basilisk II does.

System 7.1 running on a NeXT cube!

What makes this interesting is that the 68040 is cycle set, and uses a much more mature CPU emulation core than Basilisk II, so it should give more accurate emulation. However it will run at 68040 25Mhz speeds, so it won’t win any speed records.

Naturally programs (Space Quest I) that blit directly to the display probably expect Mac/Plus/Se dimensions so the NeXT display won’t be ideal. But good old SoftPC for MacOS runs great!

SoftPC 3.1 for MacOS

And again, being set to 68040 speeds, it’s nowhere near as turbo as Basilisk II/SheepShaver.

For anyone interested, you’ll want Previous, the latest build and a test disk. Set the emulation for either a NeXT Computer (68030), or NeXTcube (68040), add the test disk as SCSI disk 0, and either type in ‘bsd’ at the firmware prompt, or have it automatically boot in the options.

I’ve been busy at work, but I did get some stuff done on this over the weekend, and just wanted to push this version out while there is some momentum.

The big fixes are in SCSI to support the dynamic scatter gather buffers so you can format big (lol) disks. Then again I only tested a 2GB disk but it’s working fine as far as I can tell.

I also hard coded SCSI id #6 as a CD-ROM. It only reads HFS partitioned images, and only can boot from a handful of those. From some SCSI CD emulation packages with passthru it performs just as poorly, so it’s not just me. I tested with the ‘blessed’ Win32 build 142, with ForceASPI in a Windows XP VM with emulated SCSI CD. There is a lot more ‘magic’ going on with the cdenable.sys driver on the Windows side, which mounts ISO’s without any hesitation.

This also includes my latest networking fixes as I moved more of the networking code to use queues, forced the 60Hz timer to hit the network card so it won’t stall anymore, and added in that timer patch, that more than doubled my LAN download speeds.

I’ve also added a simple PCAP filter as I noticed that my LAN was quite chatty, and I figured all this traffic wouldn’t be good as an emulator really shouldn’t be processing stuff it doesn’t need to. Something like this:

09:00:07:ff:ff:ff is the AppleTalk broadcast address, ff:ff:ff:ff:ff:ff is the typical all hosts broadcast, and I’m still generating a MAC based on PID which is good enough for me.

Feel the need for speed!

So while before downloading 124MB on my LAN took 8 minutes, now it’s about a minute.

I’ve updated the sourceforge page with source, Win32, Linux i386 and OS X (10.8) builds. I’ll add a 10.6 x86/PowerPC build later. On the sourceforge page I also added a utilities section with a simple ISO image with various utilities to get you started, including the A/UX partitioning tool to partition & format a virtual disk, a tool to try to mount ISO’s (remember HFS has the only hope right now), QuickTime, Flash, Internet Explorer and some other stuff.

Also, thanks to Peter, it’s also available on github, so my horrific edits are open for the world to see…

Well I was shuffling files back and forth into Shoebill, and with the advent of Ethernet support, I decided I wanted to build an AppleTalk network. This endeavor seems to have taken a life of it’s own.

So, the first thing I did was tear into minivmac, as I figured it would be the easiest to modify, as ‘mini’ is in it’s name. But it’s more geared to LocalTalk. From it’s readme:

It does this by converting the LocalTalk packets between SDLC frames in the virtual machine to LocalTalk Over Ethernet (LTOE) packets. These LTOE packets will be sent out the host machines Ethernet interface and will reach any other machine on the LAN. LTOE packets are not routable and not recognized by EtherTalk devices.

Which is pretty creative, but I want to talk to A/UX, Windows NT and Cisco routers. So this isn’t going to work out for me.

The next other ‘big’ names in Macintosh emulation are Basilisk II and SheepShaver. Both of which are from Christian Bauer which is a sizable download (or so I thought) and has a very confusing release versions for Windows. So I went ahead and tried BasiliskII, which only does some native networking via a TUN/TAP & bridge solution (which is really popular solution for plenty of UNIX based stuff), which personally I don’t really care for. The Windows version does support SLiRP, but for some strange and annoying reason it always crashes when I try to download anything big. As a matter of fact, the Windows version crashes, a lot!

While digging around for various builds of Basilisk II, I found the defunct sourceforge page, which is thankfully still up. And there I found the 0.8 and 0.9 release source code, which weighs in at a tiny 350kb in size. This is something I could probably dive into. So I went ahead and tried to build it on a Debian 7 x86 VM. And much to my surprise, after altering configure to accept GCC 4.7, and forcing it to turn X11 on (I don’t know why it kept failing to detect it), I was able to build a binary in no time. Even better, it worked!

So the first few goals were simple, I wanted to take 0.8 and remove it’s dependency on X11,and make it use SDL 1.2. Why not SDL 2.0? Well 2.0 is more about 3d space, and even to render a flat framebuffer it uses streaming textures. Which is too heavy for me, so I’m sticking with 1.2. I took a bunch of code from SDLQuake, and after a while of bashing it around, I was able to open a window, and capture some ouput from the framebuffer. With even more bashing around I got it to work correctly. I did make some small tweaks though, it only supports 8bit depth. But I’m interested in networking, so 256 colours is fine by me. Now that i could see what I was doing, I was able to then re-compile on OS X, and I was greeted with the Mac Boot screen. The harder part was Windows, as the system code written by Lauri Pesonen who did an excellent job of porting BasiliskII to Windows, but to say their code took 100% advantage of the Win32 API would be an understatement.. And I wanted something more pure to being SDL so I really couldn’t use much of that code. And what code I could find it was for far later versions. However with enough pushing I did finally get BasiliskII to boot up on Windows. I was once more again bitten by the fact that open on Windows defaults to being in ASCII mode.

The next thing to add was SDL input for the keyboard and mouse. And at this point googling around for an example of an input loop for SDL that is appropriate for an emulator I stumbled uppon the fact that there already was a SDL support built into the more current version of Basilisk II. But for some strange reason I kept going ahead, and incorporated some of the code into my 0.8 branch. And then I could finally send some keystrokes, move the mouse, and click on things! Things were looking up!

While looking at the SDL code, I did see they also have audio support, so I went ahead and borrowed the skeleton framework from there, although the initialization didn’t work at all as BasiliskII had drifted in how it hooked into the native sound support. So I once more again turned to SDLQuake, and I was able to initialize sound, and Even get QuickTime to play the old Quadra quicktime video, which was the first QuickTime thing I’d ever seen, back when they were still making Quadras.

So now with video and sound in place, it was finally time to tackle the networking. At first this seemed quite easy to do, and using SIMH for inspiration I was able to quickly replace the tun/tap code with some pcap code to open the interface, send packets, and receive packets. One more again I started on Linux, made it build on OS X, although my MacBook air doesn’t have anything I can really inject packets into so I don’t know if it actually works. The bigger test for me was on Windows with a GNS3 network, and with a few more minor changes I was happily sending AppleTalk to both Shoebill and Windows NT.

The next thing I wanted to tackle was SLiRP support. Ironically to bring SLiRP to Shoebill I used the SLiRP from the github of Basilisk II. At this point I figured this would be very simple, and I could wrap up later that day. It ended up taking me three days. Once more again my build would crash all the time, just like the later Basilisk II builds. Using Internet Explorer 4.0.1 would seemingly crash the whole system within seconds with faults in SLiRP’s slirp_select_fill, and slirp_select_poll functions. Now if you don’t call these functions SLiRP doesn’t process it’s TCP state and you end up with barely functioning UDP to only SLiRP which isn’t great beyond DHCP and DNS. First I tried semaphores which only made things worse as the nature of Basilisk II’s threaded nature just made the requests stack up deadlocking within seconds. I tried a mutex, timed mutexes and various other locking methods insdide of SLiRP and Basilisk II to no end. Netscape would kind of work, but IE would crash the whole thing out after a few pages. Then a better solution hit me as I was playing with the system clock on the Windows build. There is a 60Hz timer that calls a 1Hz timer once every 60 ticks. What if I had the clock drive SLiRP? And to my amazement not only did that work, but it worked great until I hit another problem that I had with Shoebill (that needs to be fixed now that I found away around it here). There is a static buffer that passes data between SLiRP’s callback when it is going to send a packet to BasiliskII and when Basilisk II then feeds the packet to MacOS. With enough traffic it will overwrite part of itself as they are on two different threads. Once more again I tried semaphores, which of course is the wrong tool here as if something is stacking waiting for it to unstack is just crazy, and more mutexes. The mutexes kind of worked but performance was horrible, as in 1992 dialup speed horrible. And I didn’t want to simulate a 1992 internet experience 100%

So the obvious solution as a queue. I took a simple queue implementation, added the ability to peek, changed it to accept a packet structure and I was set. Now I only needed a mutex when I queued items, and dequeued them. But I could hold 100 packets easily.

So with all that in place I can finally download files greater than 10MB, and even with Internet Explorer!

124MB in 8 minutes!

So the next was to make Pcap dynamically loaded, which for C++ is a bit of fun with __cdecl, GetProcAddress and all that fun. But I had it working after a bit so now if the user doesn’t have WinPcap installed they don’t get an error message, and I don’t have to maintain two builds. Nobody likes doing that kind of stuff. Ever.

Multitasking.. Kind of.

There is still plenty of things broken afterall I’m using an ancient version of Basilisk to base this off of. I’ve also removed a bunch of features as I wanted to make this more of a ‘core’ product with again a focus on networking.

Will this interest the majority of people? Probably not. But for anyone who wants to actually download a file this may be somewhat useful.

Where to go from here?

Well there is still a lot of OS specific stuff in the code that I want to convert to SDL. I’d like to build from a 100% more generic code tree rather than having private files here and there. The CPU optimization programs that re-read GCC’s assembly output don’t do anything. I want to try it through an older version of GCC and see if there is any difference in speed. I also recently received the source code to vc5opti.cpp and I’d like to try that to see if it speeds up the Windows Visual C++ based build. Long term I’d love to patch in the UAE CPU code from the newer versions that have a far more solid 68030/68881 and 68040 emulation. The price of standing on so many tall shoulders is that when I fall off I don’t know if the CPU exceptions I see are faults in the CPU emulation, Basilisk II or just plain crashes in MacOS which was certainly not the most stablest thing once you mixed in multimedia and networking. It was par with Windows 3.1, which honestly both of them were ‘saved’ with help from the older generation, ala BSD Unix for MacOS, and the VMS team for Windows.

So after all this I’m ready to release some binaries, and code. Although the last thing I wanted to do is add more confusion by calling this Basillisk II v0.8.SOMETHING … A quick google search on Basilisk gave me this:

Well it was the weekend, and I was playing with FORTRAN (Language systems fotran to be exact, all 30lb of it!) and anyways to check to FPU & crash issues I though I’d check it out on an actual m68k Macintosh. So as I was using Basilisk II for some stuff, I was wondering if anyone ever did upgrade the CPU emulation to 68040/mmu emulation. And it turns out that the Basilisk II emulation is taken from UAE, which in turn has been used in a few other emulators including aranym.Aranym is “Atari runs on any machine”, and what these guys have done, is fleshed out the UAE 68000 emulation enough to where it will run m68k linux!