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 .
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.
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