<?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>gnu &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/gnu/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>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>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>When YYLEX shouldn&#8217;t be confused with yylex</title>
		<link>https://virtuallyfun.com/2022/11/13/when-yylex-shouldnt-be-confused-with-yylex/</link>
					<comments>https://virtuallyfun.com/2022/11/13/when-yylex-shouldnt-be-confused-with-yylex/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 13 Nov 2022 00:02:02 +0000</pubDate>
				<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=12056</guid>

					<description><![CDATA[While trying to build some old stuff I ran into this weird issue where YYLESX is undefined: Notice it&#8217;s all UPPERCASE, but you can find plenty on the lowercase issue where its not being linked correctly. And yeah turns out &#8230; <a href="https://virtuallyfun.com/2022/11/13/when-yylex-shouldnt-be-confused-with-yylex/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">While trying to build some old stuff I ran into this weird issue where YYLESX is undefined:</p>



<pre class="wp-block-code"><code>gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../.. -I../.. -I../../include -g -O2 -Wall -c cs_grammar.c<br>cs_grammar.y: In function â€˜cs_parseâ€&#x2122;:<br>cs_grammar.y:1074:58: error: â€˜YYLEXâ€&#x2122; undeclared (first use in this function)<br>1074 | yychar = YYLEX;<br>| ^~~~~<br>cs_grammar.y:1074:58: note: each undeclared identifier is reported only once for each function it appears in<br>make&#91;3]: *** &#91;Makefile:334: cs_grammar.o] Error 1</code></pre>



<p class="wp-block-paragraph">Notice it&#8217;s all UPPERCASE, but you can find plenty on the lowercase issue where its not being linked correctly.  And yeah turns out YYFLEX should define out toe yyflex</p>



<pre class="wp-block-code"><code># ifndef YYLEX
#  define YYLEX		yylex()
# endif
</code></pre>



<p class="wp-block-paragraph">Add that in the top of whatever source is complaining and you&#8217;re golden.</p>



<p class="wp-block-paragraph">Really.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2022/11/13/when-yylex-shouldnt-be-confused-with-yylex/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Started to re-build my MS-DOS machine</title>
		<link>https://virtuallyfun.com/2017/09/02/started-re-build-ms-dos-machine/</link>
					<comments>https://virtuallyfun.com/2017/09/02/started-re-build-ms-dos-machine/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 01 Sep 2017 18:19:00 +0000</pubDate>
				<category><![CDATA[80386]]></category>
		<category><![CDATA[djgpp]]></category>
		<category><![CDATA[doom]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[go32]]></category>
		<category><![CDATA[i386]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=7272</guid>

					<description><![CDATA[Good news, it actually works! Â I was using the version 1.1 WAD, so honestly weird crashes really aren&#8217;t unexpected. Â I haven&#8217;t looked much at what to do with audio, but I was really impressed compared to the Qauake II wars, &#8230; <a href="https://virtuallyfun.com/2017/09/02/started-re-build-ms-dos-machine/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_7273" style="width: 1341px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2017/09/GO32-DooM-on-real-hardware.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7273" class="size-full wp-image-7273" src="https://virtuallyfun.com/wp-content/uploads/2017/09/GO32-DooM-on-real-hardware.jpg" alt="" width="1331" height="998" /></a><p id="caption-attachment-7273" class="wp-caption-text">DooM!</p></div></p>
<p>Good news, it actually works! Â I was using the version 1.1 WAD, so honestly weird crashes really aren&#8217;t unexpected. Â I haven&#8217;t looked much at what to do with audio, but I was really impressed compared to the <a href="https://virtuallyfun.com/2015/06/07/porting-quake-ii-to-ms-dos-pt3/">Qauake II wars</a>, it was really surprising to not only see DooM run on the first shot in real metal, but the keyboard works as well. Â Well enough for me to pick a level, and get killed.</p>
<p>Naturally it doesn&#8217;t work under Windows, however it runs fine with MS-DOS mode.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2017/09/02/started-re-build-ms-dos-machine/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
		<item>
		<title>Null DooM, GCC 1.39, GO32 and DPMI</title>
		<link>https://virtuallyfun.com/2017/07/29/null-doom-gcc-1-39-go32-dpmi/</link>
					<comments>https://virtuallyfun.com/2017/07/29/null-doom-gcc-1-39-go32-dpmi/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sat, 29 Jul 2017 13:36:58 +0000</pubDate>
				<category><![CDATA[80386]]></category>
		<category><![CDATA[binutils]]></category>
		<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[djgpp]]></category>
		<category><![CDATA[doom]]></category>
		<category><![CDATA[dos extenders]]></category>
		<category><![CDATA[DOSBox]]></category>
		<category><![CDATA[DPMI]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[i386]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=7231</guid>

					<description><![CDATA[phew. Around the time of the x68000 port of DooM, I was cutting down the DooM source for a null/portable version.  I never could get it to actually run either using EMX or DJGPP 1.03, as I couldn&#8217;t get it &#8230; <a href="https://virtuallyfun.com/2017/07/29/null-doom-gcc-1-39-go32-dpmi/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<hr />
<p>phew.</p>
<p><div id="attachment_7232" style="width: 972px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2017/07/DooM-via-DJGPP-v1-GO32.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7232" class="size-full wp-image-7232" src="https://virtuallyfun.com/wp-content/uploads/2017/07/DooM-via-DJGPP-v1-GO32.png" alt="" width="962" height="627" /></a><p id="caption-attachment-7232" class="wp-caption-text">DooM via DJGPP v1 GO32</p></div></p>
<p>Around the time of the <a href="https://virtuallyfun.com/2016/09/11/porting-doom-to-the-x68000/">x68000 port of DooM</a>, I was cutting down the DooM source for a null/portable version.  I never could get it to actually run either using <a href="https://virtuallyfun.com/2016/05/06/gcc-1-40-on-windows/">EMX</a> or <a href="https://virtuallyfun.com/2012/06/30/djgpp-1-00-saved-thanks-to-shovelware-cd-textfiles-com/">DJGPP 1.03</a>, as I couldn&#8217;t get it to link to save my life with a constant never-ending battle of unresolved symbols. After a while I just used what I had towards the x68000 version and concentrated on getting it up and running and just shelved the null/portable effort.</p>
<p>Later on I wanted to get it running again as part of messing with another cross compiler, as DooM isn&#8217;t a trivial application to port and verify correct operation. And in the process of trying to get the null version to build and run on Windows using TDM GCC, I wanted to make sure it at least kept compiling with GCC v1.x.</p>
<p>Once more again I was able to compile individual files but unable to link.  But this time, I just looked at the <a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/DJGPPv1/diffs/binutils.dif?rev=1.1.1.2;content-type=text%2Fplain;cvsroot=DJGPP;only_with_tag=MAIN">diffs for binutils</a>, I thought it should be somewhat easy to get hosted on Windows.  Although versions may point to binutils 1.0, I had to use <a href="https://www.mirrorservice.org/sites/sourceware.org/pub/binutils/old-releases/binutils-1.9.tar.bz2">binutils-1.9.tar.gz</a> even though the diffs are against Mar 24 1991, and the source for 1.9 is dated April 17 1991.</p>
<p>My first effort gave me a linker that would happily link, but go32 would either refuse to run the executable, or just crash.  I was going to give up again, but I found mention in another file that DJGPP actually uses the linker from G++, the C++ compiler which was a separate thing in the late &#8217;80s and early&#8217;90&#8217;s.  This time it worked, and I could link a trivial hello world style application!</p>
<p>Now that I finally had a cross linker actually working, I didn&#8217;t want to compile under emulation, so looking at the other diffs, they didn&#8217;t look too extensive. I went ahead ,and took DJGPP v1.06 and patched up the compiler &amp; assembler to get a full cross toolchain.  And in no time, I had a null version of DooM running on MS-DOS well at least tested on <a href="https://www.dosbox.com/">DOSBox</a>.</p>
<p>This was fun, and all but I didn&#8217;t see any easy way to do fun things like hook interrupts so I could get the keyboard &amp; clock like any good MS-DOS program.  <a href="https://en.wikipedia.org/wiki/DOS_Protected_Mode_Interface">DPMI</a> greatly eased this kind of stuff, so looking at the <a href="http://www.delorie.com/djgpp/history.html">DJGPP history</a>, DJGPP v1 <a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/DJGPPv1/docs/djgpp/new110.doc?rev=1.1.1.1;content-type=text%2Fplain;cvsroot=DJGPP;only_with_tag=djgpp111">version 1.10 actually adds preliminary DPMI support!</a>  And in the next version, DPMI was much more better supported, however the binary format had changed from <a href="https://en.wikipedia.org/wiki/A.out">a.out</a> to <a href="https://en.wikipedia.org/wiki/COFF">COFF</a> as part of <a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/DJGPPv1/docs/djgpp/new111.doc?rev=1.1.1.1;content-type=text%2Fplain;cvsroot=DJGPP;only_with_tag=djgpp111">the move to v1.11.</a> I was able to take the memory, and DPMI portions from the final v1.12 libc, and manually build and run them against the v1.06 library / dev tools.</p>
<p>And much to my surprise, it actually worked!  At least having the wrong format didn&#8217;t have any effect on how GO32 worked for me.</p>
<p>So, feeling lazy, I snagged some of the support code from <a href="https://bitbucket.org/maraakate/doomnew-for-dos/src/a6dd7b2813a9a94a9cefadcdf7a405ecf1bf220c/?at=djgpp">Maraakate&#8217;s revamp of DooM</a>, just to make sure of the timer code, and the keyboard code, and again verified that I can build with the keyboard &amp; timer <a href="https://en.wikipedia.org/wiki/Interrupt_handler">ISR</a> and I&#8217;m able to play the v1.9 shareware &amp; commercial levels fine.  I haven&#8217;t done a thing to clean up or update the DooM source itself against all the dozens of bugs and issues with Ultimate DooM, or other games like <a href="https://virtuallyfun.com/2014/04/28/chex-quest/">Chex Quest</a> etc.</p>
<p>I&#8217;m sure 99% of people wouldn&#8217;t care but you can download it here:</p>
<p><a href="http://vpsland.superglobalmegacorp.com/install/Win32/Win32_DJGPPv1_DooM.7z">Win32_DJGPPv1_DooM.7z</a><br />
<a href="https://sourceforge.net/projects/crossdjgppv1/files/latest/download" rel="nofollow"><img decoding="async" src="https://a.fsdn.com/con/app/sf-download-button" alt="Download crossdjgppv1" /></a></p>
<p>Although I&#8217;m using DPMI to drive real-time events, if I looked further at the GO32 v1.06 environments I could either figure out how it operates it&#8217;s timer or modify the extender directly to drive the PIC timer and keyboard as I need.  But overlooking that, the vintage 1991 software is more than capable of running DooM.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2017/07/29/null-doom-gcc-1-39-go32-dpmi/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>DECUS links to ancient GNU software</title>
		<link>https://virtuallyfun.com/2017/07/27/decus-links-ancient-gnu-software/</link>
					<comments>https://virtuallyfun.com/2017/07/27/decus-links-ancient-gnu-software/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 27 Jul 2017 00:56:42 +0000</pubDate>
				<category><![CDATA[gnu]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=7226</guid>

					<description><![CDATA[Digital Equipment Computer Users&#8217; Society (DECUS), used to put out tapes of interesting things to it&#8217;s members. Â Back when everyone didn&#8217;t have an internet connection, or even if they did a high speed one. I was looking for stuff where &#8230; <a href="https://virtuallyfun.com/2017/07/27/decus-links-ancient-gnu-software/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://virtuallyfun.com/wp-content/uploads/2017/07/DECUS-logo.svg_.png"><img loading="lazy" decoding="async" class="alignleft size-full wp-image-7227" src="https://virtuallyfun.com/wp-content/uploads/2017/07/DECUS-logo.svg_.png" alt="" width="220" height="251" /></a>Digital Equipment Computer Users&#8217; Society (<a href="https://en.wikipedia.org/wiki/DECUS">DECUS</a>), used to put out tapes of interesting things to it&#8217;s members. Â Back when everyone didn&#8217;t have an internet connection, or even if they did a high speed one.</p>
<p>I was looking for stuff where I only had a patch, but not the original files. Â So it was great for me to not only dig out an ancient sed from the era, but also bison, and gas. Â The ancient binutils are great for people who need to manipulate the a.out format, although the later binutils version 2 supports far more formats by virtue of it&#8217;s &#8220;BFD&#8221; or binary file database or as it was known as back then a &#8216;big fucking deal&#8217;</p>
<p>If you have ancient and or obsolete stuff, GNU stuff can fill the void of the often missing vendor development tools. Â It&#8217;s crazy how many people sold the tools that kept their systems relevant, although needless to say that attitude pretty much solidified the end of their existence..</p>
<p>The good stuff from 1989 to 1993.</p>
<p><a href="http://www.decuslib.com/decus/lt89a/gnusoftware/">http://www.decuslib.com/decus/lt89a/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt89b2/gnusoftware/">http://www.decuslib.com/decus/lt89b2/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt90a/gnusoftware/">http://www.decuslib.com/decus/lt90a/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt90b1/gnusoftware/">http://www.decuslib.com/decus/lt90b1/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt91a/gnusoftware/">http://www.decuslib.com/decus/lt91a/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt91b/gnusoftware/">http://www.decuslib.com/decus/lt91b/gnusoftware/</a><br />
<a href="http://www.decuslib.com/decus/lt93a/gnusoftware/">http://www.decuslib.com/decus/lt93a/gnusoftware/</a><br />
It&#8217;s not complete, but it&#8217;s still fantastic!</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2017/07/27/decus-links-ancient-gnu-software/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Adding some of the GNU 1989 source &#8216;tapes&#8217; into sourceforge</title>
		<link>https://virtuallyfun.com/2016/12/08/adding-gnu-1989-source-tapes-sourceforge/</link>
					<comments>https://virtuallyfun.com/2016/12/08/adding-gnu-1989-source-tapes-sourceforge/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 08 Dec 2016 03:46:57 +0000</pubDate>
				<category><![CDATA[gnu]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=6680</guid>

					<description><![CDATA[After scrounging around from an earlier post, on a DECUS mirror that goes back to 1989 I&#8217;ve put together the following source tapes: bison-1.03.source.tap.bz2 emacs-18.55.source.tap.bz2 flex-1.0.source.tap.bz2 g++-1.35.0.source.tap.bz2 gas-1.34.source.tap.bz2 gawk-2.10.source.tap.bz2 gdb-3.2.source.tap.bz2 ghostscript-1.4.source.tap.bz2 grep-1.3.source.tap.bz2 m4-1988.source.tap.bz2 sed-1.02.source.tap.bz2 tar-1.07.source.tap.bz2 Quite a list! I haven&#8217;t &#8230; <a href="https://virtuallyfun.com/2016/12/08/adding-gnu-1989-source-tapes-sourceforge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>After scrounging around <a href="https://virtuallyfun.com/2016/12/04/found-ancient-gnu-software/">from an earlier post</a>, on a DECUS mirror that goes back to 1989 I&#8217;ve put together the following source tapes:</p>
<ul>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/bison-1.03.source.tap.bz2/download">bison-1.03.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/emacs-18.55.source.tap.bz2/download">emacs-18.55.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/flex-1.0.source.tap.bz2/download">flex-1.0.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/g%2B%2B-1.35.0.source.tap.bz2/download">g++-1.35.0.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/gas-1.34.source.tap.bz2/download">gas-1.34.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/gawk-2.10.source.tap.bz2/download">gawk-2.10.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/gdb-3.2.source.tap.bz2/download">gdb-3.2.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/ghostscript-1.4.source.tap.bz2/download">ghostscript-1.4.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/grep-1.3.source.tap.bz2/download">grep-1.3.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/m4-1988.source.tap.bz2/download">m4-1988.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/sed-1.02.source.tap.bz2/download">sed-1.02.source.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/tar-1.07.source.tap.bz2/download">tar-1.07.source.tap.bz2</a></li>
</ul>
<p>Quite a list!</p>
<p>I haven&#8217;t tried to build any of it, but I figured for the time being, it may be easier to make some tap files for SIMH, and maybe someone else will do the hard work for me. Â Or it&#8217;ll be a lazy day type thing.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2016/12/08/adding-gnu-1989-source-tapes-sourceforge/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Found some more ancient GNU software</title>
		<link>https://virtuallyfun.com/2016/12/04/found-ancient-gnu-software/</link>
					<comments>https://virtuallyfun.com/2016/12/04/found-ancient-gnu-software/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 04 Dec 2016 06:20:40 +0000</pubDate>
				<category><![CDATA[binutils]]></category>
		<category><![CDATA[gnu]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=6666</guid>

					<description><![CDATA[I found a bunch of them here: ftp://ftp.ne.jp CVS brows of the following: GAS GDB Binutils I didn&#8217;t know that GNUmake 2.9 and prior was actually part of binutils.  I guess at some point I&#8217;ll build the older ones on &#8230; <a href="https://virtuallyfun.com/2016/12/04/found-ancient-gnu-software/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>I found a bunch of them here: <a href="ftp://ftp.ne.jp/.010/Linux/sourceware.org/binutils/old-releases/">ftp://ftp.ne.jp</a></p>
<p>CVS brows of the following:</p>
<ul>
<li><a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/gas/?cvsroot=gas;">GAS</a></li>
<li><a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/gdb/?cvsroot=gdb;">GDB</a></li>
<li><a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/binutils/?cvsroot=binutils;">Binutils</a></li>
</ul>
<p>I didn&#8217;t know that <a href="http://unix.superglobalmegacorp.com/cgi-bin/cvsweb.cgi/binutils/make.c?rev=1.1.1.1;cvsroot=binutils">GNUmake 2.9</a> and prior was actually part of binutils.  I guess at some point I&#8217;ll build the older ones on 4.2 BSD to round out the experience.</p>
<p>And I don&#8217;t know where to find <a href="https://fossies.org/linux/emacs/etc/HISTORY">Emacs 18.41</a> and going further back.  Although I did find <a href="http://vpsland.superglobalmegacorp.com/install/gnu/vmsone.com_decuslib_languageandtools/lt89a/gnusoftware/emacs1855.taz">emacs1855.taz</a> a <a href="https://en.wikipedia.org/wiki/DECUS">DECUS</a> (Digital Equipment Computer Users&#8217; Society) image from late 1989.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2016/12/04/found-ancient-gnu-software/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Building and using GCC 0.9 aka the first public version</title>
		<link>https://virtuallyfun.com/2016/12/01/building-using-gcc-0-90-aka-first-public-version/</link>
					<comments>https://virtuallyfun.com/2016/12/01/building-using-gcc-0-90-aka-first-public-version/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Wed, 30 Nov 2016 17:16:32 +0000</pubDate>
				<category><![CDATA[4.2 BSD]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[VAX]]></category>
		<category><![CDATA[VAX 11/780]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=6653</guid>

					<description><![CDATA[In my quest for old software, I&#8217;ve seen this file in multiple searches, gcc-0.9.tar.bz2, which is the first version of GCC! article from virtuallyfun.superglobalmegacorp.com From the original announcement:  Date: Sun, 22 Mar 87 10:56:56 EST From: rms (Richard M. Stallman) &#8230; <a href="https://virtuallyfun.com/2016/12/01/building-using-gcc-0-90-aka-first-public-version/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>In my quest for old software, I&#8217;ve seen this file in multiple searches, <a href="http://ftp.vim.org/languages/gcc/old-releases/gcc-1/gcc-0.9.tar.bz2">gcc-0.9.tar.bz2</a>, which is the first version of GCC!</p>
<h3><em>article from <a href="https://virtuallyfun.com">virtuallyfun.superglobalmegacorp.com</a></em></h3>
<p><div id="attachment_6654" style="width: 669px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2016/12/gcc-0.9-VAX-on-4.2-BSD.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6654" class="size-full wp-image-6654" src="https://virtuallyfun.com/wp-content/uploads/2016/12/gcc-0.9-VAX-on-4.2-BSD.png" alt="GCC 0.9 on SIMH VAX / 4.2BSD" width="659" height="342" /></a><p id="caption-attachment-6654" class="wp-caption-text">GCC 0.9 on SIMH VAX / 4.2BSD</p></div></p>
<h1>From the <a href="https://groups.google.com/forum/#!topic/mod.compilers/ynAVuwR7dPw">original announcement</a>:</h1>
<p style="padding-left: 30px;"> Date: Sun, 22 Mar 87 10:56:56 EST<br />
From: rms (Richard M. Stallman)</p>
<p style="padding-left: 30px;">   The GNU C compiler is now available for ftp from the file<br />
/u2/emacs/gcc.tar on <a href="http://prep.ai.mit.edu/" target="_blank" rel="nofollow noopener noreferrer">prep.ai.mit.edu</a>.  This includes machine<br />
descriptions for vax and sun, 60 pages of documentation on writing<br />
machine descriptions (internals.texinfo, internals.dvi and Info<br />
file internals).</p>
<p style="padding-left: 30px;">   This also contains the ANSI standard (Nov 86) C preprocessor and 30<br />
pages of reference manual for it.</p>
<p style="padding-left: 30px;">   This compiler compiles itself correctly on the 68020 and did so<br />
recently on the vax.  It recently compiled Emacs correctly on the<br />
68020, and has also compiled tex-in-C and Kyoto Common Lisp.<br />
However, it probably still has numerous bugs that I hope you will<br />
find for me.</p>
<p style="padding-left: 30px;">   I will be away for a month, so bugs reported now will not be<br />
handled until then.</p>
<p style="padding-left: 30px;">   If you can&#8217;t ftp, you can order a compiler beta-test tape from the<br />
Free Software Foundation for $150 (plus 5% sales tax in<br />
Massachusetts, or plus $15 overseas if you want air mail).</p>
<p style="padding-left: 30px;">Free Software Foundation<br />
1000 Mass Ave<br />
Cambridge, MA  02138</p>
<p style="padding-left: 30px;">[tapes are generally in Unix tar format.  If you have other needs,<br />
write to the above address, and ask if they can be met. -len]</p>
<p>And indeed, the files are dated 22/03/1987 making this the first public release of GCC.</p>
<p>GNU CC is a fairly portable optimizing C compiler intended for<br />
machines with 32-bit words that have several registers and address<br />
memory in terms of 8-bit bytes.  It supports full ANSI standard C, not<br />
including libraries (which we do not consider to be part of a<br />
compiler).<br />
Currently we have working machine descriptions for the Vax and for<br />
the 68000/68020 (including 68881 support).<br />
Optimizations performed by GNU CC include:</p>
<ul>
<li>Invariant code motion out of loops.</li>
<li>Common subexpression elimination.</li>
<li>Automatic register packing (register declarations are unnecessary<br />
and ignored).</li>
<li>Constant propagation and elimination of consequent dead code.</li>
<li>Copy propagation.</li>
<li>Elimination of dead stores.</li>
<li>Jump optimization including cross-jumping.</li>
<li>Delaying of stack adjustments after function calls.</li>
<li>Arithmetic performed in subword types when appropriate.</li>
<li>Many local optimizations.</li>
</ul>
<p>GNU CC runs about as fast as PCC.<br />
Most of the optimizations are machine-independent or controlled by a<br />
machine description.  GNU CC takes advantage of all the 68020<br />
addressing modes that we can see how to make the Sun assembler<br />
assemble.  Debugging output for DBX is available whether you request<br />
optimization or not.</p>
<p>Seeing as 4.3BSD didn&#8217;t ship until 1988, I went ahead and set out to build this on <a href="https://sourceforge.net/projects/bsd42/">4.2BSD</a>. The first stumbling block I hit is that GCC needs bison.  The oldest version of bison I have is 1.25 which honestly is just too new!  However in the same location as GCC is this file <a href="https://ftp.mirrorservice.org/sites/sources.redhat.com/pub/gcc/old-releases/gcc-1/gnu1988.tar.bz2">gnu1988.tar.bz2</a> which contains all of the current GNU software of 1988!  And what is on that tape?</p>
<ul>
<li>bison-1.00</li>
<li>gcc-1.21</li>
<li>gdb-2.5.1</li>
<li>gplusplus-1.21</li>
<li>libgplusplus</li>
</ul>
<p>So this is probably as old as it is going to get, so I downloaded and went to compile bison, however getopt is a missing call!  A creative search found <a href="http://mirrors.ctan.org/dviware/umddvi/lib/getopt.c">getopt.c</a> (<a href="https://virtuallyfun.com/wp-content/uploads/2019/11/getopt.c">local mirror</a>) and even better PCC liked it enough to get a running bison so I could then configure GCC.</p>
<p>Configuring GCC is a manual process, but not too involved:</p>
<ul>
<li>Make a symbolic link from file `config.h&#8217; to the top-level<br />
config file for the machine you are using. Its name should be<br />
`config-MACHINE.h&#8217;. This file is responsible for<br />
defining information about the host machine. It includes<br />
`tm.h&#8217;.</li>
<li>Make a symbolic link from `tm.h&#8217; to the machine-description<br />
macro file for your machine (its name should be<br />
`tm-MACHINE.h&#8217;).</li>
<li>Make a symbolic link from `md&#8217; to the<br />
machine description pattern file (its name should be<br />
`MACHINE.md&#8217;)</li>
<li>Make a symbolic link from<br />
`aux-output.c&#8217; to the output-subroutine file for your machine<br />
(its name should be `MACHINE-output.c&#8217;).Make sure the Bison parser generator is installed.Build the compiler. Just type `make&#8217; in the compiler directory.</li>
</ul>
<p>And in a minute I had GCC compiled.  I ran it with -v and got this output:</p>
<p style="padding-left: 30px;"># gcc -v<br />
ld /lib/crt0.o -lc<br />
Undefined:<br />
_main</p>
<p>It really is nowhere near as featured as 1.21 that is for sure!  So time to do a simple hello world program:</p>
<p style="padding-left: 30px;"># cat hello.c<br />
#include &lt;stdio.h&gt;<br />
void main(){<br />
printf(&#8220;GCC 0.9 in action!\n&#8221;);<br />
}<br />
# gcc -v hello.c -o hello<br />
cpp -Dvax hello.c /tmp/cc002050.cpp<br />
cc1 /tmp/cc002050.cpp -quiet -dumpbase hello.c -noreg -o /tmp/cc002050.s<br />
as -o hello.o /tmp/cc002050.s<br />
ld -o hello /lib/crt0.o hello.o -lc<br />
# ./hello<br />
GCC 0.9 in action!</p>
<p>And there we go!</p>
<p>I don&#8217;t know why, but I haven&#8217;t seen anything about anyone actually running GCC 0.9.  Or even where or how they found this &#8216;lost&#8217; file. Â Let alone anyone even building or running it in 2016.</p>
<p>For anyone who wants to try, SIMH tape files of the binaries are here:</p>
<ul>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/4.2%20BSD/bison-1.00.binary.BSD-4.2.tap.bz2/download">bison-1.00.binary.BSD-4.2.tap.bz2</a></li>
<li><a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/4.2%20BSD/gcc-0.9.binary.BSD-4.2.tap.bz2/download">gcc-0.9.binary.BSD-4.2.tap.bz2</a></li>
</ul>
<p>And of course source tapes are <a href="https://sourceforge.net/projects/bsd42/files/Package%20Tapes/Source%20Code/">here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2016/12/01/building-using-gcc-0-90-aka-first-public-version/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
