On the trail of PCC for the 8086

While on discord the topic came up of why there is no good/free C compiler for MS-DOS. Oh sure there is OpenWatcom but the 2 heavy hitters of the era, Microsoft C & Borland C are not open in the slightest.

There is DeSmet C, although it’s source is full of unnamed structs meaning that building it with anything sane would require a ‘lot of work ™’ which of course is not what I’m all that about. Instead, I remembered a directory up on TUHS /Applications/Portable_CC with a zip file 8086.zip Although this is a zip file, you’ll want to unzip on something Unix-y as there is a lot of case duplicate files. That said this is a PCC port to the 8086, which includes a libc, 8087 support, and is all expected to be built on a VAX-11/780 running 4.1BSD. Now this ended up being a stumbling block because I tried a *LOT* of things thinking that they were upwards compatible with 4.1, and the answer is USE 4.1!

So to effectively get going you’ll need a SIMH VAX780 and just follow my old steps on Installing 4.1BSD. As far as the zip file, I used Linux but had to create a tar file specifying the Unix v7 format with:

tar --format=v7 -cf pcc.tar .

And of course, convert the tar file to a simh tap file. Or if you are like me, just download a tap file here: PCC-Machines.tap.bz2.

With that said it’s a very strange setup as it relies on the 4.1BSD Vax environment so much that there is assembly injected into the linker.

asm("movc3 r8,(r11),(r7)");

So this will not cleanly run. Just as it depends on many system a.out specifics on building for MS-DOS. It’s not so much a MS-DOS tool chain, rather it outputs to vax a.out and uses a slightly modified vax linker. The MS-DOS magic happens in the conversion of the final a.out into a com file.

That is right it’s a VAX specific cross compiler that only build’s COM files.

I’ve managed to build some trivial stuff, and they work. Sadly my attempt at building that InfoTaskforce of ’87 failed.

I haven’t dug that much further into the linker although I have to wonder if a GNU cross linker to make a.out could make something that the conversion program would be happy with. The assembler of course doesn’t work, perhaps it’s something with packing structs?

As always, the simple stuff looks trivial but it was a fair bit involved.

Since there is no real ‘cc’ it’s a script but the vauge steps are:

/lib/cpp -I/usr/src/pcc/Machines/8086/lib86/include hi.c hi.i
/usr/src/pcc/Machines/8086/c86/c86 < hi.i > hi.a86
/usr/src/pcc/Machines/8086/a86/a86 hi
/usr/src/pcc/Machines/8086/a86/ld86 -X -N -r -o hi.out /usr/src/pcc/Machines/8086/lib86/crt0.b hi.b /usr/src/pcc/Machines/8086/lib86/libc.a 
/usr/src/pcc/Machines/8086/a86/cvt86 hi.out hi.com

It kind of makes sense.

Seems like somehow a lost opportunity in of itself back in the day

Research UNIX v8

    v8 on SIMH

So what the heck is Research UNIX v8?  Or even what is Research UNIX?  Well a query against utzoo gave me this answer:

>I've seen people that use System V and the like refer to their Unix as
>"tenth edition" or "ninth edition", or whatever. I've always seen things as
>"System V release n", or whatever. Anyone know the difference between these
>different naming schemes ?

There are actually three designations: Versions, Editions, and
System/Releases. The proper names of the first six Unixen were
"The #th Edition". Colloquially, people called them "Version #".
The Version Sixth Edition split off several variations, one of which
became Version Seven (the Seventh Edition) and sired BSD. From
several others, System III was born, and later named System V.
Tacked onto this name were Release numbers and yes, Versions.
So you will see things line SVr3v2.

The Eighth, Ninth, and Tenth Editions seldom left Bell Labs
and are also referred to as "Research UNIX". Another system
(not UNIX) they are playing with is called "Plan 9". Every so
often, a feature, such as STREAMS, finds its way into System V.

In some ways, Research UNIX is closer to BSD than to System V.

In short, UNIX began it’s life as a research project.  Until recently versions 1-6 & 32v were available to the public.  However the later versions, 8,9,10 were not.  However thanks to the work over at TUHS it’s available for non commercial use:

Alcatel-Lucent USA Inc has permitted usage saying "will not assert its
copyright rights with respect to any non-commercial copying, distribution,
performance, display or creation of derivative works of 
Research Unix®1 Editions 8,9, and 10."

So awesome!

The version of Research v8 is split onto 2 tape images, one for the graphical terminals, and the other for the OS install onto the VAX.  The distribution is not suitable for any standalone operation, and requires a previously installed 4.1BSD machine, with a second disk to install v8 onto.  Part of the installation requires you to compile your own kernel.  I ran into a bit of problems as it’s not a 100% process, but after referencing this guide from David du Colombier, I had the system up and running.  Naturally reading the installation manual helped a great deal too.

As always there is strange artifacts left in the backup, such as this scoreboard from rogue:

Top Ten Rogueists:
Rank Score Name
1 5545 Rog-O-Matic XIII for mjs: quit on level 17.
2 5043 ken: killed on level 23 by a dragon.
3 3858 zip: killed on level 16 by an invisible stalker.
4 3249 Rog-O-Matic VII: killed on level 16 by an invisible stalker.
5 2226 Rog-O-Matic VII: killed on level 13 by a troll.
6 2172 St. Jude: killed on level 13 by a troll.
7 1660 Rog-O-Matic VII: quit on level 11.
8 1632 Chipmunk the Jello: killed on level 10 by a centaur.
9 844 Rog-O-Matic VII: quit on level 5.
10 401 Rog-O-Matic VII: killed on level 4 by a snake.

Does this mean Ken Thompson was an avid rogue fan?  Perhaps.  Naturally I quickly compiled the v100 version of aclock, and had it running.

aclock on v8

I’ll have to edit this and more and more as I find out, but I’ve been busy in real life, and of course I know that in addition to v8, there is also v9 & v10 to tackle.

As always, if you want you can download my pre-installed from my site : researchv8.7z

You will have to bring your own copy of the SIMH VAX-11/780 simulator.  As of 31/3/2017 ther is issues with the github version of SIMH, and you will have issues with the disks on the VAX.  You need to disable the async with a simple set command in your ini file:

set noasync

And you should now be good to go!  As always you’ll have to battle the 404 page for the correct link and the username & password.

sorry.