<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cross compiler &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/cross-compiler/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Mon, 20 Apr 2026 19:36:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Fun with POSX subsystem on NT</title>
		<link>https://virtuallyfun.com/2026/04/19/fun-with-posx-subsystem-on-nt/</link>
					<comments>https://virtuallyfun.com/2026/04/19/fun-with-posx-subsystem-on-nt/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 19 Apr 2026 08:45:33 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=15686</guid>

					<description><![CDATA[Well this is going to be a seemingly pointless post but you know I love stuff like this. I&#8217;d already gotten GCC 1.40 to run on the Windows NT 1991December Pre-Release, but that&#8217;s all Win32, what about the much vaunted &#8230; <a href="https://virtuallyfun.com/2026/04/19/fun-with-posx-subsystem-on-nt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Well this is going to be a seemingly pointless post but you know I love stuff like this.  I&#8217;d already gotten GCC 1.40 to run on the Windows NT 1991December Pre-Release, but that&#8217;s all Win32, what about the much vaunted POSIX subsystem?</p>



<p class="wp-block-paragraph">Well what is it?  Basically it&#8217;s just enough of the UNIX/POSIX standard to check a box that gave Windows NT an in for US Government contracts that required a POSIX checkbox.  And nothing else more.  It&#8217;s basically agreed that it&#8217;s just enough to run &#8216;vi&#8217; and that&#8217;s basically it.</p>



<p class="wp-block-paragraph">But surely we can probably do more with this?</p>



<p class="wp-block-paragraph">The first fun part is that setting up the environment is basically <strong>UNDOCUMENTED</strong>. It was a nightmare back. then, as you need to setup a termcap environment that again is not mentioned.  The only hint is is an old KB article <a href="https://jeffpar.github.io/kbarchive/kb/108/Q108581/">Q108581</a>, which sets out the vauge guide.  I do know that back in the day I did have vi running, but I can&#8217;t remember how I did it exactly but wow.</p>


<div class="wp-block-image">
<figure class="alignleft size-full"><a href="https://archive.org/details/win32-sdk-final-release-nt-31" target="_blank" rel=" noreferrer noopener"><img decoding="async" width="180" height="180" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-10.png" alt="" class="wp-image-15687" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-10.png 180w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-10-150x150.png 150w" sizes="(max-width: 180px) 100vw, 180px" /></a></figure>
</div>


<p class="wp-block-paragraph">The first thing you need to do, naturally is install Windows NT 3.1. I did have access to this fun CD back in the day, it&#8217;s a combination <a href="https://archive.org/details/win32-sdk-final-release-nt-31" target="_blank" rel="noreferrer noopener">Windows NT 3.1 Workstation +SDK CD-ROM</a>.  This way you not only get the operating system, but you also now have the C compiler, libraries and headers.  Once setup, there is even a POSIX sample program.  Great?  Well, no.  Because this doesn&#8217;t include the OS environment, there is no previous &#8216;vi&#8217; either. Very sad.  Naturally you need another CD to install, which of course back in the day if you were going to use or support Windows NT, you&#8217;d naturally run out or order the <a href="https://archive.org/details/mswinntrskt310_20190128" target="_blank" rel="noreferrer noopener">Windows NT Resource Kit</a>.  These were absolutely required back in the day as the &#8216;task manager&#8217; only at best would show you named windows, it doesn&#8217;t show you the actual processes, making managing NT a nightmare without pviewer. (process viewer), among others.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="408" height="308" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-11.png" alt="" class="wp-image-15688" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-11.png 408w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-11-300x226.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-11-397x300.png 397w" sizes="(max-width: 408px) 100vw, 408px" /><figcaption class="wp-element-caption">Windows NT Task List</figcaption></figure>
</div>


<p class="wp-block-paragraph">On the Resource Kit is not only a tiny &#8216;userland&#8217; but also it includes Elvis a vi clone, along with a much needed &#8216;cc&#8217; wrapper that will let you invoke the SDK C compiler as if it&#8217;s the Unix cc C compiler command.</p>



<p class="wp-block-paragraph">Elvis was written by Steve Kirkendall, back in the day, and even on Linux back in the day, I was using Elvis as well.  Remember &#8216;real&#8217; vi was tied to needing a 32v / BSD source license so it wasn&#8217;t free. </p>



<pre class="wp-block-code"><code>/* Author:
 *      Steve Kirkendall
 *      14407 SW Teal Blvd. #C
 *      Beaverton, OR 97005
 *      kirkenda@cs.pdx.edu
 */</code></pre>



<p class="wp-block-paragraph">It&#8217;s just how things were back then.</p>



<p class="wp-block-paragraph">To make things weird, I installed Windows NT onto a HPFS partition, because I wanted long file names, but I didn&#8217;t want to have a case preserving filesystem, as these old things have so much UPPERCASE/lowercase naming conflicts, because YES as a feature of NTFS &amp; POSIX it really does support Mixed case naming.  And I don&#8217;t feel like dealing with it, and it&#8217;s 1993, and HPFS is still a popular filesystem for us OS/2 users.</p>



<p class="wp-block-paragraph">Okay, so you&#8217;ve installed both the SDK &amp; the resource kit, surely you can just run vi?</p>



<figure class="wp-block-image size-full"><img decoding="async" width="452" height="174" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-13.png" alt="" class="wp-image-15690" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-13.png 452w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-13-300x115.png 300w" sizes="(max-width: 452px) 100vw, 452px" /></figure>



<p class="wp-block-paragraph">No. No you cannot. Remember you need that TERM variable and termcap library!</p>



<p class="wp-block-paragraph">Now to save you the hassle you&#8217;ll go back and check Q108581 and you&#8217;ll see this example:</p>



<pre class="wp-block-code"><code>li|ansi|psx_ansi|:\ 

            :co#80:li#25:\ 
            :am:pt:ms:bw:\ 
            :cl=\E&#91;2J:cm=\E&#91;%i%d;%dH:ce=\E&#91;K:cd=\E&#91;J:\ 
            :sf=\E&#91;S:sr=\E&#91;T:\ 
             :ho=\E&#91;H:sc=\E&#91;s:rc=\E&#91;u:up=\E&#91;A:d=^J:nd=\E&#91;C:le=^H:\ 
             :ku=\E&#91;A:kd=\E&#91;V:kr=\E&#91;C:kl=\E&#91;D:kb=^H:\ 
             :so=\E&#91;7m:se=\E&#91;m:mr=\E&#91;7m:me=\E&#91;0m:\ </code></pre>



<p class="wp-block-paragraph">copy paste and and, yeah IT DOESNT WORK.  Like something being passed endlessly through a photocopier, it got mangled in usenet (maybe where I found it?) , and yeah you need to &#8216;fix&#8217; it up as it should look more like this.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="553" height="284" src="https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.21.16-AM.png" alt="" class="wp-image-15691" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.21.16-AM.png 553w, https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.21.16-AM-300x154.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.21.16-AM-500x257.png 500w" sizes="auto, (max-width: 553px) 100vw, 553px" /></figure>
</div>


<p class="wp-block-paragraph">Or for anyone hoping to copy/paste:</p>



<pre class="wp-block-code"><code>li|ansi|psx_ansi|:\
	:co#80:li#25:\
	:am:pt:ms:bw:\
	:cl=\E&#91;2J:cm=\E&#91;%i%d;%dH:ce=\E&#91;K:cd=\E&#91;J:\
	:sf=\E&#91;S:sr=\E&#91;T:\
	:ho=\E&#91;H:sc=\E&#91;s:rc=\E&#91;u:up=\E&#91;A:d=^J:nd=\E&#91;C:le=^H:\
	:ku=\E&#91;A:kd=\E&#91;V:kr=\E&#91;C:kl=\E&#91;D:kb=^H:bc=^H:\
	:so=\E&#91;7m:se=\E&#91;m:mr=\E&#91;7m:me=\E&#91;0m:\</code></pre>



<p class="wp-block-paragraph">Note that the leading &#8216;tab&#8217; actually matters and there should be NO empty spaces at the tail backslash!  If that tab or ending \ is padded or wrong it just plain will not work.  I wasted so much time before realizing the craziness of this setup.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Thinking that&#8217;s enough you have to keep reading, as the POSIX environment has no idea what c: is, or how to set variables, so you need to specify the full NT path, not the Win32 path</p>



<p class="wp-block-paragraph">To save the adventure some time this is what I end up just putting into a CMD file so I can just click and go!</p>



<pre class="wp-block-code"><code>@stitle posix
@set PATH=c:\bin;%PATH%
@set Lib=c:\mstools\posix\lib;%lib%
@set Include=c:\mstools\posix\h;%include%
@set TERM=ansi
@set TERMCAP=//C/etc/termcap
@set _POSIX_TERM=on
@set TEMP=
@set tmp=
@set INCLUDE=
@set include=
@set lib=/usr/lib
@set tmp=//C/tmp
@set temp=//C/temp
@set MAKEPATH=//C/posix/src/MK-RULES
@cls
@sh</code></pre>



<p class="wp-block-paragraph">Now with a corrected environment for POSIX and a termcap file, now we can actually run VI/Elvis!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="633" height="327" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-14.png" alt="" class="wp-image-15692" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-14.png 633w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-14-300x155.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-14-500x258.png 500w" sizes="auto, (max-width: 633px) 100vw, 633px" /><figcaption class="wp-element-caption">Elvis running correctly on the POSIX subsystem</figcaption></figure>



<p class="wp-block-paragraph">This is what success looks like!</p>



<p class="wp-block-paragraph">Now I know what you&#8217;re thinking okay, were setup now, we can just build something simple like say a hello world style program right?  I made a simple Makefile, and let&#8217;s go ahead and try to invoke the &#8216;cc&#8217; compiler wrapper:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="634" height="331" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-15.png" alt="" class="wp-image-15693" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-15.png 634w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-15-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-15-500x261.png 500w" sizes="auto, (max-width: 634px) 100vw, 634px" /></figure>



<p class="wp-block-paragraph">And it just hangs, doing nothing.  As it turns out that the &#8216;cc&#8217; wrapper uses a file for IPC to talk between POSIX &amp; WIN32.  Remember they are separate personalities on the NTOKS kernel, and they cannot directly communicate with eachother.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="474" height="355" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-16.png" alt="" class="wp-image-15694" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-16.png 474w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-16-300x225.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-16-401x300.png 401w" sizes="auto, (max-width: 474px) 100vw, 474px" /></figure>
</div>


<p class="wp-block-paragraph">I don&#8217;t know why they didn&#8217;t use a named pipe, maybe POSIX cannot write to them?  Maybe when they were writing the POSIX subsystem, named pipes weren&#8217;t working yet?  It&#8217;s hard to say, and the early NT 3.1 pre-releases don&#8217;t included the POSIX, or OS/2 subsystem.  Actually they don&#8217;t even have the NTVDM/MS-DOS/WoW either.</p>



<p class="wp-block-paragraph">So you need to run something called &#8216;devsrv&#8217; which is a Win32 program that looks for c:\tmp\ for devsem.ini file telling it what Win32 program to run and how.  For example, in this case it looks like this:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="585" height="327" src="https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.36.08-AM.png" alt="" class="wp-image-15696" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.36.08-AM.png 585w, https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.36.08-AM-300x168.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/Screenshot-2026-04-19-at-8.36.08-AM-500x279.png 500w" sizes="auto, (max-width: 585px) 100vw, 585px" /></figure>



<p class="wp-block-paragraph">Now if you think you can just blindly run devrv, you&#8217;ll 99% of the time be in for a bad time as you need to initialize a working Win32-&gt;POSIX cross environment.  Me being, me I just put this into another CMD file:</p>



<pre class="wp-block-code"><code>title devsrv
@set PATH=c:\bin;c:\mstools\bin;%PATH%
@set Lib=c:\mstools\posix\lib;c:\usr\lib
@set Include=c:\mstools\posix\h;c:\usr\include
@set TEMP=c:\temp
@set tmp=c:\tmp
@c:\bin\devsrv</code></pre>



<p class="wp-block-paragraph">I&#8217;ve already started to place headers &amp; libraries into a more &#8216;UNIX&#8217; like path structure with /usr/include &amp; /usr/lib although by default the MSFT scripts expect things to live in the SDK world.  But I do have goals of running GCC and dealing with weird paths isn&#8217;t my goal as the less I have to fight, the better.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="628" height="460" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-18.png" alt="" class="wp-image-15697" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-18.png 628w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-18-300x220.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-18-410x300.png 410w" sizes="auto, (max-width: 628px) 100vw, 628px" /><figcaption class="wp-element-caption">Compiling &#8216;hi&#8217; from within the POSIX subsystem</figcaption></figure>



<p class="wp-block-paragraph">  Now with devsrv running it cannot call the C compiler, and the linker.  It will fail at first as it&#8217;s expecting to link against NTDLL.LIB as in the Pre-release/Beta days there was a &#8216;ntdll&#8217; you had to link against.  It isn&#8217;t there in the RTM Windows NT, so it&#8217;s kind of clear that although POSIX shipped it was basically abandonded during the development cycle, and nobody expected anyone to actually do anthying with it.  Or at best find the KB article and maybe run vi.</p>



<p class="wp-block-paragraph">Or you could just fix &amp; rebuild the linker proxy, ld.c and remove the offending line:</p>



<pre class="wp-block-code"><code>char *def_lib&#91;] = /* Default library */
{
   "libcpsx.lib",
   "psxdll.lib",
   "ntdll.lib",
   "psxrtl.lib",
   SNULL
};</code></pre>



<p class="wp-block-paragraph">And re-compile.  Which of course is time to show yet another CMD file that sets up a Win32 environment enough to cross compile to POSIX:</p>



<pre class="wp-block-code"><code>title posix cross
@set CPU=i386
@set PATH=c:\posix\bin;c:\mstools\bin;%PATH%
@set Lib=c:\mstools\posix\lib;c:\usr\lib;%lib%
@set Include=c:\mstools\posix\h;c:\usr\include;%include%
@set TERM=ansi
@set TERMCAP=//C/etc/termcap
@set _POSIX_TERM=on
@set TEMP=c:\temp
@set tmp=c:\tmp
@set MAKEPATH=C:\posix\src\MK-RULES</code></pre>



<p class="wp-block-paragraph">So now I can build things from the Win32 side of life, like the LD proxy, or even &#8216;cross compile&#8217; a simple enough hello world from Win32:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="628" height="267" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-19.png" alt="" class="wp-image-15698" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-19.png 628w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-19-300x128.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-19-500x213.png 500w" sizes="auto, (max-width: 628px) 100vw, 628px" /></figure>



<p class="wp-block-paragraph">See wasn&#8217;t that fun?!</p>



<p class="wp-block-paragraph">Since I already have a version of <a href="https://github.com/neozeed/gcc-1.40-msvc" target="_blank" rel="noreferrer noopener">GCC-1.40 building with the Microsoft C compiler</a> this seemed like a great leg up on building a POSIX version.  And naturally to make it more complete building bison-1.16 is also required.  Since I have Bison building on normal Win32, this wasn&#8217;t much of a problem.  The weird hurdle came in the C Preprocessor where I found out that POSIX is missing some seemingly vital stuff like fstat!  </p>



<pre class="wp-block-code"><code>int                 
file_size_and_mode (fd, mode_pointer, size_pointer)
     int fd;
     int *mode_pointer;
     long int *size_pointer;
{ 
#if 0
//this is missing from posix
  struct stat sbuf;
  
  if (fstat (fd, &amp;sbuf) &lt; 0) return (-1);
  if (mode_pointer) *mode_pointer = sbuf.st_mode;
  if (size_pointer) *size_pointer = sbuf.st_size;
#endif
  return 0;
}</code></pre>



<p class="wp-block-paragraph">Also, for some reason I can&#8217;t link any real programs that call unlink, I have to proxy that to a stub file that has no includes, define unlink as Xunlink, then link against that stube and it all links fine.  I know WTF?!  I don&#8217;t get it ether.  But I wanted to build stuff so these are&#8230; tradeoffs that I made to just short-cut the whole thing.  Maybe I&#8217;ll go back and look and try to figure it out.  As I see in the POSIX util source mutiple things call fstat, so maybe it&#8217;s happier when linked from Win32?</p>



<p class="wp-block-paragraph">To complete the round trip, since we already know the Link386 from the SDK and early Visual C++ will happily accept Xenix OMF files, I can use the <a href="https://github.com/neozeed/gas-1.38-xenix-" target="_blank" rel="noreferrer noopener">GNU Assembler that targets Xenix</a>, and then get a round tripped GCC on POSIX NT!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="638" height="336" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-23.png" alt="" class="wp-image-15702" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-23.png 638w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-23-300x158.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-23-500x263.png 500w" sizes="auto, (max-width: 638px) 100vw, 638px" /><figcaption class="wp-element-caption">GCC running on POSIX NT!</figcaption></figure>
</div>


<p class="wp-block-paragraph">And there we have it!</p>



<h2 class="wp-block-heading">Installing it for the BRAVE</h2>



<p class="wp-block-paragraph">I&#8217;ve gone ahead and uploaded my working directories to archive.org here: <a href="https://archive.org/details/posix-4" target="_blank" rel="noreferrer noopener">POSIX-4</a>.</p>



<p class="wp-block-paragraph">I guess I could have found my old zip/unzip for NT 3.1 but I didn&#8217;t I stuck to PAX which surprisingly is in NT 3.1. It&#8217;s not quite as friendly as TAR but you can copy posix4.tar to the C: drive and just extract it with &#8216;pax -r -f posix4.tar&#8217;</p>



<p class="wp-block-paragraph">I should note for some reason trying to extract it from my tranfer disk, causes a BLUESCREEN in the HPFS device driver on NT 3.1&#8230; Bummer.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="480" height="253" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-12.png" alt="" class="wp-image-15689" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-12.png 480w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-12-300x158.png 300w" sizes="auto, (max-width: 480px) 100vw, 480px" /><figcaption class="wp-element-caption">extracting my posix all in one package</figcaption></figure>
</div>


<p class="wp-block-paragraph">Once all the files are unpacked the first thing I do is make a Program Item on Program Manager for the Posix shell.  All the hard work is done, you just have to path it to c:\posix\shell.cmd</p>



<p class="wp-block-paragraph">This is how I setup mine, so YMMV</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="506" height="225" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-20.png" alt="" class="wp-image-15699" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-20.png 506w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-20-300x133.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-20-500x222.png 500w" sizes="auto, (max-width: 506px) 100vw, 506px" /><figcaption class="wp-element-caption">Shell Program Item</figcaption></figure>
</div>


<p class="wp-block-paragraph">And the last part is the DEVSRV.  This is how I setup mine, with the emphasis on running minimized.  It does and can crash from time to time so I wouldn&#8217;t try to wrap it as a service or anything that creative.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="473" height="205" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-21.png" alt="" class="wp-image-15700" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-21.png 473w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-21-300x130.png 300w" sizes="auto, (max-width: 473px) 100vw, 473px" /><figcaption class="wp-element-caption">DevSRV Program Item</figcaption></figure>
</div>


<p class="wp-block-paragraph">And then I move mine to the startup items, so that way, every time I login, I now have the devsrv all ready for my POSIX experiments!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="402" height="181" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-22.png" alt="" class="wp-image-15701" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-22.png 402w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-22-300x135.png 300w" sizes="auto, (max-width: 402px) 100vw, 402px" /></figure>
</div>


<p class="wp-block-paragraph">Now you can just logoff/log back in, and you are ready for some POSIX GCC adventures.</p>



<p class="wp-block-paragraph">It&#8217;s a shame that back then I just was totally unaware of that Xenix OMF GAS version.  I pretty much had given up on Xenix 386 back then, as I never could find the developer&#8217;s kit, as they had gatekept people off the platform.  Linux is where all the excitement was, as not only did it have GCC, but you also had full source.  Even if I&#8217;d had access to GCC on Xenix, with no libc no headers it wasn&#8217;t going to go very far.</p>



<p class="wp-block-paragraph">Credit to Microsoft though, they did learn with that $3,000 OS/2 SDK, that if you paywall the low end developers away, nobody writes for your platform.  Although Microsoft did lose their way on this when they stopped QuickC, forcing new users to pay for the full thing.  They didn&#8217;t realize how much territory they ceded by charging for the C compiler to GCC until it was too late, as all &#8216;starving university&#8217; kids are GNU kids now (Yes I know CLANG is where it&#8217;s at today, thats&#8217;s Apple&#8217;s lesson I guess in there).  By the time they did free as in beer limited &#8220;<a href="https://archive.org/details/microsoft-visual-c-toolkit-2003" target="_blank" rel="noreferrer noopener">Visual C++ Toolkit 2003</a>&#8221; it was already far too late.</p>



<p class="wp-block-paragraph">The POSIX subsystem was never going to be all that useful, as it was pretty clear if NT became a competent UNIX, nobody would write Win32 server software.  But considering one of the best features to be added to Windows 10/Server 2016 was the WSL subsystem, we already crossed that bridge.</p>



<h2 class="wp-block-heading">Addendum</h2>



<p class="wp-block-paragraph">I thought it&#8217;d be &#8216;fun&#8217; to do this from Citrix as it easily allows me to map drives making life MUCH easier, but nothing worked.  I went thorugh installing NT 3.5 it&#8217;s SDK and Visual C++ 2 and noticed that nothing ran on that either.  Maybe it&#8217;s Qemu?</p>



<p class="wp-block-paragraph">So I just jumped forward to NT 4.0, because why not??</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="455" height="171" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-24.png" alt="" class="wp-image-15705" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-24.png 455w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-24-300x113.png 300w" sizes="auto, (max-width: 455px) 100vw, 455px" /><figcaption class="wp-element-caption">make on NT 4.0 POSIX</figcaption></figure>



<p class="wp-block-paragraph">Turns out it doesn&#8217;t work either.</p>



<p class="wp-block-paragraph">Well sure vi does work, but the whole &#8216;cc&#8217; cross thing is just plain deprecated after 3.1&#8230; It&#8217;s like whatever attempt at POSIX being useable was fully given up on.  The only other interesting thing on the NT 3.5 resource kit, is that it <em>does</em> mention GCC being part of the kit, but obviously that never happened.  Politics I suppose.</p>



<p class="wp-block-paragraph">So now I really remember why I never really bothered with the environment, as it basically became unusable by Windows NT 3.5</p>



<h2 class="wp-block-heading">Running at home!</h2>



<p class="wp-block-paragraph">I&#8217;ve gone ahead, and uploaded the source to github, and included a binary release.  So you can try this on your own Windows NT 3.1 machine, or try the fight with NT 3.5 or higher and go through the fight yourself.</p>



<p class="wp-block-paragraph"><a href="https://github.com/neozeed/windowsnt31_posix" target="_blank" rel="noreferrer noopener">https://github.com/neozeed/windowsnt31_posix</a></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="634" height="473" src="https://virtuallyfun.com/wp-content/uploads/2026/04/image-25.png" alt="" class="wp-image-15708" srcset="https://virtuallyfun.com/wp-content/uploads/2026/04/image-25.png 634w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-25-300x224.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/04/image-25-402x300.png 402w" sizes="auto, (max-width: 634px) 100vw, 634px" /></figure>



<p class="wp-block-paragraph">And yes, I did get <a href="https://github.com/neozeed/hack-1.03" target="_blank" rel="noreferrer noopener">hack-1.03</a> running!</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2026/04/19/fun-with-posx-subsystem-on-nt/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Compiling Linux 0.11 using the December 1991 Windows NT Pre-release</title>
		<link>https://virtuallyfun.com/2024/08/02/compiling-linux-0-11-using-the-december-1991-windows-nt-pre-release/</link>
					<comments>https://virtuallyfun.com/2024/08/02/compiling-linux-0-11-using-the-december-1991-windows-nt-pre-release/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 02 Aug 2024 12:13:21 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14730</guid>

					<description><![CDATA[It&#8217;s no secret that I do enjoy building silly &#8220;what if&#8221; things. And this is going to be one of the more impractical ones. Building on previous work, where I had built GCC 1.40 using the OS/2 hosted Microsoft C &#8230; <a href="https://virtuallyfun.com/2024/08/02/compiling-linux-0-11-using-the-december-1991-windows-nt-pre-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">It&#8217;s no secret that I do enjoy building silly &#8220;what if&#8221; things.  And this is going to be one of the more impractical ones.</p>



<p class="wp-block-paragraph">Building on previous work, where <a href="https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/" target="_blank" rel="noreferrer noopener">I had built GCC 1.40 using the OS/2 hosted Microsoft C compiler</a> that shipped with this Pre-Release, and using <a href="https://virtuallyfun.com/2015/10/09/building-linux-0-11-on-windows-10/" target="_blank" rel="noreferrer noopener">MinGW to build Linux 0.11</a>, it was time to combine the two, like chocolate &amp; peanut butter!</p>



<figure class="wp-block-video"><video height="480" style="aspect-ratio: 854 / 480;" width="854" controls src="https://virtuallyfun.com/wp-content/uploads/2024/08/combo.mp4"></video><figcaption class="wp-element-caption">Yes, it&#8217;s from 1981.  I&#8217;m that old to remember this.</figcaption></figure>



<h2 class="wp-block-heading">Getting NT ready</h2>



<p class="wp-block-paragraph">The first thing I wanted was to install the Pre-Release onto a HPFS disk.  I&#8217;ve uploaded this over on <a href="https://archive.org/details/dec-1991-prepped.7z" target="_blank" rel="noreferrer noopener">archive.org (Windows NT December 1991 prepped for Qemu<span style="color: rgb(44, 44, 44); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space-collapse: collapse;"></span>)</a>.  I took the CD-ROM image, removed all the MIPS stuff, built a boot floppy, and setup the paths so that the floppy can boot onto the secondary hard disk to a &#8216;full&#8217; version of NT.  This lets me format the C: drive as HPFS, and then do a selective install of Windows NT to ensure that that the software tools (compiler) are installed.</p>



<p class="wp-block-paragraph">I use a specially patched vintage QEMU build, <a href="https://archive.org/download/dec-1991-prepped.7z/qemu-0.14.0.7z" target="_blank" rel="noreferrer noopener">qemu-0.14.0.7z</a> which kind of makes it &#8216;easier&#8217;, along with the needed disk images in <a href="https://archive.org/download/dec-1991-prepped.7z/dec-1991-prepped.7z">dec-1991-prepped.7z</a></p>



<pre class="wp-block-code"><code>qemu.exe -L pc-bios -m 64 -net none -hda nt1991.vmdk -hdb nt1991-cd.vmdk -fda boot.vfd -boot a</code></pre>



<p class="wp-block-paragraph">This will bring up the boot selection menu.  The default option is fine, you can just hit enter.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="432" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-01.png" alt="" class="wp-image-14732" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-01.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-01-300x180.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-01-500x300.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /><figcaption class="wp-element-caption">boot NT from D:</figcaption></figure>



<p class="wp-block-paragraph">NT will load up and you now have to login as the SYSTEM user.  We need the advanced permissions to format the hard disk.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-02.png" alt="" class="wp-image-14733" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-02.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-02-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-02-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">Login as &#8216;system&#8217;</figcaption></figure>



<p class="wp-block-paragraph">From the desktop we first format the C: drive as HPFS.  I made icons for all this stuff to try to make it as easy as possible.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-03.png" alt="" class="wp-image-14742" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-03.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-03-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-03-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">You&#8217;ll get asked to confirm you want to do this, and give the disk a creative name.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-04.png" alt="" class="wp-image-14741" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-04.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-04-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-04-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And with the disk formatted it&#8217;s time to start the setup process.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-05.png" alt="" class="wp-image-14740" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-05.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-05-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-05-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Who are you?</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-06.png" alt="" class="wp-image-14739" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-06.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-06-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-06-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And what slick account do you want?  It doesn&#8217;t matter tbh.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-07.png" alt="" class="wp-image-14738" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-07.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-07-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-07-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">I&#8217;m going to do a custom install as the NIC&#8217;s aren&#8217;t supported, and even if they were it&#8217;s just NetBEUI anyways.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-08.png" alt="" class="wp-image-14737" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-08.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-08-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-08-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And select your hardware platform.  NT basically only supports this config, so it doesn&#8217;t matter.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-09.png" alt="" class="wp-image-14736" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-09.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-09-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-09-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">The default target drive is our C drive, which we had just formatted to HPFS.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-10.png" alt="" class="wp-image-14735" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-10.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-10-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-10-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Next, I unchecked everything only leaving the MS Tools</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-11.png" alt="" class="wp-image-14734" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-11.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-11-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-11-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">It&#8217;ll offer the samples &amp; help files.  I always install them as I eventually need examples of stuff to steal, and to learn that including &lt;windows.h> won&#8217;t work right unless you manually define a -Di386 on the command line.  I&#8217;m saving you this pain right now up front.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-12.png" alt="" class="wp-image-14745" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-12.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-12-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-12-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Files will copy, and on a modern machine this takes seconds.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-13.png" alt="" class="wp-image-14744" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-13.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-13-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-13-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And there we go!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-14.png" alt="" class="wp-image-14743" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-14.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-14-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-14-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And Windows NT is installed.</p>



<p class="wp-block-paragraph">Yay.</p>



<p class="wp-block-paragraph">I put in a &#8216;CAD&#8217; feature in this Qemu hitting control+alt+d will send the familiar pattern, and after a few times NT will reboot.  We are pretty much done with NT for the moment, but congrats you&#8217;ve installed the December 1991 Pre-release onto a HPFS disk for those sweet long long file names!</p>



<h2 class="wp-block-heading">Going over the strategy:</h2>



<p class="wp-block-paragraph">I&#8217;ve already built GCC 1.40 for NT, so what is the rest of the stuff needed to build Linux?  It&#8217;s a quick checklist but here goes, in no specific order:</p>



<ul class="wp-block-list">
<li><s>GCC 1.40</s></li>



<li>bin86</li>



<li>binutils</li>



<li><s>gas 1.38</s></li>



<li>bison</li>



<li>unzip</li>



<li>zip</li>
</ul>



<p class="wp-block-paragraph">Luckily as part of building on Windows 10 using MinGW, I had fixed the weird file issues as MS-DOS/Windows NT/OS2 handle text/binary files, as we went through with how <a href="https://virtuallyfun.com/2024/04/28/compiling-ms-dos-4-0-from-dos-4-0-on-a-ps-2/" target="_blank" rel="noreferrer noopener">Github mangled MS-DOS 4.00</a>.</p>



<p class="wp-block-paragraph">The primary reason I wanted a working zip/unzip was to deal with long file names, and to auto convert text files.  And this ended up being an incredible waste of time trying to get the &#8216;old&#8217;s code on the Info-Zip page.</p>



<figure class="wp-block-image size-large"><a href="https://sourceforge.net/projects/infozip/files/UnZip%205.x%20and%20earlier/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="418" src="https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads-1024x418.jpg" alt="" class="wp-image-14748" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads-1024x418.jpg 1024w, https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads-300x123.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads-768x314.jpg 768w, https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads-500x204.jpg 500w, https://virtuallyfun.com/wp-content/uploads/2024/08/infozip-old-downloads.jpg 1119w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Info-Zip&#8217;s old downloads. Version 5 only!</figcaption></figure>



<p class="wp-block-paragraph">I&#8217;m sure like everything else, the old versions are removed as they probably suffer from some catastrophic security issue with overflows.  The issue I ran into is that the version 5 stuff uses so many features of shipping NT, to even 2000 that it was going to be a LOT of work to get this far.  The quicker &amp; easier path as always turned out to be a time machine.</p>



<p class="wp-block-paragraph">Thankfully, since I had made a copy of the UTZOO archives, I was able to fish out, both <a href="https://github.com/neozeed/Info-Zip-3.1" target="_blank" rel="noreferrer noopener">version 3.1</a> from the archives.  Also known as &#8220;Portable UnZIP 3.1&#8221;, parts <a href="https://altavista.superglobalmegacorp.com/usenet/b181/comp/sources/misc/1833.txt" target="_blank" rel="noreferrer noopener">1</a>/<a href="https://altavista.superglobalmegacorp.com/usenet/b181/comp/sources/misc/1834.txt" target="_blank" rel="noreferrer noopener">2</a>/<a href="https://altavista.superglobalmegacorp.com/usenet/b181/comp/sources/misc/1835.txt" target="_blank" rel="noreferrer noopener">3</a>.  I also found <a href="https://github.com/neozeed/Info-Zip-4.1" target="_blank" rel="noreferrer noopener">version 4.1</a> as well.  And people wonder why you want to save these &#8216;huge&#8217; data sets. If the lawyers could have their way, they would obliterate all history.</p>



<p class="wp-block-paragraph">I spent a lot of time messing with Makefiles, as linking &amp; object conversion on old NT is a big deal, and not the kind of thing you want to do more than once.  Another big pain is that large files become delete only.  I don&#8217;t know what the deal with notepad is, but I could remove text, but not change or add.  I solved that by wrapping a number of things by including it in another file with some #define work to go around it. Needless to say, that sucked.</p>



<p class="wp-block-paragraph">One thing that constantly threw issues is that this version of Windows doesn&#8217;t handle Unix style signals.  I removed all the signal catch/throw stuff, and the binaries ran fine.  Why on earth does &#8216;strip&#8217; need signals is beyond me, but it runs fine without them!</p>



<h2 class="wp-block-heading">Bringing it together.</h2>



<p class="wp-block-paragraph">From my &#8220;<a href="https://archive.org/details/linux-0.11-compile-ntdec1991-bins" target="_blank" rel="noreferrer noopener">Build artifacts from Building Linux 0.11 on Windows NT build 239, December 1991</a>&#8221; page, grab the two files, <a href="https://archive.org/download/linux-0.11-compile-ntdec1991-bins/bin.zip" target="_blank" rel="noreferrer noopener">bin.zip</a> &amp; <a href="https://archive.org/download/linux-0.11-compile-ntdec1991-bins/source0.zip" target="_blank" rel="noreferrer noopener">source0.zip</a>.</p>



<p class="wp-block-paragraph">On Windows I just unzip the bin.zip file and leave source.0.zip intact into a directly say something like temp.  Then I can use a cool feature of Qemu where it can mount a directory as a read-only FAT disk.  This saves a lot of time!</p>



<p class="wp-block-paragraph">Running Qemu like this:</p>



<pre class="wp-block-code"><code>qemu.exe -L pc-bios -m 64 -net none -hda nt1991.vmdk -hdb fat:temp -fda boot.vfd</code></pre>



<p class="wp-block-paragraph">Will drop to the bootloader. Hit enter to login, and you&#8217;ll be at the desktop.  Hit enter again, and open a command prompt.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-15.png" alt="" class="wp-image-14750" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-15.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-15-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-15-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">open the command prompt</figcaption></figure>



<p class="wp-block-paragraph">By default, the Numlock is messing with the arrow keys (I think it&#8217;s mapping to the old 83 key keyboard no matter what?)  Hit num-lock and your arrow keys should kind of work.  It&#8217;s a great time saver.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-16b.png" alt="" class="wp-image-14752" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-16b.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-16b-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-16b-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">copy the binaries to \bin &amp; get ready to unzip</figcaption></figure>



<p class="wp-block-paragraph">I copied the binaries &amp; the ygcc.cmd file into the \bin directory, created a \proj directory and get ready to unzip all the source code.  For some reason this version of unzip doesn&#8217;t understand the zip compression, so it&#8217;s just storing instead, much like TAR.  It&#8217;s not that involved but unzip with the -d flag so it creates directories as needed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-17.png" alt="" class="wp-image-14753" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-17.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-17-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-17-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">unzipped</figcaption></figure>



<p class="wp-block-paragraph">This will let us keep long file names.  HPFS is case insensitive, but it also preserves the case, so don&#8217;t worry about the names being all weird.  It doesn&#8217;t matter.</p>



<p class="wp-block-paragraph">One thing worth mentioning is that even though the C pre-processor does compile it just hangs when trying to run it.  I&#8217;m not sure what is wrong exactly, but it&#8217;s just not worth fighting.  Instead, I had the better idea, of using the Microsoft C compiler to pre-process the source.  Apparently, this is how they originally built Windows NT, pre-processing on OS/2, then uploading the pre-processed files to a SUN workstation with the i860 compiler and downloading the objects to be converted &amp; linked.  Wow that must have been tedious!</p>



<p class="wp-block-paragraph">I created a CMD file &#8216;ygcc.cmd&#8217; to run the cl386 pre-processor, call CC1 &amp; GAS and clean up afterwards.</p>



<pre class="wp-block-code"><code>cl386 -nologo /u /EP -I\include -D__GNUC__ -Dunix -Di386 -D__unix__ -D__i386__ -D__OPTIMIZE__ %2 > \tmp\xxx.cpp
\bin\cc1 -version -quiet -O -fstrength-reduce -fomit-frame-pointer -fcombine-regs -o /tmp/xxx.s /tmp/xxx.cpp
\bin\ax386 -v -o %1 /tmp/xxx.s
@del \tmp\xxx.s
@del \tmp\xxx.cpp</code></pre>



<p class="wp-block-paragraph">It&#8217;s not pretty but it works!</p>



<h2 class="wp-block-heading">Building</h2>



<p class="wp-block-paragraph">Before you can build Linux, you need to create both a \tmp &amp; \temp directory.  Also the include files need to be copied to the \include directory to make the pre-processor happier.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-18b.png" alt="" class="wp-image-14755" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-18b.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-18b-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-18b-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">I&#8217;ve tried to make this as simple as possible there is a &#8216;blind.cmd&#8217; file which I built that&#8217;ll manually compile Linux.  There is no error checking.</p>



<p class="wp-block-paragraph">And saving everyone the excitement here is an animation of the build process</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="480" height="357" src="https://virtuallyfun.com/wp-content/uploads/2024/08/build-linux011-ntdec1991.gif" alt="" class="wp-image-14749"/><figcaption class="wp-element-caption">Actually compiling Linux</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-19.png" alt="" class="wp-image-14756" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-19.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-19-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-19-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">compiled!</figcaption></figure>



<p class="wp-block-paragraph">And there we go! All compiled!</p>



<p class="wp-block-paragraph">From there it&#8217;s a matter of copying the Image file out of the VM, I used the boot floppy and 7zip&#8217;s ability to extract FAT images, and then boot up Qemu using the Image file as a &#8216;floppy&#8217; as back in the day we used to rawrite these to floppy disks. </p>



<pre class="wp-block-code"><code>qemu.exe -L pc-bios -m 64 -net none -hda nt1991.vmdk -hdb fat:temp -fda boot\IMAGE -boot a</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="432" src="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-20.png" alt="" class="wp-image-14757" srcset="https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-20.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-20-300x180.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/08/install-patched-1991-20-500x300.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /><figcaption class="wp-element-caption">And there we go, Linux 0.11 booted!</figcaption></figure>



<p class="wp-block-paragraph">I don&#8217;t have a root filesystem, so the panic is expected, but yes, we just cross compiled Linux from Windows NT, circa 1991!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/08/02/compiling-linux-0-11-using-the-december-1991-windows-nt-pre-release/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://virtuallyfun.com/wp-content/uploads/2024/08/combo.mp4" length="1485267" type="video/mp4" />

			</item>
		<item>
		<title>Let&#8217;s build a Linux kernel from Windows!</title>
		<link>https://virtuallyfun.com/2024/06/11/lets-build-a-linux-kernel-from-windows/</link>
					<comments>https://virtuallyfun.com/2024/06/11/lets-build-a-linux-kernel-from-windows/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Tue, 11 Jun 2024 19:22:50 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14534</guid>

					<description><![CDATA[Some of you may remember some 9 years ago, I had put together a package to compile Linux 0.10 under Windows. Time goes on, and things are lost, and it&#8217;d come up somewhere about actually building Linux from Windows, so &#8230; <a href="https://virtuallyfun.com/2024/06/11/lets-build-a-linux-kernel-from-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Let&#039;s build the Linux 0.10 kernel from Windows!" width="584" height="329" src="https://www.youtube.com/embed/fDbzazjSrYE?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption">Very exciting</figcaption></figure>



<p class="wp-block-paragraph">Some of you may remember some 9 years ago, I had put together <a href="https://virtuallyfun.com/2015/10/09/building-linux-0-11-on-windows-10/" target="_blank" rel="noreferrer noopener">a package to compile Linux 0.10 under Windows</a>.</p>



<p class="wp-block-paragraph">Time goes on, and things are lost, and it&#8217;d come up somewhere about actually building Linux from Windows, so I thought I&#8217;d show it off.</p>



<p class="wp-block-paragraph">The one thing is that modern machines are just so fast, that it&#8217;s almost hard to believe that a 386DX 16 with 4MB of ram would struggle for seemingly hours, what an i7 can churn out in mere seconds.</p>



<p class="wp-block-paragraph">Time sure flies!</p>



<p class="wp-block-paragraph">It&#8217;s my usual &#8216;DO IT LIVE&#8217; style, I tried to clean up the audio, but I lost the steps&#8230; One day I&#8217;ll try to script &amp; build a PowerPoint so it&#8217;s more cohesive.</p>



<p class="wp-block-paragraph">But today is not that day.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/06/11/lets-build-a-linux-kernel-from-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Building MIT PC/IP, or making apple pie</title>
		<link>https://virtuallyfun.com/2024/03/21/building-mit-pc-ip-or-making-apple-pie/</link>
					<comments>https://virtuallyfun.com/2024/03/21/building-mit-pc-ip-or-making-apple-pie/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 21 Mar 2024 18:13:25 +0000</pubDate>
				<category><![CDATA[4.1 BSD]]></category>
		<category><![CDATA[8086]]></category>
		<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[pcc]]></category>
		<category><![CDATA[SIMH]]></category>
		<category><![CDATA[VAX]]></category>
		<category><![CDATA[VAX 11/780]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14121</guid>

					<description><![CDATA[&#8220;If you want to make a pie from scratch, you must first create the universe&#8221; &#8211;Carl Sagan A little while ago I had touched briefly on the availability of of a PCC port to the 8086 done back in the &#8230; <a href="https://virtuallyfun.com/2024/03/21/building-mit-pc-ip-or-making-apple-pie/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><em>&#8220;If you want to make a pie from scratch, you must first create the universe&#8221; </em></p>
<cite><em>&#8211;Carl Sagan</em></cite></blockquote>



<p class="wp-block-paragraph">A little while ago <a href="/2022/11/04/on-the-trail-of-pcc-for-the-8086/" target="_blank" rel="noreferrer noopener">I had touched briefly</a> on the availability of of a PCC port to the 8086 done back in the early 1980&#8217;s that was hosted on VAX running 4.1BSD.  I&#8217;d ruled it basically useless as you are restricted to 64kb .COM files, and I couldn&#8217;t get much of anything interesting running on it.</p>



<p class="wp-block-paragraph">After all the fun of setting up <a href="/2024/03/03/installing-netmanage-chameleon-on-windows-3-0/" target="_blank" rel="noreferrer noopener">NetManage Chameleon on Windows 3.0</a>, over on IRC lys had mentioned I should try the MIT PC/IP stack.  I never knew anything about it&#8217;s history but it became the first PC TCP/IP stack.  You can read more about it from <a href="https://web.archive.org/web/20040215032121/http://www.drizzle.com/~aboba/internaut/pc-ip.html" target="_blank" rel="noreferrer noopener">&#8220;<em>Internaut</em>&#8220;</a>?</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">Dave Clark had gone to England for sabbatical and while he was there, had implemented TCP/IP in BCPL for the TRIPOS operating system, a predecessor of the Commodore AMIGA operating system. He brought the TCP/IP code back with him, and the Lab for Computer Science had a bunch of Xerox Alto workstations, and someone at LCS ported Dave&#8217;s TCP/IP to the Alto.</p>



<p class="wp-block-paragraph">Then someone ported it to Version 6 UNIX and rewrote it in C. And that was what we took, and ported to PC DOS. At that point there were no C compilers that ran on the PC, and we were using a compiler that ran on a PDP 11/45 on Version 6 UNIX, and then on a VAX 750 running BSD v4.1. That was the AT&amp;T; portable C compiler, and a group of people on the fourth floor of the LCS had written an 8088 code generator for it. This was before Microsoft C, and before 4.2 BSD.</p>



<p class="wp-block-paragraph">Our first tasks were to bring up TFTP, TCP, and a telnet client under DOS. Several people were involved. Lou Konopelski did the initial TCP and telnet work, and Dave Brigham did similar work to what I did.</p>
<cite>John Romkey &#8211; <em>Internaut</em> &#8211; <strong>How PC-IP Came to Be</strong></cite></blockquote>



<p class="wp-block-paragraph">What is even more notable about PCIP is that it&#8217;s the reason the whole &#8216;MIT License&#8217; even exists, as word seems to have spread quickly about a TCP/IP stack for the IBM PC compatible market.  Jerome Saltzer has documented it all, if you want to read about it (<a href="https://www.mit.edu/~Saltzer/publications/MITLicense.pdf" target="_blank" rel="noreferrer noopener">WARNING PDF!</a>)</p>



<p class="wp-block-paragraph"><a href="https://en.wikipedia.org/wiki/John_Romkey" target="_blank" rel="noreferrer noopener">Romkey</a> would even then go on to found FTP software in that wonderful pre public internet era, before the eternal September.</p>



<p class="wp-block-paragraph">Over on <a href="http://bitsavers.trailing-edge.com/bits/MIT/pc-ip/">bitsavers</a> there are 3 files:</p>



<figure class="wp-block-table"><table><tbody><tr><td><img decoding="async" src="/wp-content/uploads/2024/03/tar.gif" alt="[   ]"></td><td>8086_C_19850820.tar</td><td>2019-03-12 14:36</td><td>750K</td><td>&nbsp;</td></tr><tr><td><img decoding="async" src="/wp-content/uploads/2024/03/tar.gif" alt="[   ]"></td><td>PC-IP_19850124.tar</td><td>2019-03-12 11:53</td><td>4.6M</td><td>&nbsp;</td></tr><tr><td><img decoding="async" src="/wp-content/uploads/2024/03/tar.gif" alt="[   ]"></td><td>PC-IP_19860403.tar</td><td>2019-03-12 11:53</td><td>6.9M</td><td>&nbsp;</td></tr></tbody></table><figcaption class="wp-element-caption">bitsavers.trailing-edge.com/bits/MIT/pc-ip/</figcaption></figure>



<p class="wp-block-paragraph">Of course, the one thing that stands out is that these files look tiny.  They aren&#8217;t even compressed!  PCC, or the Portable C Compiler was released from AT&amp;T, itself written in C, to make porting the C compiler easier to further allow Unix to be further easily ported. Now that I kind of had a mission, I decided to take the 8086 PCC leap, again.</p>



<h2 class="wp-block-heading">Get the time machine ready!</h2>



<figure class="wp-block-image size-large"><a href="/wp-content/uploads/2024/03/Designer-5-jpg.webp"><img loading="lazy" decoding="async" width="1024" height="585" src="/wp-content/uploads/2024/03/Designer-5-1024x585.webp" alt="" class="wp-image-14127" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-1024x585.webp 1024w, https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-300x171.webp 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-768x439.webp 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-1536x878.webp 1536w, https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-500x286.webp 500w, https://virtuallyfun.com/wp-content/uploads/2024/03/Designer-5-jpg.webp 1792w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">A man, his best friend and a time machine! &#8211; Microsoft Sydney</figcaption></figure>



<p class="wp-block-paragraph">Thankfully I had that 4.1c BSD image still up on <a href="https://sourceforge.net/projects/bsd42/" target="_blank" rel="noreferrer noopener">sourceforge</a>, aptly named: <a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.4/4.1c%20BSD.7z/download" target="_blank" rel="noreferrer noopener">4.1c BSD.7z</a>, so I could follow my old instructions to create the tap file and start working with 8086 C, going back from 1985.  And in no time, I had re-built the compiler, and assembler up and running.  But I wanted more, as much fun as 4.1BSD is, I wanted to run everything natively on Windows.</p>



<p class="wp-block-paragraph">At this point I&#8217;d remembered that this setup is a bit odd in that the object files that the assembler produces are OMAGIC (type 0407) <a href="https://en.wikipedia.org/wiki/A.out">a.out</a> files.  Thinking back to my old project of <a href="https://sourceforge.net/projects/linux011/" target="_blank" rel="noreferrer noopener">building Ancient Linux on Windows using vintage tools</a>, it also uses OMAGIC a.out files! It&#8217;s not that unexpected as the original GNU ld linker from 1986 has hooks for both old magic &amp; new magic (OMAGIC/NMAGIC) files, as this would be consistent from the era.  Thinking this was my out, I might have a way of migrating the build process off of the VAX.</p>



<p class="wp-block-paragraph">The first pass was to try to pull in all the VAX includes into my native Visual C++ 1.0, and get it to build with Microsoft C/C++ 8.0.  The next thing to do of course, is look for where it&#8217;s doing anything with binary files and make sure it&#8217;s all set to O_BINARY/&#8221;rb&#8221;/&#8221;wb&#8221; where appropriate as MS-DOS/Win32/OS2 all handle text files differently from binary data.  There is also fights with mktemp along with procedure name creep, like how &#8217;round&#8217; wasn&#8217;t a thing in 1980 but it sure is by 1993!  Before the era of the 486DX/68040/Pentium not everyone had a math co-processor (FPU) so it&#8217;d make sense that a lot of things wouldn&#8217;t have this by default.</p>



<p class="wp-block-paragraph">As a quick refresher the following diagram may be specific to the GNU GCC compiler, but the older PCC compiler uses the same methodology of first pre-processing files, then compiling them, assembling the resulting compiler output, then finally linking to an executable program.  ( See &#8211; &#8220;<a href="/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/" target="_blank" rel="noreferrer noopener">So it turns out GCC could have been available on Windows NT the entire time</a>&#8220;)</p>



<figure class="wp-block-image size-large"><a href="/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="384" src="/wp-content/uploads/2024/01/gcc-program-flow-1024x384.png" alt="" class="wp-image-13731" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-1024x384.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-300x112.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-768x288.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-1536x575.png 1536w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-500x187.png 500w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow.png 1962w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">a rough explanation of how old C compilers work in stages</figcaption></figure>



<p class="wp-block-paragraph">The steps for PCC 8086 are quite similar but to spell them out:</p>



<ul class="wp-block-list">
<li>Pre-process with GNU cpp</li>



<li>Compile with PCC&#8217;s c86</li>



<li>Assemble with PCC&#8217;s a86</li>



<li>Link with GNU&#8217;s ld</li>



<li>Extract the MS-DOS .COM file with cvt86</li>
</ul>



<p class="wp-block-paragraph">There isn&#8217;t much to talk about the pre-processor, so I&#8217;ll skip it, suffice to say from my <a href="https://github.com/neozeed/cl386-research" target="_blank" rel="noreferrer noopener">cl386 research</a>, and porting GCC to OS2/NT, it just worked.</p>



<h2 class="wp-block-heading">Compiling the compiler</h2>



<p class="wp-block-paragraph">Surprisingly getting the compiler running wasn&#8217;t too difficult.  I do remember getting this running before, so seeing it run again wasn&#8217;t too much of a surprise.  The simple C program:</p>



<pre class="wp-block-code"><code>main(){
printf("hi from 8086 pcc\n");
}</code></pre>



<p class="wp-block-paragraph">Gives us the following generated assembly:</p>



<pre class="wp-block-code"><code>        .data
        .text
        .globl  _main
_main:
        push    bp
        mov     bp,sp
        push    si
        push    di
        sub     sp,#LF1
        mov     ax,#L14
        push    ax
        call    _printf
        pop     cx
L12:
        lea     sp,*-4(bp)
        pop     di
        pop     si
        pop     bp
        ret
        LF1 = 0
        .data
L14:
        .byte   104,105,32,102,114,111,109,32
        .byte   56,48,56,54,32,112,99,99
        .byte   10,0</code></pre>



<p class="wp-block-paragraph">So far, so good, right!  Even for fun, I was able to build it using Microsoft C 6.0!  I figured I may as well try to get as much out of that purchase as possible.</p>



<h2 class="wp-block-heading">Strage binary formats in a strange world</h2>



<p class="wp-block-paragraph">One thing that was a constant problem for me is that the assembler generated garbage, it never gave me the a.out OMAGIC file.  Opening it up in a hex editor, Hex Editor Neo, and it showed problem, right away.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-vax.png"><img loading="lazy" decoding="async" width="683" height="248" src="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-vax.png" alt="" class="wp-image-14130" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-vax.png 683w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-vax-300x109.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-vax-500x182.png 500w" sizes="auto, (max-width: 683px) 100vw, 683px" /></a><figcaption class="wp-element-caption">A simple do nothing program, assembled on the VAX</figcaption></figure>



<p class="wp-block-paragraph">The OMAGIC sequence in hex should be written down as <strong>07 01</strong>, but when I looked at the output from my PC port the file was not only too big but it didn&#8217;t have the headder:</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc.png"><img loading="lazy" decoding="async" width="650" height="237" src="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc.png" alt="" class="wp-image-14131" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc.png 650w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-300x109.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-500x182.png 500w" sizes="auto, (max-width: 650px) 100vw, 650px" /></a><figcaption class="wp-element-caption">The same program assembled on the PC</figcaption></figure>



<p class="wp-block-paragraph">As you can see it&#8217;s just a bunch of zeros up front.  Later on, I&#8217;d realize this was a &#8216;pad&#8217; so it could be filled in later by the assembler when doing relocations.  The file in question was rel.c which also should have been the hint.  I don&#8217;t know if anyone saw it, but let me highlight it for you:</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-hihglight.png"><img loading="lazy" decoding="async" width="650" height="237" src="/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-hihglight.png" alt="" class="wp-image-14132" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-hihglight.png 650w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-hihglight-300x109.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/OMAGIC-assembled-on-the-pc-hihglight-500x182.png 500w" sizes="auto, (max-width: 650px) 100vw, 650px" /></a><figcaption class="wp-element-caption">The OMAGIC header is being appended!</figcaption></figure>



<p class="wp-block-paragraph">As you can see, where the file ends on the VAX, on the PC the OMAGIC header is being appended.  I did a simple cut &amp; paste in the editor, and the object file validated just fine.  So why was this happening?  In my rush to just add &#8216;binary&#8217; flags to any file operations I had seen this in rel.c:</p>



<pre class="wp-block-code"><code>		(dout = fopen(Rel_name, "a")) == NULL)</code></pre>



<p class="wp-block-paragraph">I had taken this be an &#8216;append&#8217; for whatever reason it would need to do that kind of thing.  Well maybe that&#8217;s what it means in 1993, but in 1981 it doesn&#8217;t append, instead it just opens it normally.  Is this a bug in the assembler, or a feature of 4.1BSD?  Without debugging it, I just modified it to not append, as this was the only occurrence of an explicit append in the source code I could see.</p>



<pre class="wp-block-code"><code>		(dout = fopen(Rel_name, "wb")) == NULL)</code></pre>



<p class="wp-block-paragraph">And that did the trick, I now had a working assembler running on my PC!</p>



<p class="wp-block-paragraph">But we are not out of the woods yet!</p>



<p class="wp-block-paragraph">Naturally trying to build a much &#8216;larger&#8217; Fibonacci program crashed the assembler.  Luckily debugging it was a snap to find out that it was trying to free a static pointer.  Or so I think.  Today, in the future RAM is cheap, so I just commented out the offending free and now it was off to the linker.</p>



<h2 class="wp-block-heading">When is advanced optimization a bad idea?</h2>



<p class="wp-block-paragraph">When the machine you wrote this for no longer exists.  In the middle of the ld86 linker is this line:</p>



<pre class="wp-block-code"><code>		asm("movc3 r8,(r11),(r7)");</code></pre>



<p class="wp-block-paragraph">I have no idea why it&#8217;s there.</p>



<p class="wp-block-paragraph">I don&#8217;t know what it should be doing.</p>



<p class="wp-block-paragraph">This makes the linker un-portable.</p>



<p class="wp-block-paragraph">However, as I&#8217;d mentioned before I did have the GNU linker that I&#8217;d successfully used to build Linux kernels, so there was hope!</p>



<pre class="wp-block-code"><code>C:\msvc32s\proj\8086pcc&gt;\aoutgcc\bin\ld.exe -X -r -o hi.out crt0.b hi.b ./libc.a
C:\msvc32s\proj\8086pcc&gt;cvt86 hi.out hi.com
C:\msvc32s\proj\8086pcc&gt;msdos hi.com
hello from pcc for 8086!</code></pre>



<p class="wp-block-paragraph">I had now successfully run my first program without using the VAX.  Although I had not mentioned a step yet, cvt86, this utility is described as creating a MS-DOS .COM file from an a.out file.  I didn&#8217;t look into how it accomplishes this, but basically, it&#8217;s another linker.  And this issue would come to complicate things as I had thought that everything was working.</p>



<h2 class="wp-block-heading">libc &amp; the heart of C</h2>



<p class="wp-block-paragraph">Libc, is simply put the central C library for getting everything done.  While crt0 will setup the C environment everything else core from opening files, writing to the screen, and reading keyboard input is done through libc.  So I thought re-building libc would be easy enough.  To build the library you &#8216;archive&#8217; them with the &#8216;ar&#8217; archiver, then index them with &#8216;ranlib&#8217;.  And again, from my a.out adventures building Linux I had both tools, however no matter what I was doing they did not work with cvt86.  I wen&#8217;t back and rebuilt some kernels to verify, and yes it does generate archives but cvt86 was not happy.</p>



<p class="wp-block-paragraph">I still had the SIMH VAX running in case I needed it, so I just broke down and figured I&#8217;d just port the VAX ar/ranlib to the PC.  I don&#8217;t know off hand what the problem was, and I didn&#8217;t feel like spending an eternity to try to correct it, and both of the programs are somewhat portable.  But of course it wasn&#8217;t that simple as ar opens files in strange ways that work on 4.1BSD but yeild chaos on the PC.</p>



<pre class="wp-block-code"><code>#define ARMAG   "!&lt;arch&gt;\n"

#define SARMAG  8

#define ARFMAG  "`\n"</code></pre>



<p class="wp-block-paragraph">&#8216;ar&#8217; has it&#8217;s own magic, a simple !&lt;arch&gt; and a ` followed by a new line.  On any UNIX the \n is 10 in decimal 0xa in hex.  But on the PC it&#8217;s carriage return and linefeed!  And yes despite setting all the opens to binary, it was constantly injecting carriage returns &amp; linefeeds all over the place!  Some-how the file was being opened in text mode.  Thankfully debugging even in old Visual C is great and inspecting the temporary files lead me to find this part:</p>



<pre class="wp-block-code"><code>			f = creat(file, larbuf.lar_mode &amp; 0777);</code></pre>



<p class="wp-block-paragraph">In a few places it uses the <a href="https://linux.die.net/man/2/creat" target="_blank" rel="noreferrer noopener">creat</a> (or create call.  In an interview Dennis Ritchie had mentioned that this was one of his regrets in life, not naming creat create) call, which of course never has to set a mode, as everything is binary in Unix, unlike the PC.  Great.</p>



<p class="wp-block-paragraph">Luckily the fix was very simple after every creat, simply set the file mode to binary.</p>



<pre class="wp-block-code"><code>			setmode(f,O_BINARY);</code></pre>



<p class="wp-block-paragraph">Great!</p>



<h2 class="wp-block-heading">Apple pie!</h2>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib.png"><img loading="lazy" decoding="async" width="979" height="512" src="/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib.png" alt="" class="wp-image-14140" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib.png 979w, https://virtuallyfun.com/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib-768x402.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/pcc-8086-self-hosting-fib-500x261.png 500w" sizes="auto, (max-width: 979px) 100vw, 979px" /></a><figcaption class="wp-element-caption">Fibonacci sequence</figcaption></figure>



<p class="wp-block-paragraph">Now I could re-build libc from source and link it to the Fibonacci program!</p>



<p class="wp-block-paragraph">Yes it&#8217;d take this long to get to the point where I can now easily edit file on a modern machine and have a Win32 native toolchain!  VAX no longer required!  We&#8217;ve successfully extracted everything we needed from the 1980&#8217;s!</p>



<h2 class="wp-block-heading">First contact!</h2>



<p class="wp-block-paragraph">Now it&#8217;s time to look at what brought us on this adventure, MIT PC/IP.</p>



<p class="wp-block-paragraph">The MIT PC/IP (PCIP) does require changes to the libc to work correctly.  Unfortunately, they didn&#8217;t provide the full copy of the libc, but rather some ed scripts.  So, the first question is do I even have the version these are based off of to start?  I don&#8217;t know, so I had guessed, and I had guessed incorrectly.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="800" height="534" src="/wp-content/uploads/2024/03/800px-3com_3c501_front-jpg.webp" alt="" class="wp-image-14148" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/800px-3com_3c501_front-jpg.webp 800w, https://virtuallyfun.com/wp-content/uploads/2024/03/800px-3com_3c501_front-300x200.webp 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/800px-3com_3c501_front-768x513.webp 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/800px-3com_3c501_front-449x300.webp 449w" sizes="auto, (max-width: 800px) 100vw, 800px" /><figcaption class="wp-element-caption">3com 3c501</figcaption></figure>



<p class="wp-block-paragraph">Configuring PCIP is somewhat involved, first you need MS-DOS 2.00 or greater which thankfully in the future is FREE!  The next thing you need is a 3com 3c501 card.  This is going to be a challenge but it&#8217;s just as any good time to mention 86box, and the latest version that I&#8217;ve been using that of course supports this kind of setup!</p>



<figure class="wp-block-image size-large"><a href="https://github.com/86Box/86Box/releases/tag/v4.1.1" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="768" src="/wp-content/uploads/2024/03/V4.1.1_POST-1024x768.webp" alt="" class="wp-image-14149" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-1024x768.webp 1024w, https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-300x225.webp 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-768x576.webp 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-1536x1152.webp 1536w, https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-2048x1536.webp 2048w, https://virtuallyfun.com/wp-content/uploads/2024/03/V4.1.1_POST-400x300.webp 400w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">New version 4.1.1</figcaption></figure>



<p class="wp-block-paragraph">I can&#8217;t recommend it enough, 86box is like all the inconveniences of old software &amp; hardware without having to spend a fortune for weird combinations, fighting to have space for it.  I naturally setup a 386sx with CGA, 20Mb hard disk and a 3c501 card.  It&#8217;s nice being able to also be very task specific, this doesn&#8217;t have to be a DooM/Quake machine!</p>



<p class="wp-block-paragraph">the first thing you need to do is add the netdev.sys device driver that is created as part of building PCIP from source.  a simple:</p>



<pre class="wp-block-code"><code>DEVICE=\NETDEV.SYS</code></pre>



<p class="wp-block-paragraph">in your config.sys is more than enough.  However, how do you configure it?  Well it&#8217;s the &#8216;custom&#8217; program that binary edit&#8217;s the device driver.</p>



<p class="wp-block-paragraph"><strong>YES, IT EDITS THE DEVICE DRIVER.</strong></p>



<p class="wp-block-paragraph">Setting stuff up is somewhat straight forward, however it displays TCP/IP information in decimal not in hex.  I haven&#8217;t even looked into the how or why.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-164435-259.png"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-164435-259.png" alt="" class="wp-image-14150" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164435-259.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164435-259-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164435-259-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">The first page</figcaption></figure>



<p class="wp-block-paragraph">The first page options are kind of banal, it&#8217;s back in the day when people would use finger to find people on the internet and call them up or send emails.  How cute.  1985 was a different world!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-164442-852.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-164442-852.png" alt="" class="wp-image-14151" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164442-852.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164442-852-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164442-852-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">hardware options</figcaption></figure>



<p class="wp-block-paragraph">In the hardware options the only thing to check is the I/O base, IRQ &amp; DMA for the Ethernet card.  I just configured the card around 0x300/5/1 as it&#8217;s great being purpose built!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-164500-212.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-164500-212.png" alt="" class="wp-image-14152" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164500-212.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164500-212-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164500-212-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">telnet options</figcaption></figure>



<p class="wp-block-paragraph">There is a separate window for telnet options.  Naturally high speed connections frame far too fast for something built from 1985.  I found lowering the TCP windows really helped with pacing.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-164506-586.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-164506-586.png" alt="" class="wp-image-14153" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164506-586.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164506-586-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-164506-586-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">Site config</figcaption></figure>



<p class="wp-block-paragraph">As I had mentioned the site configuration displays all the information in decimal.  Also, I&#8217;m wasn&#8217;t sure what is going on with the netmask, but looking at the old Windows calculator revealed it was being stored in OCTAL.  It&#8217;s probably why the addresses have commas instead of periods.  Although I had configured DNS it didn&#8217;t work, as it uses UDP port 42. It&#8217;s clearly doing something very early 1980&#8217;s.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/broken-telnet.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="720" height="350" src="/wp-content/uploads/2024/03/broken-telnet.png" alt="" class="wp-image-14147" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/broken-telnet.png 720w, https://virtuallyfun.com/wp-content/uploads/2024/03/broken-telnet-300x146.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/broken-telnet-500x243.png 500w" sizes="auto, (max-width: 720px) 100vw, 720px" /></a><figcaption class="wp-element-caption">The status CR/LF is broken!</figcaption></figure>



<p class="wp-block-paragraph">So close and yet so far away.  The only thing to do was try to figure out which of the libc stuff was &#8216;newest&#8217; in the pure state and try to figure out where to go from there.</p>



<h2 class="wp-block-heading">Redo!</h2>



<p class="wp-block-paragraph">While I had not configured the libc correctly, I had partial success!  I could actually establish a telnet session! Libc wasn&#8217;t working correctly as every line feed didn&#8217;t generate a carriage return, as you&#8217;d need for MS-DOS leaving it with broken status.</p>



<p class="wp-block-paragraph">But at the same time, despite all the weird &#8216;challenges&#8217; for the most part &#8216;it just worked&#8217;.  Which is pretty cool!</p>



<p class="wp-block-paragraph">It turns out the answer was the 8086_C_19850820 file.  As far as I can tell there was only one thing that didn&#8217;t patch correctly but I was able to build a libc in no time.. that didn&#8217;t work.  In the patch it removes ulrem/auldiv from arith.a86  Not sure why, I haven&#8217;t messed with it.  But that means I had to restructure to build with the non floating point n86c compiler as that&#8217;s the way PCIP is expected to be built.  After rebuilding with this compiler and this seemingly properly patched library I finally had it working!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-155250-479.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-155250-479.png" alt="" class="wp-image-14146" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155250-479.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155250-479-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155250-479-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">Ping my local gateway!</figcaption></figure>



<p class="wp-block-paragraph">Instead of a garbled mess, I had something I could read!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/Monitor_1_20240321-155420-962.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="640" height="200" src="/wp-content/uploads/2024/03/Monitor_1_20240321-155420-962.png" alt="" class="wp-image-14154" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155420-962.png 640w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155420-962-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/Monitor_1_20240321-155420-962-500x156.png 500w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-element-caption">telnetting to my test BBS</figcaption></figure>



<p class="wp-block-paragraph">Now instead of a garbled mess, I can see it was trying to display the connected IP, and a clock.</p>



<p class="wp-block-paragraph">Sadly it doesn&#8217;t work with SLiRP.  I&#8217;m sure it&#8217;s either classful routing or it really doesn&#8217;t like how SLiRP handles ARP.  I suspect it&#8217;s also trying to do old style classful routing as well, which means you can&#8217;t just load arbitrary subnet masks wherever you want, to try to squeeze the 4 billion IP&#8217;s out of the internet.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="480" height="363" src="/wp-content/uploads/2024/03/fixedmit.gif" alt="" class="wp-image-14162"/><figcaption class="wp-element-caption">The updated telnet client connecting to a test BBS</figcaption></figure>
</div>


<h2 class="wp-block-heading">Final thoughts</h2>



<p class="wp-block-paragraph">I suspect that although there were binaries in the above tar files, going through the effort to rebuild PCIP really wasn&#8217;t all that expected for most people to carry out.  Sadly, there was no shared source &#8216;sites&#8217; online, and we&#8217;re lucky enough someone kept a few tarballs lying around.  I really can&#8217;t blame them for sticking with then current development tools, especially for what you&#8217;d need to build a C compiler back in the early 80&#8217;s.  It&#8217;s a shame the QL or the Macintosh didn&#8217;t have the RAM or the DASD capacity to become that home cross compiler of the 80&#8217;s.</p>



<p class="wp-block-paragraph">Most project just require you to work on that actual project, while this has been a substantially larger undertaking from anything normal, but I guess I&#8217;ve learned a bit along the way with all those &#8220;pointless&#8221; GCC port things I&#8217;d done, well it turns out they are incredibly useful! It&#8217;s been a fun archeological expedition for me, thankfully C is still a thing, I wonder what happened to all the ADA/Perl/Pascal/&#8221;Wave of the future&#8221; stuff that is always disappearing.  At least more and more people work on full system emulation so there is always that!</p>



<p class="wp-block-paragraph">For anyone that curious you can find all the code over on github:</p>



<p class="wp-block-paragraph"><a href="https://github.com/neozeed/8086pcc">https://github.com/neozeed/8086pcc</a></p>



<p class="wp-block-paragraph">Against my better judgement, I&#8217;ve added a <a href="https://github.com/neozeed/8086pcc/releases" target="_blank" rel="noreferrer noopener">binary package on github</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/03/21/building-mit-pc-ip-or-making-apple-pie/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Porting GCC to 32bit OS/2</title>
		<link>https://virtuallyfun.com/2024/02/10/porting-gcc-to-32bit-os-2/</link>
					<comments>https://virtuallyfun.com/2024/02/10/porting-gcc-to-32bit-os-2/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sat, 10 Feb 2024 17:35:06 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[OS/2]]></category>
		<category><![CDATA[OS/2 2.0]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13919</guid>

					<description><![CDATA[I know what you are going to think, that it was already done, and it was called EMX. Or was it GCC/2? Well sure but what if you are not running the GA (General availability) version of OS/2. For example, &#8230; <a href="https://virtuallyfun.com/2024/02/10/porting-gcc-to-32bit-os-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I know what you are going to think, that it was already done, and it was called EMX.  Or was it GCC/2?  Well sure but what if you are not running the GA (General availability) version of OS/2.  For example, years ago I had managed to get Citrix Multiuser 2.0, and it&#8217;s not at the GA level.  All that is available is some ancient beta version of Microsoft C 5.2 from 1989?!</p>



<p class="wp-block-paragraph">A little while back I had worked on getting GCC to build and run on the FPU enabled versions of Windows NT from 1991.  I had mentioned that it turns out thanks to the Xenix assembler, that GCC had been basically available the entire time Windows NT had been available, but lamented that since the OS/2 compiler is 16/32bit, the 5.2 compiler couldn&#8217;t handle compiling GCC without blowing it&#8217;s heap.  16bit issues in a 64bit world.</p>



<p class="wp-block-paragraph">However after doing some research on all the early cl386 compilers I could get my hands on, including the Windows NT Pre-release ones, I&#8217;d noticed that if I built CC1.EXE (the actual compiler) first for Win32, then rebuilt those object files with the December NT Pre-release compiler, that some versions of LINK386 from the OS/2 2.1 DDK would actually link with them.  And sure enough it worked!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="703" height="462" src="/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2.png" alt="" class="wp-image-13920" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2.png 703w, https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-300x197.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-456x300.png 456w" sizes="auto, (max-width: 703px) 100vw, 703px" /></a><figcaption class="wp-element-caption">First life of GCC on OS/2</figcaption></figure>



<p class="wp-block-paragraph">I have to admit I was pretty amazed, I had managed to &#8216;cross compile&#8217; GCC using quite the tool chain.</p>



<p class="wp-block-paragraph">First the compiler from the December NT Pre-release CD-ROM is shipped as a 16bit OS/2 compiler, but I&#8217;m using Windows 11.  First I use the MS-DOS player with a quick fix from crazyc to allow Phar Lap 286|Dos Extender to run, which provides a basic enough OS/2 emulation to allow the compiler to run under &#8216;dos&#8217;.  The linker on the DDK suffers the same fate as far as it also being 16bit.  However the combination of MS-DOS player &amp; Phar Lap gets stuff working!  The only weird catch is that the 386 emulator causes strange floating point related crashes, while the 286 or 486 emulators work fine.</p>



<p class="wp-block-paragraph">Now targeting OS/2 or running on OS/2 isn&#8217;t all that new, but building it from a Microsoft C compiler is.  And now of course you&#8217;ll ask yourself, who cares? why is it interesting?</p>



<p class="wp-block-paragraph">Well, the vast majority of the GCC ports to OS/2 don&#8217;t support the OMF object file binary standard, instead they used the much outdated a.out format, and rely on tools to convert the objects if needed.  Additionally, they have DLL dependencies, and other startup issues with things needing to be setup.  And of course they rely on a binary standard that is &#8216;GA&#8217;.  *HOWEVER* by using a Microsoft compiler, I have OMF object files that the OS/2 built in system linker LINK386 can understand.  So in plain English I can just relink the compiler and it&#8217;ll run on a new &#8216;version&#8217; of unsupported OS/2.</p>



<p class="wp-block-paragraph">I made a diskette image with my objects &amp; a linker script and in a few moments I had it running!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="798" height="438" src="/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123.png" alt="" class="wp-image-13922" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123.png 798w, https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123-300x165.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123-768x422.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/first-hello-from-GCC-on-OS2-6.123-500x274.png 500w" sizes="auto, (max-width: 798px) 100vw, 798px" /></a><figcaption class="wp-element-caption">GCC running on OS/2 2.00 6.123</figcaption></figure>



<p class="wp-block-paragraph">The substantial thing here is that the binary format for OS/2 changed twice, and each release introduced changes that broke binary compatibility, in an effort to force people onto the new tools.  So there is no way that the old &#8216;LE&#8217; format would ever work.  And you can see it&#8217;s running!  In addition I could take the same object files, and copy them to my Citrix server, and likewise it was just a matter of linking, and it too now has GCC!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/emxomf-in-action.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="902" height="533" src="/wp-content/uploads/2024/02/emxomf-in-action.png" alt="" class="wp-image-13923" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/emxomf-in-action.png 902w, https://virtuallyfun.com/wp-content/uploads/2024/02/emxomf-in-action-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/emxomf-in-action-768x454.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/emxomf-in-action-500x295.png 500w" sizes="auto, (max-width: 902px) 100vw, 902px" /></a><figcaption class="wp-element-caption">Converting a.out to OMF via emxomf</figcaption></figure>



<p class="wp-block-paragraph">One annoying thing is that the LINK386 that ships with OS/2 2.00 GA doesn&#8217;t like the output of the Xenix assembler, so I built the a.out traditional assembler, and the emxomf tool to convert the a.out to OMF, and that worked well.</p>



<p class="wp-block-paragraph">I still have much to mess with, including the pre-processor &amp; main &#8216;gcc&#8217; program.  I have not built anything beyond a trivial program, so there is indeed much more work to be done before I can even try anything challenging.  Some programs like emxomf have portions in the debug support that require the &#8216;long long&#8217; type, which obviously Microsoft compilers from 1989-1991 don&#8217;t have, so I&#8217;ll have to re-build them with GCC.</p>



<p class="wp-block-paragraph">Ive been putting my <a href="https://github.com/neozeed/cl386-research" target="_blank" rel="noreferrer noopener">ports onto github (cl386-research)</a> as it handles the rapid changes well enough.  It&#8217;s a bit of a complex setup and it involves using a build system that <a href="https://archive.org/details/cl386-research-v2" target="_blank" rel="noreferrer noopener">I&#8217;ve put over on archive.org here: cl386-research-v2</a>.</p>



<p class="wp-block-paragraph">Not that I can imagine anyone wanting to try but I&#8217;ve uploaded some disks with the objects.  Copy them to a hard drive, and run the &#8216;build.cmd&#8217; command and it&#8217;ll link to a native freestanding executable.</p>



<ul class="wp-block-list">
<li><a href="https://archive.org/download/os2_gcc_objects_10_2_2024/cc1-object.vfd" target="_blank" rel="noreferrer noopener">cc1</a></li>



<li><a href="https://archive.org/download/os2_gcc_objects_10_2_2024/as386-object.vfd" target="_blank" rel="noreferrer noopener">as386</a></li>



<li><a href="https://archive.org/download/os2_gcc_objects_10_2_2024/emxomf-object.vfd" target="_blank" rel="noreferrer noopener">emxomf</a></li>
</ul>



<p class="wp-block-paragraph">I&#8217;ll explain it more with a post later, along with going over all the versions of cl386 I&#8217;ve acquired, over the years in more of a part 2: <a href="https://virtuallyfun.com/2024/02/11/targeting-os-2-with-visual-studio-2003/" target="_blank" rel="noreferrer noopener">Targeting OS/2 with Visual Studio 2003</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/02/10/porting-gcc-to-32bit-os-2/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>So it turns out GCC could have been available on Windows NT the entire time!</title>
		<link>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/</link>
					<comments>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 08 Jan 2024 18:32:14 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13729</guid>

					<description><![CDATA[This is going to be a bit convoluted but here goes.. GCC isn&#8217;t a monolithic compiler, instead it&#8217;s various parts are separate programs. This lets us tackle it one part at a time. And/Or bypass a lot of it until &#8230; <a href="https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This is going to be a bit convoluted but here goes..  GCC isn&#8217;t a monolithic compiler, instead it&#8217;s various parts are separate programs.  This lets us tackle it one part at a time.  And/Or bypass a lot of it until I want to tackle it.</p>



<figure class="wp-block-image size-large"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow.png"><img loading="lazy" decoding="async" width="1024" height="384" src="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-1024x384.png" alt="" class="wp-image-13731" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-1024x384.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-300x112.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-768x288.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-1536x575.png 1536w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow-500x187.png 500w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-program-flow.png 1962w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Flow of GCC</figcaption></figure>



<p class="wp-block-paragraph">I&#8217;m sure many people have explained this far better than I ever could but in C you write source files (obviously), the pre-processor reads those and &#8216;header&#8217; files that describe interfaces to libraries, other objects, various macros and definitions (magical numbers) and the pre-processor will read those files, and do simple macro expansion and test insert/replacements to generate a single .i file at the end of it&#8217;s run.</p>



<p class="wp-block-paragraph">The C compiler (cc1) now reads that single .i file and translates it into native assembly.  This allows for &#8216;mid/high level&#8217; aspects of C to be machine independent (portable) but now will be written into a very system dependant assembly file, the single .S file.  One thing of note is that so far everything is text files.  You can edit the assembly file as you would any document, or even further &#8216;process&#8217; it if needed/wanted.</p>



<p class="wp-block-paragraph">The assembler <a href="https://github.com/neozeed/gas-1.38-xenix-" target="_blank" rel="noreferrer noopener">ax386</a> (GAS) will then read the single assembly file and write a a binary object file hi.OBJ.  There typically isn&#8217;t all that much to be said about assemblers although fancier ones allow for really strong Macro capabilities like Microsoft MASM.</p>



<p class="wp-block-paragraph">From here on, it&#8217;s all binary objects!</p>



<p class="wp-block-paragraph">The linker then takes your object files, and links them together with other system objects and system libraries into an executable, in this case.  Linkers can build all kinds of other things, but for now we&#8217;re just pretending its static C compilation like it&#8217;s the 1970&#8217;s.</p>



<p class="wp-block-paragraph">At it&#8217;s heart GCC processes text files.</p>



<p class="wp-block-paragraph">The first part in this insane experiment, is to build <a href="https://archive.org/details/oldgcc1x" target="_blank" rel="noreferrer noopener">GCC 1.40</a> with Microsoft Visual C++ 1.0.  Surprisingly it didn&#8217;t take an insane amount of messing with stuff, and I got an executable!  But everything it compiled failed to assemble.  Looking at this fragment, even if you don&#8217;t know i386 assembly you might spot the error:</p>



<pre class="wp-block-code"><code>main:
        pushl %ebp
        a b,c
        pushl %esi
        pushl %ebx</code></pre>



<p class="wp-block-paragraph">Yeah, it&#8217;s the &#8220;a b,c&#8221; part.  Those are NOT valid i386 opcodes!  </p>



<p class="wp-block-paragraph">Just because it compiled didn&#8217;t mean it actually worked.</p>



<p class="wp-block-paragraph">I used MinGW to build the same source, same Makefile, and I got a working executable.  Annoyed I started compiling random files with Microsoft C, and finally found the file that broke it all, it turned out to be insn-output.c needing to be compiled with the &#8220;/D__STDC__&#8221; flags.  A quick modification of the Makefile and now I have a working CC1!</p>



<p class="wp-block-paragraph">Okay, great, it&#8217;s well known back in the early dangerous ages of the 1980&#8217;s/1990&#8217;s that everyone wasn&#8217;t running Linux, nor were binary distributions of GCC that far spread, rather I think to re-enforce the source was available it was expected that you&#8217;d use your system compiler.  Systems like <a href="https://sourceforge.net/projects/crossdjgppv1/" target="_blank" rel="noreferrer noopener">DJGPP</a>/<a href="https://sourceforge.net/projects/crossemx/" target="_blank" rel="noreferrer noopener">EMX</a> take the path of binding a.out object files into something that MS-DOS can run via a dos extender, or the bind utility to allow you to run the a.out on OS/2.  What I wan&#8217;t to do is verify that in fact <a href="https://archive.org/details/windows-nt-3.1-build-239">Windows NT was a viable host for GCC back in the public pre-releases of 1991</a>.</p>



<p class="wp-block-paragraph">I&#8217;m sticking with the December build 239 version as it has working floating point.  Something that GCC has intrinsic support of, and I don&#8217;t feel like trying to work out emulation.</p>



<p class="wp-block-paragraph">The next step is to try to build it with the family mode-OS/2 version of the C compiler, which of course lead to the real issue of this 16bit hosted cross compiler:</p>



<pre class="wp-block-code"><code>        cl386 /u /Od /Ic:\MSVC32S\C386\INCLUDE /I. /Iconfig /c combine.c
Microsoft (R) Microsoft 386 C Compiler. Version 1.00.075
Copyright (c) Microsoft Corp 1984-1989. All rights reserved.

combine.c
combine.c(1734) : fatal error C1002: compiler is out of heap space in Pass 2
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'
Stop.
</code></pre>



<p class="wp-block-paragraph">Very frustrating.  I tried mixing and matching from Visual C++ 1.0 &amp; this old compiler, and while it did compile, it doesn&#8217;t run. does it mean anything?!</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt.png"><img loading="lazy" decoding="async" width="797" height="288" src="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt.png" alt="" class="wp-image-13734" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt.png 797w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt-300x108.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt-768x278.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/gcc-140-compiled-on-nt-500x181.png 500w" sizes="auto, (max-width: 797px) 100vw, 797px" /></a><figcaption class="wp-element-caption">GCC 1.40 compiled by Microsoft 386 C Compiler. Version 1.00.075</figcaption></figure>



<p class="wp-block-paragraph">I should point out that this should be an expected working configuration as GCC does build on Xenix using the 32bit Microsoft C 5.1/386 compiler.  Furthered again that Xenix and these 1991 versions of NT use the same 32bit OMF object format.  And expanding on the Xenixnt experiment using the Xenix&#8217;ified GAS assembler with old Visual C++ includes &amp; libraries to produce a possible retro-early port of GCC to NT, the next move is to bulid GAS on NT.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt.png"><img loading="lazy" decoding="async" width="793" height="286" src="https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt.png" alt="" class="wp-image-13735" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt.png 793w, https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt-300x108.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt-768x277.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/xenix-gas-on-nt-500x180.png 500w" sizes="auto, (max-width: 793px) 100vw, 793px" /></a><figcaption class="wp-element-caption">Xenix GAS 1.38 compiled by by Microsoft 386 C Compiler. Version 1.00.075</figcaption></figure>



<p class="wp-block-paragraph">GAS gave me some weird issues with ctype.h where it runs fine with the one from Visual C++ 1.0 but the OS/2 &amp; NT pre-release both fail.  However the old Pre-release compiler cannot deal with the much newer ctype include file.  So after much hammering I amputated whatever was bothering it, and it&#8217;s just enough to build &amp; run. Great!</p>



<p class="wp-block-paragraph">Going back to the phases, I used a simple hello world program:</p>



<pre class="wp-block-code"><code>void main() {
 printf("Hello World!\n");
}</code></pre>



<p class="wp-block-paragraph">While not being a good program, it doesn&#8217;t include stdio.h, nor does it return anything. It&#8217;s terrible.  But in this case it allows me to be lazy and sidestep the pre-processor cpp.exe.  This way I can just directly run it through cc1 and get my assembler file hi.S</p>



<p class="wp-block-paragraph">Next I pass it to ax386 (GAS) and get the resulting object file hi.OBJ</p>



<p class="wp-block-paragraph">And finally link it with link.exe in this case.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991.png"><img loading="lazy" decoding="async" width="793" height="286" src="https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991.png" alt="" class="wp-image-13736" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991.png 793w, https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991-300x108.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991-768x277.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/hello-world-from-dec-1991-500x180.png 500w" sizes="auto, (max-width: 793px) 100vw, 793px" /></a><figcaption class="wp-element-caption">Hello World from GCC 1.40 on NT!</figcaption></figure>



<p class="wp-block-paragraph">And with all the drama I&#8217;ve now compiled a simple hello world program on Windows NT.</p>



<p class="wp-block-paragraph">If it were 1991, I would hollow out gcc.c so it doesn&#8217;t use signals or forks to invoke the needed phases, and of course build the pre-processor.  In addition, libgcc needs to be compiled to allow for floating point operations to work correctly.  None of which is impossible, although I&#8217;m not sure it&#8217;s all that needed as it isn&#8217;t 1991.</p>



<figure class="wp-block-image size-full"><a href="https://archive.org/details/phoon-on-1991-dec-nt" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="797" height="283" src="https://virtuallyfun.com/wp-content/uploads/2024/01/phoon-on-1991-dec-nt.png" alt="" class="wp-image-13755" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/phoon-on-1991-dec-nt.png 797w, https://virtuallyfun.com/wp-content/uploads/2024/01/phoon-on-1991-dec-nt-300x107.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/phoon-on-1991-dec-nt-768x273.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/phoon-on-1991-dec-nt-500x178.png 500w" sizes="auto, (max-width: 797px) 100vw, 797px" /></a><figcaption class="wp-element-caption">phoon</figcaption></figure>



<p class="wp-block-paragraph">With a little bit more work, I got the floating point support to compile, which relies on both a working &#8216;native&#8217; compiler, and a working GCC to compile the 2nd half.  I usually use <a href="https://www.acme.com/software/phoon/">phoon</a>, or <a href="https://www.acme.com/software/phoon/">Phases of the Moon</a>, to test floating point, and as you can see, it&#8217;s working!</p>



<p class="wp-block-paragraph">I&#8217;m not sure if there was a 32bit version of Microsoft C/386 available for Microsoft OS/2 2.00 betas.  Also, I don&#8217;t know if the Microsoft link386 for OS/2 can also link Xenix 386 object files?  Would it have been possible to bootstrap GCC/GAS on Microsoft OS/2 2.00?  I really don&#8217;t know, and as of this writing no versions of the old Microsoft OS/2 2.00 betas have surfaced.</p>



<p class="wp-block-paragraph"><strong>** update</strong> from the future, turns out that I found a way to convince the cl386 compilers from the NT Pre-Releases in 1991 to re-build an existing GCC that was built for NT.  The catch is the linker, LINK386 of course, as the format was constantly changing.  However the object files are fine, and I was able to just copy them over on diskette and re-link the compiler.  It even ran.  It&#8217;s not tested at all, so it turns out the 1989 compiler wasn&#8217;t good enough, but the 1991 was.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/gcc-on-early-os2-beta.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="798" height="438" src="/wp-content/uploads/2024/02/gcc-on-early-os2-beta.png" alt="" class="wp-image-13916" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/gcc-on-early-os2-beta.png 798w, https://virtuallyfun.com/wp-content/uploads/2024/02/gcc-on-early-os2-beta-300x165.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/gcc-on-early-os2-beta-768x422.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/gcc-on-early-os2-beta-500x274.png 500w" sizes="auto, (max-width: 798px) 100vw, 798px" /></a><figcaption class="wp-element-caption">GCC 1.40 on OS/2 2.00 beta 6.123</figcaption></figure>



<p class="wp-block-paragraph">It&#8217;s interesting to me to see that <a href="https://virtuallyfun.com/2014/09/26/did-you-know-that-gcc-used-to-support-windows-nt/" target="_blank" rel="noreferrer noopener">even before GCC 2.6</a>, that vintage versions from 1991 would compile and run directly on Windows NT.</p>



<p class="wp-block-paragraph">I uploaded the source on <a href="https://github.com/neozeed/gcc-140_gas-138_WindowsNT_v239">github</a>, along with <a href="https://github.com/neozeed/gcc-140_gas-138_WindowsNT_v239/releases">some binaries</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Cross compiling to BSD on Windows (BOW) from Win32</title>
		<link>https://virtuallyfun.com/2023/12/12/cross-compiling-to-bsd-on-windows-bow-from-win32/</link>
					<comments>https://virtuallyfun.com/2023/12/12/cross-compiling-to-bsd-on-windows-bow-from-win32/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Tue, 12 Dec 2023 00:42:53 +0000</pubDate>
				<category><![CDATA[386BSD]]></category>
		<category><![CDATA[80386]]></category>
		<category><![CDATA[cross compiler]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13554</guid>

					<description><![CDATA[On the heels of discovering BOW, I thought I&#8217;d try to make a cross compiler. Attempts at running binaries on *BSD systems had mixed results, although I thought it was interesting that my old Linux a.out cross compiler can generate &#8230; <a href="https://virtuallyfun.com/2023/12/12/cross-compiling-to-bsd-on-windows-bow-from-win32/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><a href="https://virtuallyfun.com/2023/12/08/bsd-on-windows-things-i-wish-i-knew-existed/">On the heels of discovering BOW</a>, I thought I&#8217;d try to make a cross compiler.  Attempts at running binaries on *BSD systems had mixed results, although I thought it was interesting that my old <a href="https://sourceforge.net/projects/linux011/">Linux a.out cross compiler</a> can generate object files BOW can happily link, although anything more complicated resulted in disaster.  As part of that project I had build a 386BSD 0.1 cross so I figured that&#8217;d be worth a shot.</p>



<p class="wp-block-paragraph">And it worked!</p>



<p class="wp-block-paragraph">Sor for the two or three people who care here we go! </p>



<p class="wp-block-paragraph"><a href="https://sourceforge.net/projects/linux011/files/bow-win32-cross.7z/download">bow-win32-cross.7z</a></p>



<p class="wp-block-paragraph">I&#8217;ve been using DOSBox as it makes shuffling files through the dfs much more easier to test stuff.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-hello.png" alt="" class="wp-image-13556" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-hello.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-hello-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-hello-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">hello world</figcaption></figure>



<p class="wp-block-paragraph">First a simple hello world</p>



<p class="wp-block-paragraph">I should break down how to build this with a super involved and unnecessarily complicated Makefile!</p>



<pre class="wp-block-code"><code># File: Makefile (unix version)

CC = gcc
CC1 = cc1
AS = a386
CPP = cpp

LD = ld

EXE = hi

OBJ =	 hi.obj


CFLAGS= -O -m80387
INCLUDES = -I../../include
CPPFLAGS = -v -undef -D__GNUC__ -Dunix -Di386 -D__unix__ -D__i386__ -D__386BSD__
LIBS = -L..\..\lib -lc -lgnulib -lm
CRT0 = ../../lib/crt0.o

$(EXE): $(OBJ)
	$(LD) -o $(EXE) $(CRT0) $(OBJ) $(LIBS)

%.obj: %.c
	$(CPP) $(INCLUDES) $(CPPFLAGS) $&lt; $*.i
	$(CC1) $*.i -quiet $(CFLAGS) -version -o $*.S
	$(AS) $*.S -o $*.obj


clean:
	@rm $(EXE) $(OBJ) *.S *.i

dclean:
	@rm /f $(OBJ) *.S *.i

</code></pre>



<p class="wp-block-paragraph">I&#8217;ve broken this up into each of GCC&#8217;s phases (programs) so that I can inspect the output of each as I go.  This also lets me control exactly what gets passed where.  And in this case forces the use of the 80387 where/when needed.  It&#8217;s also nice to see where and what gets pulled in by the C pre-processor what magical numbers are set, and of course to see how the calling conventions work in the resulting assembler file.  While I had built this around the idea of cross compiling the 386BSD 0.1 kernel, it&#8217;s still fascinating to me that it can be hammered into making BOW compatible executables.  Although I didn&#8217;t update the CPP flags, no doubt I probably should as the headers probably expect something more FreeBSD.</p>



<p class="wp-block-paragraph">Running make yields:</p>



<pre class="wp-block-code"><code>C:\bow\src\hello>make
cpp -I../../include -v -undef -D__GNUC__ -Dunix -Di386 -D__unix__ -D__i386__ -D__386BSD__ hi.c hi.i
GNU CPP version 1.39
cc1 hi.i -quiet -O -m80387 -version -o hi.S
GNU C version 1.39 (80386, BSD syntax) compiled by GNU C version 7.1.0.
default target switches: -m80387
a386 hi.S -o hi.obj
ld -o hi ../../lib/crt0.o hi.obj -L..\..\lib -lc -lgnulib -lm

C:\bow\src\hello>size hi
text    data    bss     dec     hex
24576   4096    0       28672   7000

C:\bow\src\hello>wsl file hi
hi: a.out little-endian 32-bit demand paged pure executable not stripped

C:\bow\src\hello></code></pre>



<p class="wp-block-paragraph">It should also probably be worth mentioning that the linage of BOW has to be in the dark days of the AT&amp;T v CSRG/BSDi lawsuit as this toolchain does produce binaries that run, unlike the 1.0 phase of both NetBSD/FreeBSD where they dumped all the prior code and forked harder from <a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.4/386BSD-0.1.exe/download">the common 386BSD 0.1</a> that we all loved.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-fib.png" alt="" class="wp-image-13557" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-fib.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-fib-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-fib-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">fib</figcaption></figure>



<p class="wp-block-paragraph">Simple Fibonacci sequence</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-infocom-87.png" alt="" class="wp-image-13558" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-infocom-87.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-infocom-87-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-infocom-87-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">Inform &#8217;87 interpreter</figcaption></figure>



<p class="wp-block-paragraph">My favorite ZIP interpreter</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-32016.png" alt="" class="wp-image-13559" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-32016.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-32016-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-32016-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">NS32016 emulator</figcaption></figure>



<p class="wp-block-paragraph">Now this one is interesting it&#8217;s a <a href="https://virtuallyfun.com/2021/10/01/32016-stand-alone-planetfall/">NS32016 emulator</a>!  I left the ns32016 cross in the data directory if you want to generate the data file.  I was surprised it worked, but wow!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-phoon.png" alt="" class="wp-image-13561" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-phoon.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-phoon-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-phoon-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">phoon</figcaption></figure>



<p class="wp-block-paragraph">Phases of the moon may not seem all that exciting at first, but the big thing is the handling of the math coprocessor, and of course to be sure to link against the BOW libm.  Otherwise it just hangs the system.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="513" src="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-trek.png" alt="" class="wp-image-13560" srcset="https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-trek.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-trek-300x240.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/12/bow-cross-trek-375x300.png 375w" sizes="auto, (max-width: 642px) 100vw, 642px" /><figcaption class="wp-element-caption">trek</figcaption></figure>



<p class="wp-block-paragraph">And of course the old TREK game from Unix lore.</p>



<p class="wp-block-paragraph">I would imagine that a newer version of GCC or at least CC1 should be easy enough to build, and of course cross compiling gives you an out of the 16MB RAM limit that WINMEM32 imposes.</p>



<p class="wp-block-paragraph">The biggest WTF I had was for Hack 1.03.  I&#8217;m not sure why it didn&#8217;t want to link, but rest assured, the cross compiled objects just linked fine. I don&#8217;t know.</p>



<p class="wp-block-paragraph">In other BOW news I have been in contact with the author, I don&#8217;t want to bother him too much but I&#8217;ll try to glean a lot more info from him.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2023/12/12/cross-compiling-to-bsd-on-windows-bow-from-win32/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Since people were asking for xMach binaries</title>
		<link>https://virtuallyfun.com/2023/07/11/since-people-were-asking-for-xmach-binaries/</link>
					<comments>https://virtuallyfun.com/2023/07/11/since-people-were-asking-for-xmach-binaries/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Tue, 11 Jul 2023 07:00:10 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[lites]]></category>
		<category><![CDATA[mach]]></category>
		<guid isPermaLink="false">http://virtuallyfun.com/?p=12961</guid>

					<description><![CDATA[Since binaries had been requested, along with the old elf cross compiler I thought I&#8217;d try that new fangled github binary releases. This is just taken from old artifacts from the old Building OSkit &#38; xMach adventures. I had made &#8230; <a href="https://virtuallyfun.com/2023/07/11/since-people-were-asking-for-xmach-binaries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/07/xmach-booted-2023-linux-cal.png"><img loading="lazy" decoding="async" width="722" height="427" src="https://virtuallyfun.com/wp-content/uploads/2023/07/xmach-booted-2023-linux-cal.png" alt="" class="wp-image-12962" srcset="https://virtuallyfun.com/wp-content/uploads/2023/07/xmach-booted-2023-linux-cal.png 722w, https://virtuallyfun.com/wp-content/uploads/2023/07/xmach-booted-2023-linux-cal-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/07/xmach-booted-2023-linux-cal-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></a><figcaption class="wp-element-caption">xMach doing it&#8217;s Linux calibration</figcaption></figure>



<p class="wp-block-paragraph">Since binaries had been requested, along with the old elf cross compiler I thought I&#8217;d try that new fangled <a href="https://github.com/neozeed/xMach/releases/tag/v1_0" target="_blank" rel="noreferrer noopener">github binary releases</a>.</p>



<ul class="wp-block-list">
<li><a href="https://github.com/neozeed/xMach/releases/download/v1_0/i586-linux2.tar.gz">i586-linux2.tar.gz</a></li>



<li><a href="https://github.com/neozeed/xMach/releases/download/v1_0/Mach">Mach</a></li>



<li><a href="https://github.com/neozeed/xMach/releases/download/v1_0/emulator.Lites.1.1.u3">emulator.Lites.1.1.u3</a></li>



<li><a href="https://github.com/neozeed/xMach/releases/download/v1_0/startup.Lites.1.1.u3.STD+WS+ext2fs+msdosfs+slice+mach4">startup.Lites.1.1.u3.STD+WS+ext2fs+msdosfs+slice+mach4</a></li>
</ul>



<p class="wp-block-paragraph">This is just taken from old artifacts from the old <a rel="noreferrer noopener" href="/2020/09/03/building-oskit/" target="_blank">Building OSkit</a> &amp; <a href="/2021/06/09/xmach/" target="_blank" rel="noreferrer noopener">xMach</a> adventures.</p>



<p class="wp-block-paragraph">I had made a vmdk, <a rel="noreferrer noopener" href="https://master.dl.sourceforge.net/project/bsd42/4BSD%20under%20Windows/v0.4/MachUK22-lites.vmdk.7z?viasf=1" target="_blank">MachUK22-lites.vmdk.7z</a> as well, not sure if that helps anyone.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2023/07/11/since-people-were-asking-for-xmach-binaries/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fun with Windows ePDK NT 3.1 build 196 &#038; Some Xenix fun!</title>
		<link>https://virtuallyfun.com/2023/06/01/fun-with-windows-epdk-nt-3-1-build-196-some-xenix-fun/</link>
					<comments>https://virtuallyfun.com/2023/06/01/fun-with-windows-epdk-nt-3-1-build-196-some-xenix-fun/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 01 Jun 2023 10:24:11 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[microsoft windows]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Win32s]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<category><![CDATA[Xenix]]></category>
		<guid isPermaLink="false">http://virtuallyfun.com/?p=12733</guid>

					<description><![CDATA[I&#8217;m not sure if I covered the Windows NT 3.1 build 196 before. First the most obvious is that as of this moment it&#8217;s the earliest version of Windows NT available. So let&#8217;s do some obligatory scratch of the surface. &#8230; <a href="https://virtuallyfun.com/2023/06/01/fun-with-windows-epdk-nt-3-1-build-196-some-xenix-fun/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I&#8217;m not sure if I covered the Windows <a rel="noreferrer noopener" href="https://archive.org/details/windows-nt-3.1-build-196" data-type="URL" data-id="https://archive.org/details/windows-nt-3.1-build-196" target="_blank">NT 3.1 build 196 before</a>. First the most obvious is that as of this moment it&#8217;s the earliest version of Windows NT available.</p>



<figure class="wp-block-image size-full"><a href="https://archive.org/details/windows-nt-3.1-build-196"><img loading="lazy" decoding="async" width="1000" height="1000" src="https://virtuallyfun.com/wp-content/uploads/2023/06/WindowsNT196Disc.jpg" alt="" class="wp-image-12734" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/WindowsNT196Disc.jpg 1000w, https://virtuallyfun.com/wp-content/uploads/2023/06/WindowsNT196Disc-300x300.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/WindowsNT196Disc-150x150.jpg 150w, https://virtuallyfun.com/wp-content/uploads/2023/06/WindowsNT196Disc-768x768.jpg 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a></figure>



<p class="wp-block-paragraph">So let&#8217;s do some obligatory scratch of the surface. Like all the other 1991 pre-releases there really is just a text mode setup install script. Choosing the lesser amount of pain, I went with a MS-DOS hosted install.  However, using MS-DOS 6.22 resulted in a broken dual boot system.  But we live in the era of virtual machines, so it really doesn&#8217;t matter.  I&#8217;m using <a rel="noreferrer noopener" href="https://archive.org/details/qemu-14.0-rc2-i386" target="_blank">Qemu 0.14-rc2</a>, something that is &#8216;era correct&#8217; for when the first avalanche broke on early Windows NT pre-releases.  I&#8217;ve had issues with more modern versions of Qemu, and I felt that if we&#8217;re using vintage software may as well go in all the way.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-boot-banner.png"><img loading="lazy" decoding="async" width="722" height="457" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-boot-banner.png" alt="" class="wp-image-12736" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-boot-banner.png 722w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-boot-banner-300x190.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-boot-banner-474x300.png 474w" sizes="auto, (max-width: 722px) 100vw, 722px" /></a></figure>



<p class="wp-block-paragraph">The boot loader identifies itself as being 1990 vintage.  Pretty sure it doesn&#8217;t mean anything, but we haven&#8217;t been blessed with the &#8220;blue screen&#8221; of ARC yet.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-login-screen.png"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-login-screen.png" alt="" class="wp-image-12738" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-login-screen.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-login-screen-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-login-screen-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">The login screen and desktop have a very strong Windows 3.1 beta feel to them.  And that would land this where it was, Windows was such a big seller that Maritz had been trying to convince Gates &amp; Balmer to &#8216;switch to the Windows horse&#8217; in the spring/summer of 1990, culminating in Gate&#8217;s July decision to walk away from NT/OS2 and rebrand the new OS as Windows NT.  Oddly enough it was Balmer who was in favour of OS/2 &amp; IBM. (<em>Showstopper 89-90</em>)</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-desktop.png"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-desktop.png" alt="" class="wp-image-12739" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-desktop.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-desktop-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-desktop-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">At first glance the opening window isn&#8217;t all that interesting.  It&#8217;s just very. Windows.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-reversi.png"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-reversi.png" alt="" class="wp-image-12744" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-reversi.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-reversi-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-reversi-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">Rest assured <a rel="noreferrer noopener" href="https://youtu.be/DgJS2tQPGKQ?t=35" target="_blank">Reversi</a>, of course made the this Win32 cut.  And it&#8217;s full of weird easter eggs, oddly enough in the OS/2 surviving bits.</p>



<pre class="wp-block-code"><code>type OS2LDR.DOS
OS2LDR 01.00.01
by KeithMo 01/08/91</code></pre>



<p class="wp-block-paragraph">On the <a rel="noreferrer noopener" href="https://discord.gg/HMwevcN" target="_blank">Discord</a> there had been a big discussion about early NT executable formats, and the whole COFF vs ECOFF vs PE/PEI. I had tried to hunt down the specific version of GCC I used ages to to build a so called <a rel="noreferrer noopener" href="https://virtuallyfun.com/2016/12/09/gcc-windows-nt-dec-alpha/" target="_blank">Dec Alpha GCC cross compiler</a>, but the short version is that it didn&#8217;t work as we don&#8217;t have any assembler/linker for anything GNU targets.  There had been a <a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">cygwin port </a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">a</a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">n</a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">d</a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank"> </a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">a</a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">n</a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank"> </a><a rel="noreferrer noopener" href="https://archive.org/details/gcc-alpha-b19-src.tar" target="_blank">OpenNT on Alpha</a>, but all that is lost to the winds, minus what few scraps I had saved.  I did try building some cross tools to elf hoping to just objcopy out the data and get linkable objects, but that didn&#8217;t work either.</p>



<p class="wp-block-paragraph">So I though this was a perfect opportunity to take a look at this early pre-release version of NT, and although I do know that you have to convert your objects into something the &#8216;COFF&#8217; linker will accept:</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/building-the-simple-text-mode-app-on-196.png"><img loading="lazy" decoding="async" width="642" height="106" src="https://virtuallyfun.com/wp-content/uploads/2023/06/building-the-simple-text-mode-app-on-196.png" alt="" class="wp-image-12745" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/building-the-simple-text-mode-app-on-196.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/building-the-simple-text-mode-app-on-196-300x50.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/building-the-simple-text-mode-app-on-196-500x83.png 500w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">And I never really paid that much attention to the object files.  I do know that you can link them with <a rel="noreferrer noopener" href="https://virtuallyfun.com/2021/05/11/continuing-with-ancient-microsoft-c-linkers/" target="_blank">Link386 for OS/2</a>, but the NT object files themselves report:</p>



<pre class="wp-block-code"><code>wsl file SIMPLE.OBJ
SIMPLE.OBJ: Intel 80386 COFF object file, not stripped, 4 sections, symbol offset=0x102, 20 symbols, created Thu Jun  1 14:13:50 2023, 1st section name ".text"</code></pre>



<p class="wp-block-paragraph">Well, now that is interesting.  And of course the COFF thing reminded me of Xenix!  And sure enough ages ago I had found the source to a modified version of <a rel="noreferrer noopener" href="https://github.com/neozeed/gas-1.38-xenix-" target="_blank">GNU GAS that outputs COFF</a>.  Once more again this is an indication that all 386 roads in Microsoft really did originate with Xenix.  It&#8217;s too bad there never was a Windows/386 on Xenix/386.  What an incredible OS that would have been!  There must be some incredible stories from the tool teams that worked on Microsoft C/386 along with other projects.  Oddly enough they never get anywhere near as much exposure as Office or OS.</p>



<p class="wp-block-paragraph">Now this is fun, but nothing takes in these ancient COFF objects, do they?  I tried to run LINK 1.0 from <a href="https://virtuallyfun.com/2011/04/04/win32s-version-tour/" target="_blank" rel="noreferrer noopener">Win32s SDK</a> and surprisingly it didn&#8217;t complain about the object, rather, it auto converted it in memory:</p>



<pre class="wp-block-code"><code>Microsoft (R) 32-Bit Executable Linker Version 1.00
Copyright (C) Microsoft Corp 1992-93. All rights reserved.

SIMPLE.OBJ : warning LNK4016: unresolved external symbol "__chkstk"
LINK : warning LNK4016: unresolved external symbol "_mainCRTStartup"
SIMPLE.OBJ : warning LNK4016: unresolved external symbol "_printf"
SIMPLE.exe : error LNK1120: 3 unresolved externals</code></pre>



<p class="wp-block-paragraph">Does this mean that if I give it some libraries it will actually link?</p>



<pre class="wp-block-code"><code>LINK.EXE SIMPLE.OBJ /SUBSYSTEM:CONSOLE /MACHINE:i386 -entry:mainCRTStartup -out:simple.exe libc.lib kernel32.lib
Microsoft (R) 32-Bit Executable Linker Version 1.00
Copyright (C) Microsoft Corp 1992-93. All rights reserved.


C:\temp\nt196\x\dec\x&gt;simple
Win32, it's happenin'!</code></pre>



<p class="wp-block-paragraph">This was. VERY unexpected.</p>



<p class="wp-block-paragraph">So I had this crazy idea, what if the Xenix assembler could in fact build objects that are also compaible in this manner?  I used the <a rel="noreferrer noopener" href="https://sourceforge.net/projects/linux011/" target="_blank">a.out GCC / Linux porting tools</a> I had built so I could compile Linux on Windows NT using the vintage tools as a starting point.  I guess I should also add that when people always say &#8216;use newer version of THING&#8217; this is how you miss out on old stuff like this.  If I had been obsessed with using modern tools and modern operating systems, I&#8217;d have missed out on this Xenix filled window.</p>



<p class="wp-block-paragraph">I took the gcc driver &amp; the cc1 compiler from 1.40 and the c pre-processor from 2.5.8 as it can understand C++ comments.  First I manually compiled the &#8216;simple&#8217; example to assembly:</p>



<pre class="wp-block-code"><code>gcc -v -nostdinc -I/xenixnt/h -S SIMPLE.c -O simple.S
gcc version 1.40
 cpp -nostdinc -v -I/xenixnt/h -undef -D__GNUC__ -Dunix -Di386 -D__unix__ -D__i386__ -D__OPTIMIZE__ SIMPLE.c C:/Users/jsteve/AppData/Local/Temp/cca2_048.cpp
GNU CPP version 2.5.8 (80386, BSD syntax)
#include "..." search starts here:
#include &lt;...&gt; search starts here:
 /xenixnt/h
End of search list.
 cc1 C:/Users/jsteve/AppData/Local/Temp/cca2_048.cpp -quiet -dumpbase SIMPLE.c -O -version -o SIMPLE.s
GNU C version 1.40 (80386, BSD syntax) compiled by GNU C version 5.1.0.
default target switches: -m80387
 cpp -nostdinc -v -I/xenixnt/h -undef -D__GNUC__ -$ -Dunix -Di386 -D__unix__ -D__i386__ -D__OPTIMIZE__ simple.S C:/Users/jsteve/AppData/Local/Temp/cca2_048.s
GNU CPP version 2.5.8 (80386, BSD syntax)
#include "..." search starts here:
#include &lt;...&gt; search starts here:
 /xenixnt/h
End of search list.</code></pre>



<p class="wp-block-paragraph">Which gave me the following assembly:</p>



<pre class="wp-block-code"><code>        .file   "SIMPLE.c"
gcc_compiled.:
.text
LC0:
        .ascii "Win32, it's happenin'!\0"
        .align 2
.globl _main
_main:
        pushl %ebp
        movl %esp,%ebp
        pushl $LC0
        call _printf
        leave
        ret
</code></pre>



<p class="wp-block-paragraph">Now to assemble with the GAS Xenix assembler</p>



<pre class="wp-block-code"><code>C:\temp\nt196\files\MSTOOLS\SAMPLES\SIMPLE&gt;ax386 SIMPLE.s -o SIMPLE.obj

C:\temp\nt196\files\MSTOOLS\SAMPLES\SIMPLE&gt;wsl file SIMPLE.obj
SIMPLE.obj: 8086 relocatable (Microsoft), "SIMPLE.c", 1st record data length 10, 2nd record type 0x88, 2nd record data length 11</code></pre>



<p class="wp-block-paragraph">Not quite the same.  But it does closer resemble the output from the OS/2 bound versions of the Pre-Rease compilers:</p>



<pre class="wp-block-code"><code>file EMPTY.OBJ
EMPTY.OBJ: 8086 relocatable (Microsoft), "empty.c", 1st record data length 9, 2nd record type 0x88, 2nd record data length 7</code></pre>



<p class="wp-block-paragraph">So will it link?!</p>



<pre class="wp-block-code"><code>C:\temp\nt196\files\MSTOOLS\SAMPLES\SIMPLE&gt;LINK.EXE SIMPLE.OBJ /SUBSYSTEM:CONSOLE /MACHINE:i386 -entry:mainCRTStartup -out:simple.exe libc.lib kernel32.lib
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

SIMPLE.OBJ : warning LNK4033: converting object format from OMF to COFF

C:\temp\nt196\files\MSTOOLS\SAMPLES\SIMPLE&gt;simple
Win32, it's happenin'!</code></pre>



<p class="wp-block-paragraph">Well now this is interesting!  LONG before MinGW, or the <a rel="noreferrer noopener" href="https://virtuallyfun.com/2014/09/26/did-you-know-that-gcc-used-to-support-windows-nt/" target="_blank">GCC port to Windows NT</a>, it turns out that in fact GCC could target Windows NT the entire time!</p>



<p class="wp-block-paragraph">So the next thing to do is something not as trivial, like <a rel="noreferrer noopener" href="https://www.acme.com/software/phoon/" target="_blank">phoon</a>.</p>



<p class="wp-block-paragraph">I setup some quick script to pre-process, compile, assemble and then try to link, but as this one uses floating point, disaster struck:</p>



<pre class="wp-block-code"><code>phoon.obj : error LNK2001: unresolved external symbol "___fixdfsi"
astro.obj : error LNK2001: unresolved external symbol "___fixdfsi"
phoon.exe : error LNK1120: 1 unresolved externals</code></pre>



<p class="wp-block-paragraph">Now ages ago while messgin with old GCC &amp; DooM I also had weird math calls not working.  In the end I ended up extracting them from libgcc builds, so I thought I&#8217;d try the libgcc built during the GCC 2.6.3 on NT adventure.</p>



<pre class="wp-block-code"><code>link /NODEFAULTLIB:libc.lib /NODEFAULTLIB:OLDNAMES.LIB -out:phoon.exe astro.obj date_p.obj phoon.obj -entry:mainCRTStartup libgcc1.lib LIBC.LIB KERNEL32.LIB
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.</code></pre>



<p class="wp-block-paragraph">And of course:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="979" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/phoon-gcc-on-nt.png" alt="" class="wp-image-12748" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/phoon-gcc-on-nt.png 979w, https://virtuallyfun.com/wp-content/uploads/2023/06/phoon-gcc-on-nt-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/phoon-gcc-on-nt-768x402.png 768w, https://virtuallyfun.com/wp-content/uploads/2023/06/phoon-gcc-on-nt-500x261.png 500w" sizes="auto, (max-width: 979px) 100vw, 979px" /></figure>
</div>


<p class="wp-block-paragraph">To try to make the steps make a little more sense, and to allow for some higher level of automation I made a Makefile:</p>



<pre class="wp-block-code"><code>CC=gcc
CC1=cc1
AS=ax386
CPP=cpp


CFLAGS= -O
CPPFLAGS= -lang-c-c++-comments -nostdinc -I/xenixnt/h

OBJ =   astro.obj \
date_p.obj \
phoon.obj

LIBS = libgcc1.lib LIBC.LIB KERNEL32.LIB

phoon.exe: $(OBJ)
        link -out:phoon.exe $(OBJ) -entry:mainCRTStartup $(LIBS)

%.obj: %.c
        $(CPP) $(CPPFLAGS) $&lt; $*.i
        $(CC1) $*.i -quiet $(CFLAGS) -version -o $*.S
        $(AS) $*.S -o $*.obj


clean:
        del $(OBJ) *.i *.S phoon.exe</code></pre>



<p class="wp-block-paragraph">I&#8217;m sure there is better ways to do this, but it breaks the compile up to it&#8217;s individual parts:</p>



<p class="wp-block-paragraph">Run the pre-processor to allow // in the comments, C++ hadn&#8217;t been the default thing back when GCC 1.40 was a thing.  Also path it to the headers, in this case I&#8217;m using the ones from NT 196.  Trying to link with the 196 libraries gave me this:</p>



<pre class="wp-block-code"><code>C:\xenixnt\demos\phoon&gt;link /NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:OLDNAMES.LIB -out:phoon.exe astro.obj date_p.obj phoon.obj -entry:mainCRTStartup base.lib wincrt.lib ntdll.lib \xenixnt\lib\libgcc1.lib
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

wincrt.lib(maincrt0.obj) : warning LNK4078: multiple ".data" sections found with different attributes (40000040)
astro.obj : error LNK2001: unresolved external symbol "_asin"
astro.obj : error LNK2001: unresolved external symbol "_atan"
astro.obj : error LNK2001: unresolved external symbol "_atan2"
phoon.obj : error LNK2001: unresolved external symbol "_cos"
astro.obj : error LNK2001: unresolved external symbol "_cos"
astro.obj : error LNK2001: unresolved external symbol "_floor"
astro.obj : error LNK2001: unresolved external symbol "_sin"
phoon.obj : error LNK2001: unresolved external symbol "_sqrt"
astro.obj : error LNK2001: unresolved external symbol "_sqrt"
astro.obj : error LNK2001: unresolved external symbol "_tan"
phoon.exe : error LNK1120: 8 unresolved externals</code></pre>



<p class="wp-block-paragraph">Which is not surprising as there is no FPU/Floating point math support in 196. I tried the December 1991 Pre-Release, but it failed for other reasons:</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle.png"><img loading="lazy" decoding="async" width="968" height="364" src="https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle.png" alt="" class="wp-image-12750" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle.png 968w, https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle-300x113.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle-768x289.png 768w, https://virtuallyfun.com/wp-content/uploads/2023/06/missing-CloseConsoleHandle-500x188.png 500w" sizes="auto, (max-width: 968px) 100vw, 968px" /></a></figure>



<p class="wp-block-paragraph">I did copy over BASE.DLL BASERTL.DLL CSR.DLL DBGDLL.DLL as it wanted, but despite the symbol being in the DLL it didn&#8217;t load.</p>



<p class="wp-block-paragraph">So that&#8217;s why I&#8217;m using the libraries from the <a href="https://virtuallyfun.com/2011/04/04/win32s-version-tour/" target="_blank" rel="noreferrer noopener">Win32s SDK</a>.</p>



<p class="wp-block-paragraph">Okay, so far now we have GCC 1.40 compiling to an old Xenix GAS assembler, and linking with Microsoft link from Visual C++ 1.0/2.0 era.  The next step is to see if we can just link the objects under 196, and get a running EXE!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-running-GCC-compiled-fib.png" alt="" class="wp-image-12742" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-running-GCC-compiled-fib.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-running-GCC-compiled-fib-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-running-GCC-compiled-fib-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">I have this tiny fibonacci example program, so with it compiled &amp; assembled by GCC &amp; GAS, I did the final link under 196, and YES it runs!</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-linking-and-running-GCC-compiled-infocom.png"><img loading="lazy" decoding="async" width="642" height="512" src="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-linking-and-running-GCC-compiled-infocom.png" alt="" class="wp-image-12751" srcset="https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-linking-and-running-GCC-compiled-infocom.png 642w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-linking-and-running-GCC-compiled-infocom-300x239.png 300w, https://virtuallyfun.com/wp-content/uploads/2023/06/Windows-NT-196-linking-and-running-GCC-compiled-infocom-376x300.png 376w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">I then built the <a rel="noreferrer noopener" href="https://virtuallyfun.com/2014/12/15/tracking-down-the-infotaskforce-from-1987/" target="_blank">&#8217;87 InfoTaskForce</a>, <a rel="noreferrer noopener" href="https://virtuallyfun.com/2014/12/15/tracking-down-the-infotaskforce-from-1987/" target="_blank">Infocom interpreter</a>, and it was just a simple link, and it&#8217;s running!</p>



<p class="wp-block-paragraph">Possible things to do?  GCC should be able to build itself, so it should be possible to build GCC and link that on 196 or December 1991, and get a native version of GCC on NT.  The other possibility is to get newer versions of GCC (cc1 drop in replacements) to build for Xenix and / or OS/2.  Obviously this Xenix linker is the gateway to older 386 Microsoft based products!</p>



<p class="wp-block-paragraph">For those interested in such things, I&#8217;ve uploaded all of this to <a href="https://archive.org/details/windows-nt-196-linking-and-running-gcc" target="_blank" rel="noreferrer noopener">archive.org here: windows-nt-196-linking-and-running-gcc</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2023/06/01/fun-with-windows-epdk-nt-3-1-build-196-some-xenix-fun/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>On the trail of PCC for the 8086</title>
		<link>https://virtuallyfun.com/2022/11/04/on-the-trail-of-pcc-for-the-8086/</link>
					<comments>https://virtuallyfun.com/2022/11/04/on-the-trail-of-pcc-for-the-8086/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 04 Nov 2022 13:35:18 +0000</pubDate>
				<category><![CDATA[4.1 BSD]]></category>
		<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[pcc]]></category>
		<category><![CDATA[VAX]]></category>
		<category><![CDATA[VAX 11/780]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=12024</guid>

					<description><![CDATA[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 &#38; Borland C are not open in the &#8230; <a href="https://virtuallyfun.com/2022/11/04/on-the-trail-of-pcc-for-the-8086/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">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 &amp; Borland C are not open in the slightest.</p>



<p class="wp-block-paragraph">There is <a rel="noreferrer noopener" href="http://desmet-c.com/" target="_blank">DeSmet C</a>, although it&#8217;s source is full of unnamed structs meaning that building it with anything sane would require a &#8216;lot of work &#8482;&#8217; which of course is not what I&#8217;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&#8217;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!</p>



<p class="wp-block-paragraph">So to effectively get going you&#8217;ll need a SIMH VAX780 and just <a rel="noreferrer noopener" href="http://gunkies.org/wiki/Installing_4.1_BSD_on_SIMH" target="_blank">follow my old steps on Installing 4.1BSD</a>.  As far as the zip file, I used Linux but had to create a tar file specifying the Unix v7 format with:</p>



<pre class="wp-block-code"><code>tar --format=v7 -cf pcc.tar .</code></pre>



<p class="wp-block-paragraph">And of course, <a rel="noreferrer noopener" href="https://gunkies.org/wiki/Mkdisttap.pl" target="_blank">convert the tar file to a simh tap file</a>.  Or if you are like me, just download a tap file here: <a rel="noreferrer noopener" href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/PCC-Machines.tap.bz2/download" target="_blank">PCC-Machines.tap.bz2</a>.</p>



<p class="wp-block-paragraph">With that said it&#8217;s a very strange setup as it relies on the 4.1BSD Vax environment so much that there is assembly injected into the linker.  </p>



<pre class="wp-block-preformatted">asm("movc3 r8,(r11),(r7)");</pre>



<p class="wp-block-paragraph">So this will not cleanly run.  Just as it depends on many system a.out specifics on building for MS-DOS.  It&#8217;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.</p>



<p class="wp-block-paragraph">That is right it&#8217;s a VAX specific cross compiler that only build&#8217;s COM files.</p>



<p class="wp-block-paragraph">I&#8217;ve managed to build some trivial stuff, and they work.  Sadly my attempt at building that <a href="https://virtuallyfun.com/2014/12/15/tracking-down-the-infotaskforce-from-1987/" target="_blank" rel="noreferrer noopener">InfoTaskforce of &#8217;87</a> failed.</p>



<p class="wp-block-paragraph">I haven&#8217;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&#8217;t work, perhaps it&#8217;s something with packing structs?</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2022/11/hello-from-8086-pcc-VAX.png"><img loading="lazy" decoding="async" width="642" height="427" src="https://virtuallyfun.com/wp-content/uploads/2022/11/hello-from-8086-pcc-VAX.png" alt="" class="wp-image-12025" srcset="https://virtuallyfun.com/wp-content/uploads/2022/11/hello-from-8086-pcc-VAX.png 642w, https://virtuallyfun.com/wp-content/uploads/2022/11/hello-from-8086-pcc-VAX-300x200.png 300w, https://virtuallyfun.com/wp-content/uploads/2022/11/hello-from-8086-pcc-VAX-451x300.png 451w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></figure>



<p class="wp-block-paragraph">As always, the simple stuff looks trivial but it was a fair bit involved.</p>



<p class="wp-block-paragraph">Since there is no real &#8216;cc&#8217; it&#8217;s a script but the vauge steps are:</p>



<pre class="wp-block-preformatted">/lib/cpp -I/usr/src/pcc/Machines/8086/lib86/include hi.c hi.i
/usr/src/pcc/Machines/8086/c86/c86 &lt; hi.i &gt; 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</pre>



<p class="wp-block-paragraph">It kind of makes sense.</p>



<p class="wp-block-paragraph">Seems like somehow a lost opportunity in of itself back in the day</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2022/11/04/on-the-trail-of-pcc-for-the-8086/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
