Coherent vs IDE controllers…

Since there has been some buzz on Coherent, I thought I’d see what the state of emulation is in 2015.. .While Qemu 1.2.0 can install Coherent, the hard disk access is incredibly slow.  Luckily for me, I was basically stuck on hold, and bouncing between tasks so the four hour long install didn’t seem so bad.

So for anyone who wants a pre-installed disk image, here you go!  It’s installed on a 500MB disk image, with the geometry CHS=1015/16/63

Unimplemented transfer 0x31 on Bochs.
Unimplemented transfer 0x31 on Bochs.

The first thing I tried to do was to get it to run on Bochs.  This was somewhat as easy as mounting the disk, and setting the hard disk to bootable in the Bochs setup program. Coherent boots up, and then starts to print errors that it’s unable to write to the disk.

write cmd 0x31 (WRITE SECTORS NO RETRY) not supported

So, the CPU seems to work, but without the ability to write to the disk, it isn’t too useful.

Next I tried PCem, and I got this error from both the 386DX and 486DX:

PCem in
PCem Spurious GP Fault on iret to Ring 3.

Which is a shame, as I thought that PCem would probably handle any sensitive timing issues the best.

Next up, I tried VMware Player.

Failure on VMware Player
Failure on VMware Player

Which had issues with the hard disk.

Next I thought MESS may actually be able to run it.

First step is the convert the flat disk image into a CHD:

D:\mess>chdman createhd -i \qemu\bochs-flat.img -o coherent.chd -chs 1015,16,63 -c none -f
chdman – MAME Compressed Hunks of Data (CHD) manager 0.153 (Apr 7 2014)
Output CHD: coherent.chd
Input file: \qemu\bochs-flat.img
Compression: none
Cylinders: 1015
Heads: 16
Sectors: 63
Bytes/sector: 512
Sectors/hunk: 8
Logical size: 523,837,440
Compression complete … final ratio = 14.6%

And then to run MESS:

mess64 -window at386 -ramsize 8388608 -harddisk1 coherent.chd

Stalling on MESS
Stalling on MESS

It boots, it seemingly doesn’t crash, but it just hangs there.  I assume it’s also plagued by the insanely slow hard disk access that Qemu struggles with.

And finally I thought I’d give Virtual PC 2004 a shot. I converted my raw disk image to a VHD, and fired it up (nested on Windows XP on VMware Player)

qemu-img.exe convert -f raw -O vpc bochs-flat.img coherent.vhd

And shockingly it slams the CPU and acts like it wanted to boot:

Coherent on Virtual PC
Coherent on Virtual PC

I don’t know if this counts for close.  But this is the current state of emulation.

So it’s great that there is source, although it looks like it’s several internal branches of the PC branch (the source only mentions the PDP11, 68000 and Z8001 ports in libc), but there is a bunch of RCS files.  Its more so a matter of going through all of that to parse out project tree’s and see which ones are newer.  Not all parts have RCS files though, the userland is just a straight source dump.

I’d suspect the only viable way to get this running on modern emulation is to really get it either cross compiling, which means building it’s toolchain, and trying to build a new kernel or finding old enough hardware to build on.  I can’t even begin to imagine trying to use a compiler on a disk that functions at 1kb/sec.

*** UPDATE ***

Well I thought I’d go ahead and try a newer version of Qemu for Windows, namely the 20141210 build, and here we go!

Success! Qemu 2.2.50 running Coherent
Success! Qemu 2.2.50 running Coherent

It takes about a minute to boot up, as it’ll run an aggressive (and silent) fsck.  I can only assume it scans the entire volume as I don’t see why it takes so long.  I also didn’t try to do anything special, just a guess on how to ‘tweak’ Qemu to be more friendly…

qemu-system-i386w.exe -cpu 486 -m 8 -hda bochs-flat.img

Although I don’t know if you need to reduce the CPU or limit the RAM (remember Coherent can’t swap!).

I need to test some more, as I managed to corrupt the disk editing some files, but I think you need the fsck @ boottime, and need to cleanly shutdown with a:

shutdown halt 0

Maybe now is a good time to read that manual.

Fun with Kerbal Space Program

So right before Christmas there was a new drop of KSP (Kerbal Space Program), and I’ve been playing it on/off again.  One thing that I’ve been amazed about is all of the pluggins.  One that caught my eye was KSPSerialIO, and it’s project page.  It’s mainly focused on using an Arduino based display/control system connected via a serial port.

So I thought I’d make some minor modification so I could talk to it locally.

KSPSerialIO data collection
KSPSerialIO data collection

KSP is a Unity3D program, which is very modular, and using C# you can write pluggin DLLs.  However Unity doesn’t use the native .NET framework on Windows, instead it uses Mono.  So things like named pipes, and message queues are out of the question.  However I was able to find netmq, a zeromq port in C#. Using a special branch (until it’s been mainlined) It will even work with Unity 3D/Mono as they are dependent on being .NET 3.5 compatible (not 2.0 or 4.0!)

So what do I have now?  A server program that the KSP pluggin can communicate with.  Right now it’s just telemetry data being sent to a console.  The next step is to send some commands back (blink the lights or something useful), and then see if I can get it tied into some named pipe so that any program that can open a file can control the craft.

Of course this uses floating point, so I’m going to have to see about how to deal with a binary representation of a float in C# to anything else.

A few minor tips.  First is that KSP takes a long time to load, and when you are crashing out, or constantly having to re-load to insert new versions of your DLL, it’s a real pain to be waiting the 2-3 minutes for it to load.  I found this plugin, ActiveTextureManagement, which compresses the textures.  Now it took me a good 20 minutes for my machine to do this, but once it was done it cut load time to around a minute and a half!

Another great thing to have is a RAM disk (well that, fast CPU/GPU, and plenty of RAM), so I used Softperfect’s RAM Disk. Steam doesn’t mind you copying a game off of disk, and running it off another disk.  I found this combination of a RAM disk + compressing the textures got me to loading in under a minute!

Although once KSP is loaded it’s in memory so most people probably won’t benefit much from it, but if you are constantly loading/unloading it greatly helps! (it feels a bit like experimenting with config.sys/autoexec.bat of the old days, and the difference even smartdrv could make).


So I’ve been playing with some C# in trying to mess with other stuff in some insane fun.  Anyways I was getting this weird compiler error trying to build my c# components:

warning CS1685: The predefined type ‘System.Func’ is defined in multiple
assemblies in the global alias; using definition from

Well that is strange.  Everything still worked, but I was getting screens full of this crap, so I was missing anything that didn’t build correctly from the CLI, so I had to find the source.  I found this nice tip, by adding the following into the source, and compile again.

System.Runtime.CompilerServices.ExtensionAttribute x = null;

And running the compiler (yet again), I got this:

c.cs(17,33): error CS0433: The type
‘System.Runtime.CompilerServices.ExtensionAttribute’ exists in both
‘d:\proj\\b\System.Core.dll’ and
System.Core.dll: (Location of symbol related to previous error)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll: (Location of symbol
related to previous error)

What is this? There is a System.Core.dll in my work area?

11/05/2010  09:53 AM           667,648 System.Core.dll

Sure enough, there it is.  I don’t know why it’s there, I don’t remember putting it there.  Even though I wasn’t directly referencing it, for some reason it was getting pulled in.

D:\proj\\b>c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc c.cs /r:netm
Microsoft (R) Visual C# Compiler version 4.0.30319.18408
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

c.cs(17,52): warning CS0219: The variable ‘x’ is assigned but its value is never

Now I can delete the added line, and I’ll get a silent compile.


Coherent sources released under a 3-clause BSD license

Print ad for Coherent

For those of you who’ve been living under a rock, or just not that familiar with what Coherent is, it’s a clean room re-implementation of version 7 Unix. What is unique about Coherent is that AT&T sent a team, which included Dennis Ritchie to evaluate the source to make sure that they hadn’t stolen Unix, and they concluded:

“that looking at various corners I couldn’t find anything that was copied.”

So Coherent was free to continue to sell their discount Unix like OS for the bargain price of $99 USD. I had plans on buying a copy as the older versions even supported the 8086, and 80286 however by the time I finally got enough RAM and disk space to make the purchase worth while, Linux was freely available. I believe that Coherent was the first OS to be killed by the Linux juggernaut, followed by SCO Xenix.

So it’s a little late to the party, open sourcing may have helped back in the early 1990’s although it’d seem like an utterly crazy move at the time.
Better late than never, this includes source dumps, and some RCS data, along with random tgz’s and a binary distribution of version 4. Without any doubt this will either help emulators better emulate the machine state Coherent expects, or perhaps fixing Coherent to run on more modern machines.

Coherent was also famous for it’s large, and well documented manual. Luckily the sources to the manual are also available.

So without further ado, here is the pages with the sources to coherent.

On final note of interest is that the Mark Williams Company was founded by Robert Swartz, who’s son Aaron was quite influential until the time of his death.

Stupid error building binutils

So I’m starting a new VM, and after installing Debian, and the important packages, build-essential and the Linux headers…

#  apt-get install build-essential linux-headers-$(uname -r)

I got this fine error trying to build binutils:

gcc -g -O2 -o sysinfo sysinfo.o syslex.o
syslex.o: In function `main’:
/usr/src/binutils-build/syslex.c:1: multiple definition of `main’
sysinfo.o:/usr/src/binutils-2.22-human68k/sysinfo.c:1: first defined here
collect2: ld returned 1 exit status

Turns out I didn’t have bison/flex installed.  Oops!

Oh well easy enough to solve.

#apt-get install bison flex

Otherwise, remember to build binutils/gcc in it’s own directory or that’ll cause other fun down the line.

Don’t forget you need GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+ to build GCC…

#  apt-get install libgmp-dev libmpfr-dev libmpc-dev


Well ever since Oracle managed to screw up Java into a mass of uselessness, it looks like javascript is going to save the day.

Yes that javascript.

That emscripten compiler now can build DOSBox.  Thats right, you can run DOSBox in your browser.  For more infomation check out EMDOSBox.

It works great with Chrome.


Check out this site, which has many games all configured.

I’ll have to convert out all my old stuff, which is just as well since java is effectively dead.