MachTen 2.2

MachTen console

Not that I need another UNIX, but I came across this fine thing googling around for some Mach based OS’s running on the 68000, and well here is MachTen.  Perhaps the most notable thing about MachTen is that it is capable of running in usermode under MacOS.  Without a MMU.

# cc -v hi.c -o hi
gcc version 1.40
 /usr/local/PMtools/cpp -v -undef -D__GNUC__ -Dunix -D__MACHTEN__ -DMACHTEN -DTENON -D__unix__ -D____MACHTEN____ -D__MACHTEN__ -D__TENON__ -Dmc68000 hi.c /var/tmp/cc000093.cpp
GNU CPP version 1.40
 /usr/local/PMtools/cc1 /var/tmp/cc000093.cpp -fno-builtin-alloca -fno-defer-pop -quiet -dumpbase hi.c -version -o /var/tmp/cc000093.s
GNU C version 1.40 (68k, MIT syntax) compiled by GNU C version 2.3.3.
default target switches:
 as -mc68000 -o hi.o /var/tmp/cc000093.s
 ld -o hi -x /usr/lib/crt0.o hi.o -lc
# size hi
text    data    bss     dec     hex
11220   400     1672    13292   33ec
# ./hi
hello!

And yes, it even supports TCP/IP with it’s own TCP/IP stack.  It can even operate as a router of all things!  From a users point of view it is a little sparse, but it’s 4.3BSD, and thankfully includes the C compiler, so unlike of UNIX of the era on ‘small hardware’ this one isn’t crippled.

configuring TCP/IP

TCP/IP is configured through the MacOS via the control panel.  As you can see it can use AppleTalk, Ethernet and TokenRing interfaces.  For my simplicity, I’m just using SLiRP on the Ethernet, so it’s the old 10.0.2.15/24 setup.  I re-compiled my BasiliskIII to redirect a port into the VM so I can telnet into it.

To install System 7.0.1 you need to set Basilisk II / Cockatrice III as a IIci. I went ahead and used this ROM.  The ROM however does expect there to be a FPU.

rom Mac-IIci.ROM
modelid 5
cpu 2
fpu true

Running however, I’ve been able to set the CPU to 3 or 4 (68030/68040) and it’s fine, I think the major thing is the modelid.  If I try this under System 8 which needs a 68040, then it’ll crash in spectacular ways.  You don’t need MacTCP as again MachTen is a 4.3BSD kernel with Mach 2.5, so it has it’s own.

MachTen also includes support for NFS!  This greatly eases getting data in & out of the system.  To mount my Synology I just need the following command:

mount -t nfs -o timeo=1,retry=1,rsize=512,wsize=512,retrans=1 192.168.1.3:/volume1/Data /mnt/data

And I’m good to go!

17 thoughts on “MachTen 2.2

    • I found that one, however it seems to be more so for the PowerPC version. I contacted their sales to see if the 68k version is still availble, but they were pushing me to PowerPC.. I guess we’ll have to wait and see.

  1. 2.3 was the last 68k version released, and for OS 8 support there’s a 2.4 patch which is just a new kernel. (This is all at the garden, look for “Professional MachTen” which is the 68k version, “Power” was for PPC).

    One of the coolest parts of 68k MachTen (and which wasn’t implemented for PPC) is that when you do have an MMU, it hijacks the Mac memory manager to implement real memory protection and VM/paging! This has the funny side effect that you can’t quit MachTen once it’s launched–a quit requires a restart because there’s no other way to restore the Mac memory manager.

    Unfortunately I haven’t found any collection of more recent 3rd party/open source software built for 68k MachTen like there is for A/UX. It’s a shame, as it’s far easier to set up and with much better HW compatibility than A/UX.

    • You can always try building some yourself, its not as hard as most people feel, thanks to autoconfigure.

      the things you are going to hit as a limitation is the C compiler is ancient. GCC 1.40 is old. Very old. I don’t know if they made changes to it, but I suspect Tenon has lost all their source by now, and all they have left is a mountain of the PPC CD’s. I emailed them to ask some questions, and the only reply I got was telling me to buy the PowerPC CD, which isn’t what I wanted in the first place.

      I had built an IRC client, but the whole thing explodes, just as pasting through putty, I suspect it can’t handle “fast” networks, as I can do simple and interactive stuff just fine.

      And of course this is 4.3BSD, I suspect it would be 4.3BSD Tahoe. While that source is available, it is from 1988, or perhaps it incorporates more from RENO, but I haven’t really dived deep enough.

  2. i just discovered MachTen and it looks really cool! I’ve been trying to set it up in Cockatrice and Basiliks to no avail. It bombs in an unimplemented trap, guess it needs a patch I can’t find.

    Would you care sharing your disk to see MachTen working?

    • I have a secret file here, although you have to read the 404 error for the username and password.

      I tried with an OS X build and it’ll come up just fine. Of course serving stuff like gopher however broke it’s back. I’m guessing that since it crushed on my LC it probably is more so a MachTen fault.

      • On Basilisk and Cockatrice Machten bombs when virtual memory is enabled under the MachTen Controls memory settings in the Control Panel. Try disabling the virtual memory.

        Machten on 68k uses the mmu to provide memory protection (unlike the ppc version).

        On

          • Early Basilisk as used in Cockatrice supposedly supported using the native 68k cpu on NetBSD and Amiga hosts. It would be interesting for MachTen and NetBSD on NetBSD as an experiment (if possible with the relocated memory map in native mode). I’ve never seen a native mode cpu build for the Amiga, but one would be a good test because the NetBSD version seems to have some issues. I’m not familiar enough with the Amiga to do a build there.
            The only working reports I’ve seen are for NetBSD 1.4 that lacked kernel pthreads and couldn’t do networking as a result according to the INSTALL notes from around Basilisk 0.8 in 2000 (https://github.com/cebix/macemu/blob/master/BasiliskII/INSTALL). NetBSD 2.0 added kernel pthreads, but I don’t think Basilisk ever added support for them and Basilisk does not want to build there in native mode. I can send you the details if you’re interested. I’d like to see the capabilities and limits of native mode sometime. It’s just one of those mythical setups that would be neat to stress test.

          • I remember this being such a ‘big deal’ and this is of course where products like VMware really pulled ahead on the 386 as it turns out a chip that supports virtualisation made emulating privileged mode instructions much more easier than the 68k stuff. It’s amazing just how forward thinking the 80386 was! And of course Intel never hit that brick wall (well it seems it’s finally happened as they still haven’t cracked 10nm) and they just kept getting faster and faster first to 100Mhz, then 500Mhz and onward to 1Ghz and beyond.

            It’d probably be better to look at WinUAE/Previous/Hatari for that 68k core as it runs MMU code just fine(ish) and try to figure out how/why Basilisk patches the ROMs and uses invalid instructions to get it to do stuff.

            It’s so annoying how people that lifted the UAE cpu core never mentioned where they got it from, what version/level so at least diffing would be a lot easier. Mame took it from System16 which in turn used a generated version that they didn’t include the generation code… Although I did manage (somehow?!) to get that swapped to using Musashi.

          • I see that the developer of Hatari has confirmed that a number of NetBSD versions boot successfully and provided detailed instructions https://hatari.tuxfamily.org/doc/m68k-netbsd.txt.

            I like winuae, but this avoids having to use wine and is a nice simple way to setup a typical constrained 68k machine from the period when emulating a Falcon.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.