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

One thought on “On the trail of PCC for the 8086

  1. The Gunkies page on 4.1BSD could use some updating.

    “The release would have been called 5BSD, but after objections from AT&T the name was changed; AT&T feared confusion with AT&T’s UNIX System V.”
    There’s an alternate explanation that says the CSRG DARPA contract paperwork says 4BSD on it so they stuck with 4BSD rather than having to redo the contracts.

    “4.1 BSD, June 1981 4BSD was upgraded to include…”
    Except 4.1BSD was released on May 20, 1981.

    “The bootblock programs do not run under SIMH using the 4.0 BSD strategy”
    Time passed and it is not necessary to use tape-swapping to boot 4.1BSD.
    See TUHS UnixArchive/Distributions/UCB/4.1BSD-19810901-reconstructed/README “boots just fine following the boot procedure
    exactly as described in the official 4.1BSD setup document.”

    The CSRG ISO 4.1c2 is older than their 4.1c1

    On the CSRG ISO, the ages from oldest to newest: 4.1a, 4.1.snap, 4.1c2, 4.1c1.

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.