<?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>Win32 &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/win32/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Sun, 08 Feb 2026 15:04:45 +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>Yet another GCC 1.40 *SOME ASSEBMLY REQUIRED</title>
		<link>https://virtuallyfun.com/2026/02/08/yet-another-gcc-1-40-some-assebmly-required/</link>
					<comments>https://virtuallyfun.com/2026/02/08/yet-another-gcc-1-40-some-assebmly-required/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 08 Feb 2026 13:33:41 +0000</pubDate>
				<category><![CDATA[80386]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=15612</guid>

					<description><![CDATA[Oh sure I&#8217;ve done this ages ago, getting GCC 1.40 to compile with old Microsoft C compilers, and then target Win32, it&#8217;s not that &#8216;special&#8217;. But I thought I&#8217;d try to get them to build with MASM so I could &#8230; <a href="https://virtuallyfun.com/2026/02/08/yet-another-gcc-1-40-some-assebmly-required/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="779" src="https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM-1024x779.png" alt="" class="wp-image-15613" srcset="https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM-1024x779.png 1024w, https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM-300x228.png 300w, https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM-768x584.png 768w, https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM-395x300.png 395w, https://virtuallyfun.com/wp-content/uploads/2026/02/Screenshot-2026-02-07-at-7.22.17-PM.png 1210w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">phoon</figcaption></figure>



<p class="wp-block-paragraph">Oh sure I&#8217;ve done this ages ago, getting GCC 1.40 to compile with old Microsoft C compilers, and then target Win32, it&#8217;s not that &#8216;special&#8217;.  But I thought I&#8217;d try to get them to build with MASM so I could just distribute this with an assembler.  Spelling out the joke of some assembly required.</p>



<p class="wp-block-paragraph">Although I wasn&#8217;t going to target/host OS/2 I was ideally going straight to Win32, the MASM 6.11 assembler couldn&#8217;t assemble the MSVC 1.0 / MSC/386 8.0 compiler&#8217;s assembly output, I needed to use the MASM 7 from Visual C++ 2003; namely:</p>



<pre class="wp-block-code"><code>Microsoft (R) Macro Assembler Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved.</code></pre>



<p class="wp-block-paragraph">MASM 6.11 was having issues with pushing OFFSET&#8217;s ie:</p>



<pre class="wp-block-code"><code>push OFFSET _obstack</code></pre>



<p class="wp-block-paragraph">when they were defined as:</p>



<pre class="wp-block-code"><code>COMM _obstack:BYTE:024H</code></pre>



<p class="wp-block-paragraph">Chat GPT to the rescue knowing that later MASM&#8217;s will just handle it just fine.  And it was right!  I know AI gets a bad rep, but surprisingly (or not when you think about what it&#8217;s been trained on), it&#8217;s got some great insight to some old things like seemingly common software tools, and old environments.</p>



<p class="wp-block-paragraph">I didn&#8217;t bother trying to use Microsoft C/386 6.0 &amp; MASM386 5.1 to see if it&#8217;ll handle CC1, as that seems to be a bit extreme. and I wanted this to run on semi modern Win32 stuff.  More so that there isn&#8217;t a 64bit SMP aware OS/2 with a modern web browser.  Kind of sad to be honese, but it&#8217;s 2026, and here we are.</p>



<p class="wp-block-paragraph">I as always stick to the <a href="https://github.com/neozeed/gas-1.38-xenix-">Xenix GAS port</a> that outputs 386 OMF objects that earlier linker&#8217;s can happily auto-convert to coff and use on Win32.  One day I feel I should ask why they were cross compiling NT/i386 from OS/2 1.21 instead of using Xenix?!  Must have been some fundamental NTOS/2 thing I suppose.</p>



<p class="wp-block-paragraph">I guess a refresher for anyone comming in out of the cold here&#8217;s a really poorly done block diagram of what goes on when a traditional (GCC) compiler runs.  Explaniation is here: <a href="https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/">so it turns out GCC could have been available on Windows NT the entire time</a>.</p>



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



<p class="wp-block-paragraph">Long story there was that the Xenix GAS emits an ancient 386 OMF format that for unknown reaons the older Microsoft Linkers happily accept and auto convert into COFF, the file format of the future (Future being 1988).  I guess for better. or worse we never got NT/ELF.  Oh and speaking of further weird, the IBM version of their LINK386 doesn&#8217;t like the Xenix 386 OMF.  Bummer.</p>



<p class="wp-block-paragraph">One thing I found out is that the MASM v7 doesn&#8217;t output COFF by default, rather it&#8217;s 386 OMF!  you need to add the /coff flag to force it to be more Win32 friendly.  Kind of unexpected behaviour.</p>



<p class="wp-block-paragraph">I tried to make this simple as, clone the repo and run &#8216;build.cmd&#8217; it&#8217;ll link up GCC and then build the test programs, and clean up after itself.</p>



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



<p class="wp-block-paragraph">I&#8217;d tried to emit assembly for the Xenix GAS, but for some reason it&#8217;s struggling with floating point.  I&#8217;m not sure, I tried using chat gpt to debug but it get&#8217;s confused on how this whole bizzare tool chain is working.  I guess I can&#8217;t blame it.</p>



<p class="wp-block-paragraph">Sorry it&#8217;s been a while, been feeling &#8216;life&#8217; lately.  I had some i7 project as a kicker for a retro Windows 10 build thing to do but watchign the RAM crissis unfold and well life&#8230; I just got feeling like it&#8217;s so irrelevant who&#8217;d care.  That and it&#8217;s insane watching $1.11 worth of DDR3 RAM now selling for $30++ &#8230;. and more and more chip manufacturers are exiting.  So it felt like maybe go back and do more with less.  Even a low end machine can assemble this in seconds!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2026/02/08/yet-another-gcc-1-40-some-assebmly-required/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>RealAudio Personal Server</title>
		<link>https://virtuallyfun.com/2024/07/07/realaudio-personal-server/</link>
					<comments>https://virtuallyfun.com/2024/07/07/realaudio-personal-server/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 07 Jul 2024 10:30:09 +0000</pubDate>
				<category><![CDATA[audio]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[sound cards]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14630</guid>

					<description><![CDATA[I had originally planned on doing this for the 4th of July, but something happened along the way. I had forgotten that this is 1995, not 2024, and things were a little bit different back then. Back in the early &#8230; <a href="https://virtuallyfun.com/2024/07/07/realaudio-personal-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I had originally planned on doing this for the 4th of July, but something happened along the way.  I had forgotten that this is 1995, not 2024, and things were a little bit different back then.</p>



<p class="wp-block-paragraph">Back in the early days of the internet, when <a href="https://www.businessinsider.com/al-gore-internet-invent-credit-bill-clinton-2016-11" target="_blank" rel="noreferrer noopener">Al Gore himself had single handedly created it out of the dirt</a>, The idea of address space exhaustion didn&#8217;t loom overhead as it did in the late 00s.  And in those days getting public addresses was a formality.  It was a given that not only would the servers all have public TCP/IP addresses, but so would the clients.  Protocols like FTP would open ports not only from client to server, but also server to client.  This was also the case for RealAudio.  Life was good.</p>



<p class="wp-block-paragraph">The problem with trying to build anything with this amazing technology is that while I do have a public address for the server, it&#8217;s almost a given that YOU are not directly connected to the internet.  Almost everyone these days uses some kind of router that&#8217;ll implement Network Address Translation (NAT), allowing for countless machines to sit behind a single registered address, and map their connections in and out behind one address. For protocols like FTP, they have to be built to watch and dynamically add these ports.  FTP is popular, RealAudio is not.  So, the likelihood of anyone actually being able to connect to a RealAudio 1.0 server is pretty much nil.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server.png" target="_blank" rel="noreferrer noopener"><img decoding="async" width="799" height="622" src="https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server.png" alt="" class="wp-image-14631" srcset="https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server.png 799w, https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server-300x234.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server-768x598.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/07/real-audio-v3-playing-from-citrix-server-385x300.png 385w" sizes="(max-width: 799px) 100vw, 799px" /></a><figcaption class="wp-element-caption">RealAudio Player v3 connected to a v1 server</figcaption></figure>



<p class="wp-block-paragraph">The software is pretty easy to find on <a href="https://archive.org/details/RASERVER" target="_blank" rel="noreferrer noopener">archive.org</a>, (<a href="https://vpsland.superglobalmegacorp.com/install/Win32/RealAudio/RASERVER.zip" target="_blank" rel="noreferrer noopener">mirrored</a>).  Since it&#8217;s very audio centric, I decided to install the server onto a <a href="https://archive.org/details/winframe.ver.1.8.english.7z" target="_blank" rel="noreferrer noopener">Citrix 1.8</a> server using <a href="https://sourceforge.net/projects/qemu090b/" target="_blank" rel="noreferrer noopener">Qemu 0.9</a>.  I had gone with this, as the software is hybrid 16bit/32bit and I need a working sound card, and I figured the Citrix virtual stuff is good enough.</p>



<p class="wp-block-paragraph">First thing first, you need some audio to convert.  Thankfully in modern terms ripping or converting is trivial <a href="https://virtuallyfun.com/2017/04/20/getting-first-side-dark-side-moon-onto-floppy-diskette/" target="_blank" rel="noreferrer noopener">unlike the bad old days</a>.  First off, I needed a copy of the Enclave radio, and I found that too on <a href="https://archive.org/details/fallout3_enclave_radio" target="_blank" rel="noreferrer noopener">archive.org</a>.  The files are all in mp3 format, but the RealAudio encoder wants to work with wav files.  The quickest way I could think of was to use ffmpeg.</p>



<pre class="wp-block-code"><code>ffmpeg -i Enclave Radio - Battle Hymn of the Republic.mp3 -ar 11025 -ab 8k -ac 1 enc01.wav</code></pre>



<p class="wp-block-paragraph">This converts the mp3 into an 11Khz mono wav file.  It&#8217;s something the encoder can work with.  Another nice thing about Citrix is how robust it can use your local drives, cutting out the whole part of moving data in &amp; out of the VM.</p>



<p class="wp-block-paragraph">One thing about how RealAudio works is that first there is the ability to load up a .ram or playlist file.  In this case, I took the &#8216;enclave playlist&#8217; from Fallout 3, and made a simple playlist as enclave.ram:</p>



<p class="wp-block-paragraph">The encoder allows for some metadata to be set.  Nothing too big.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="541" height="328" src="https://virtuallyfun.com/wp-content/uploads/2024/07/encode-1.png" alt="" class="wp-image-14632" srcset="https://virtuallyfun.com/wp-content/uploads/2024/07/encode-1.png 541w, https://virtuallyfun.com/wp-content/uploads/2024/07/encode-1-300x182.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/07/encode-1-495x300.png 495w" sizes="auto, (max-width: 541px) 100vw, 541px" /><figcaption class="wp-element-caption">Name &amp; Author</figcaption></figure>



<p class="wp-block-paragraph">And then it thankfully takes my i7 seconds to convert this, even under emulation, using a shared drive.  And import option to deselect is to enable playback in real-time, as it&#8217;ll never work as it cannot imagine a world in which the processor is substantially faster than the encoder.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="678" height="386" src="https://virtuallyfun.com/wp-content/uploads/2024/07/encode-2.png" alt="" class="wp-image-14633" srcset="https://virtuallyfun.com/wp-content/uploads/2024/07/encode-2.png 678w, https://virtuallyfun.com/wp-content/uploads/2024/07/encode-2-300x171.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/07/encode-2-500x285.png 500w" sizes="auto, (max-width: 678px) 100vw, 678px" /></figure>



<p class="wp-block-paragraph">Converting the 8 files took a few minutes, and then I had my RealAudio 1.0 data.</p>



<p class="wp-block-paragraph">Next up is to create a .RAM or playlist.</p>



<pre class="wp-block-preformatted">pnm://localhost/enc01.ra<br>pnm://localhost/enc02.ra<br>pnm://localhost/enc03.ra<br>pnm://localhost/enc04.ra<br>pnm://localhost/enc05.ra<br>pnm://localhost/enc06.ra<br>pnm://localhost/enc07.ra<br>pnm://localhost/enc08.ra</pre>



<p class="wp-block-paragraph">The playlist should be served via HTTP, and I had just elected to use an old hacked up Apache to run on NT 3.1.  As it only has to serve some simple files.</p>



<p class="wp-block-paragraph">The scene is all set, the RealAudio player pulls the playlist from Apache, then it connects on TCP port 7070 of the RealAudio server to identify itself and get the file metadata.  Then the RealAudio server then opens a random UDP port to the client and sends the stream, as the client updates the server via UDP of how the stream is working.  And this is where it all breaks down, as there is not going to be any nice way to handle this UDP connection from the server to the client.</p>



<p class="wp-block-paragraph">Well, this was disappointing.</p>



<p class="wp-block-paragraph">In a fit of rage, I then tried to see if ffmpeg could convert the real audio into FLAC so you could hear the incredible drop in quality, and as luck would have it, YES it can!  To concatenate them, I used a simple list file:</p>



<pre class="wp-block-code"><code>file ENC01.RA
file ENC02.RA
file ENC03.RA
file ENC04.RA
file ENC05.RA
file ENC06.RA
file ENC07.RA
file ENC08.RA</code></pre>



<p class="wp-block-paragraph">And then the final command:</p>



<pre class="wp-block-code"><code>ffmpeg -f concat -safe 0 -i list.txt Enclave_v1.flac</code></pre>



<p class="wp-block-paragraph">And thanks to &#8216;modern&#8217; web standards, you can now listen to this monstrosity!</p>



<figure class="wp-block-audio"><audio controls src="https://virtuallyfun.com/wp-content/uploads/2024/07/Enclave_v1.flac"></audio><figcaption class="wp-element-caption">Enclave Real Audio 1 converted to Flac &amp; concatenated.</figcaption></figure>



<p class="wp-block-paragraph">This takes about 10MB of WAV audio derived from 8MB of MP3&#8217;s, and converted down to 472kb worth of RealAudio.  Converting that back to a 4.4MB FLAC file.</p>



<p class="wp-block-paragraph">To keep in mind what network ports are needed at a minimum it&#8217;s the following:</p>



<ul class="wp-block-list">
<li>TCP 1494 * Citrix</li>



<li>TCP 7070 * RealAudio</li>



<li>UDP 7070 * RealAudio (statistics?)</li>



<li>TCP 80 * Apache</li>
</ul>



<p class="wp-block-paragraph">And of course, it seems to limit the RealAudio server to the client in the 7000-7999 range but that is just my limited observation.  This works find at home on a LAN where the server is using SLiRP as the host TCP/UDP ports appear accessible from 10.0.2.2, while giving the server a free-standing IP also works better, but again it needs that 1:1 conversation greatly limiting it in today&#8217;s world.</p>



<p class="wp-block-paragraph">Also, as pointless as it sounds, you can play the real audio files from the Citrix server for extra audio loss.</p>



<p class="wp-block-paragraph">Personally, things could have gone a lot better on the 3rd of July, I thought I&#8217;d escaped but got notified on the 5th they forgot about me.  Oh well Happy 4th for everyone else.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/07/07/realaudio-personal-server/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		<enclosure url="https://virtuallyfun.com/wp-content/uploads/2024/07/Enclave_v1.flac" length="4421045" type="audio/flac" />

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

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



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



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



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



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



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



<p class="wp-block-paragraph">But today is not that day.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/06/11/lets-build-a-linux-kernel-from-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Rebuilding Darwin from source: Part 1 Qemu</title>
		<link>https://virtuallyfun.com/2024/04/22/rebuilding-darwin-from-source-part-1-qemu/</link>
					<comments>https://virtuallyfun.com/2024/04/22/rebuilding-darwin-from-source-part-1-qemu/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 22 Apr 2024 17:43:42 +0000</pubDate>
				<category><![CDATA[Darwin]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[NeXTSTEP]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14278</guid>

					<description><![CDATA[Back in the old old.. It&#8217;s hard to believe it&#8217;s been 7 years ago since I reproduced Ncommander&#8216;s adventure in building the Mach kernel from Darwin 0.1 sources that had been found years ago. At one point we&#8217;d managed to &#8230; <a href="https://virtuallyfun.com/2024/04/22/rebuilding-darwin-from-source-part-1-qemu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Back in the old old..</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/04/7-years-ago-darwin.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="825" height="545" src="/wp-content/uploads/2024/04/7-years-ago-darwin.png" alt="" class="wp-image-14279" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/7-years-ago-darwin.png 825w, https://virtuallyfun.com/wp-content/uploads/2024/04/7-years-ago-darwin-300x198.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/7-years-ago-darwin-768x507.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/7-years-ago-darwin-454x300.png 454w" sizes="auto, (max-width: 825px) 100vw, 825px" /></a><figcaption class="wp-element-caption">7 years ago!</figcaption></figure>



<p class="wp-block-paragraph">It&#8217;s hard to believe it&#8217;s been 7 years ago since I reproduced <a href="https://www.youtube.com/@NCommander" target="_blank" rel="noreferrer noopener">Ncommander</a>&#8216;s adventure in building the Mach kernel from Darwin 0.1 sources that had been found years ago.  At one point we&#8217;d managed to build enough of Darwin to do a dump/restore onto a new disk image, and have a mostly built Darwin system save for a hand full of files.</p>



<p class="wp-block-paragraph">Time goes on by, and memories fade, and I thought it&#8217;d be worth going over the adventure, yet again.  Just as it was true back then, I thought I&#8217;d reproduce the same setup that I&#8217;d been using back then.  Qemu was a new and exciting thing back then, and </p>



<p class="wp-block-paragraph">the Disk driver is <em>VERY</em> picky and honestly ancient Qemu is a pretty solid option to emulate NeXTSTEP/OPENSTEP/Rhapsody with some patches to both 0.8 &amp; 0.9 by Michael Engel, which change a nested interrupt and add support for a busmouse, as the PS/2 mouse doesn&#8217;t work for some unknown reason.  I know many are scared of old Qemu, but the disk support is pretty solid and the CPU recompilation is very fast, so having to rely on MinGW v3 isn&#8217;t so terrible.</p>



<p class="wp-block-paragraph">While I had hid away a lot of these resources on <a href="https://archive.org/details/qemuwin32-nextstep-mingw32" target="_blank" rel="noreferrer noopener">archive.org</a>, I thought it was best to just go back to the oldest post I had where I had painfully documented how to compile Qemu and get it working with <a href="https://web.archive.org/web/20061113122333/http://forums.bsdnexus.com/viewtopic.php?pid=9344" target="_blank" rel="noreferrer noopener">NeXTSTEP, back on BSDnexus</a>. I&#8217;m so glad I took the time so long ago to not only write it down, and add screenshots, but also tag the version numbers.  Software drift, especially free software can be so difficult to pin down, and it&#8217;s nice to be able to return to a known good value.  I went ahead and placed the recreated toolchain <a href="https://archive.org/details/min-gw-3-installed">over on archive.org</a>.</p>



<p class="wp-block-paragraph">Rhapsody is a weird OS, in that NeXT had kind of given up on the OS market after their NeXT RISC Workstation had basically died with the 88k, and even their early abandoned PowerPC 601 aka <a href="https://github.com/neozeed/Darwin_0.1/blob/main/kernel/mach/machine.h#L237" target="_blank" rel="noreferrer noopener">MC98000/98601</a> port.  Apple had left a few of the <a href="https://github.com/neozeed/Darwin_0.1/tree/main/architecture/changelog" target="_blank" rel="noreferrer noopener">changelogs</a>, in the source code.  It&#8217;s very interesting stuff!  I guess to go off on my own tangent NeXT was just too early, the cube with it&#8217;s Unix &amp; magnetic optical media and great audio DSP capabilities was just too ahead of the curve.  What the cube couldn&#8217;t pull off in 1988, the iMac and OS X sure did in 2001.</p>



<p class="wp-block-paragraph">I also added UDP support to this Qemu so I could use the <a href="/2024/03/29/looking-at-unixware-7-1-1-on-vmware-qemu-yet-again/" target="_blank" rel="noreferrer noopener">HecnetNT bridge trick</a> giving me the ability to telnet/ftp into the VM greatly reducing my pain.  Back in the day I had used NFS and the network slirp redirection.  But I like having direct access so much more!</p>



<p class="wp-block-paragraph">Rhapsody throws up yet another fun &#8216;road block&#8217; in that the mouse buttons map backwards for some reason.  It&#8217;s a trivial fix in the source code, but I made it a runtime option in case I needed or wanted to run NeXTSTEP.  And it was a good thing, as I did need to find the NXLock.h file for building one part of Darwin.</p>



<p class="wp-block-paragraph">When building Darwin, I started with the last x86 version of NeXTSTEP that was available, and that was <a href="https://winworldpc.com/product/mac-os-x/rhapsody"></a>Apple &#8221;Rhapsody&#8221; / Titan1U x86 Developer Release 2. My thinking at the time and still is that the closer you can get your build to whatever they were using as &#8216;current&#8217; the easier this will be.</p>



<p class="wp-block-paragraph">Rhapsody can support an 8GB disk, so let&#8217;s go with that.  This always has an issue with people that try much larger, and just fail, so for my sake and yours let&#8217;s just go with 8.</p>



<pre class="wp-block-code"><code>qemu-img.exe create -f vmdk rhapsody.vmdk 8G</code></pre>



<p class="wp-block-paragraph">And to simply start off the installer:</p>



<pre class="wp-block-code"><code>qemu -L pc-bios -m 128 ^
-k en-us ^
-rhapsodymouse ^
-hda rhapsody.vmdk ^
-cdrom rhapsody_dr2_x86.iso ^
-fda rhapsody_dr2_x86_InstallationFloppy.img ^
-boot a</code></pre>



<p class="wp-block-paragraph">You may be wondering, why only use 128MB of RAM?  Well there is a bug in the shipping Rhapsody kernel that prevents booting on machines with more than 192? MB of RAM. Naturally, once we are to the point of building our own kernels this won&#8217;t be a problem but for now we are limited.</p>



<p class="wp-block-paragraph">The bootloader will give us a few seconds to do anything fancy, I just hit -v so I always have the verbose boot.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-01.png" alt="" class="wp-image-14283" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-01.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-01-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-01-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">From here it&#8217;s just a few options to go thru the installer</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-02.png" alt="" class="wp-image-14284" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-02.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-02-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-02-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">And a disk change is required</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-03.png" alt="" class="wp-image-14285" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-03.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-03-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-03-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">CONTROL+ALT+2 will bring up the monitor prompt, where we can change the disk</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-04.png" alt="" class="wp-image-14286" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-04.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-04-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-04-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">CONTROL+ALT+1 will return us to the console. Now we have to go through all the SCSI cards, and kind of compatible IDE cards</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-05.png" alt="" class="wp-image-14287" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-05.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-05-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-05-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



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



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-06.png" alt="" class="wp-image-14288" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-06.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-06-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-06-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">Further still&#8230;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-07.png" alt="" class="wp-image-14289" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-07.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-07-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-07-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">And how select the Primary/Secondary(DUAL) EIDE/ATAPI Device Controller (v5.01)</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-08.png" alt="" class="wp-image-14290" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-08.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-08-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-08-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">We only need the one driver, so we&#8217;re good to go!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-09.png" alt="" class="wp-image-14291" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-09.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-09-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-09-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">Continuing onwards will now start the kernel, along with a change to graphical mode.  Just like a NeXT!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-10.png" alt="" class="wp-image-14292" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-10.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-10-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-10-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Now we can confirm again we want to install</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-11.png" alt="" class="wp-image-14293" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-11.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-11-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-11-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">As you can see there is our hard disk!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-12.png" alt="" class="wp-image-14294" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-12.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-12-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-12-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">In the future we don&#8217;t need to dual boot so, just give it the entire disk.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-13.png" alt="" class="wp-image-14295" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-13.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-13-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-13-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">A few more 1&#8217;s and we are finally installing!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-14.png" alt="" class="wp-image-14296" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-14.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-14-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-14-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Trust me it&#8217;s fast on Qemu!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-15.png" alt="" class="wp-image-14297" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-15.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-15-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-15-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">And just like that, we&#8217;ve completed the first part of the install.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-16.png" alt="" class="wp-image-14299" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-16.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-16-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-16-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">You can use CONTROL+ALT+2 to toggle back to the monitor and type in</p>



<p class="wp-block-paragraph">eject fda</p>



<p class="wp-block-paragraph">to eject the floppy, then it&#8217;s CONTROL+ALT+1 to return to the display and have it reboot.  Qemu won&#8217;t try to boot to the hard disk, and with no disk in the drive, it&#8217;ll hang at the BIOS.  Now is a good time to close Qemu and backup the hard disk.  Mostly because I hate repeating this stuff.</p>



<p class="wp-block-paragraph">To try to make this a bit easier, I&#8217;ve made a f<a href="https://archive.org/details/nic_20240423" target="_blank" rel="noreferrer noopener">loppy disk with the NE2000 driver and updated kernel in one plac</a>e where they can be injected via single user mode. A simple enough config file:</p>



<pre class="wp-block-code"><code>qemu -L pc-bios -m 128 ^
-k en-us ^
-rhapsodymouse ^
-hda rhapsody.vmdk ^
-cdrom rhapsody_dr2_x86.iso ^
-fda <a href="https://archive.org/details/nic_20240423" target="_blank" rel="noreferrer noopener">nic.flp</a> ^
-boot c</code></pre>



<p class="wp-block-paragraph">Type in -s for SINGLE USER MODE.  This is where a lot of Unix problems got solved in the old days</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="722" height="427" src="/wp-content/uploads/2024/04/rhapsody-install-20.png" alt="" class="wp-image-14302" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-20.png 722w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-20-300x177.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-20-500x296.png 500w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p class="wp-block-paragraph">It&#8217;s a little tricky as this does involve typing.  As instructed we need to check the hard disk prior to mounting it read/write</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-21.png" alt="" class="wp-image-14303" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-21.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-21-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-21-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">run the commands:</p>



<pre class="wp-block-code"><code>fsck -y /dev/rhd0a
mount -w /</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-22.png" alt="" class="wp-image-14304" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-22.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-22-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-22-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Now we can mount the floppy disk</p>



<pre class="wp-block-code"><code>mkdir /mnt
mount /dev/fd0a /mnt
ls /mnt</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-23.png" alt="" class="wp-image-14305" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-23.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-23-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-23-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">I&#8217;ve included both the kernel &amp; NE2000 driver in one file, and JUST the NE2000 driver in the other.  For my sake I use the first one, update.tar.gz as I wanted to use the newer kernel ASAP.  tar -zxvf didn&#8217;t want to run, so I did a rather awkward version to achieve the same thing.</p>



<pre class="wp-block-code"><code>cat /mnt/update.tar.gz | gzip -dc | tar -xvf -</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-24.png" alt="" class="wp-image-14306" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-24.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-24-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-24-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">With the files in place, you can now shut down the system with a simple</p>



<pre class="wp-block-code"><code>shutdown -h now</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-25.png" alt="" class="wp-image-14307" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-25.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-25-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-25-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Once more again, I&#8217;d shut down the emulator, and backup the hard disk. If anything goes wrong you can restore your backups at any phase, at least saving some time!</p>



<p class="wp-block-paragraph">Next is the graphical install.  In this case I use the hecnet bridge to give full access, you can setup with the slirp driver with a simple &#8220;-net user&#8221; but it doesn&#8217;t matter at the moment  Since I opted for the newer kernel, I can take advantage of the 512MB RAM.</p>



<pre class="wp-block-code"><code>qemu -L pc-bios -m 512 ^
-k en-us ^
-rhapsodymouse ^
-hda rhapsody.vmdk ^
-cdrom rhapsody_dr2_x86.iso ^
-fda rhapsody_dr2_x86_InstallationFloppy.img ^
-net nic,model=ne2k_pci,vlan=5 ^
-net socket,udp=0.0.0.0:5001,remote=127.0.0.1:5000 ^
-boot c ^</code></pre>



<p class="wp-block-paragraph">Booting Rhapsody</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-30.png" alt="" class="wp-image-14308" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-30.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-30-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-30-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Now we have to setup the hardware.  It should be somewhat straight forward, first we start with the monitor.  The mouse should be working although I find that I have to move slowly.  Sorry it tracks weird on real hardware too.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-31.png" alt="" class="wp-image-14309" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-31.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-31-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-31-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">The Cirrus Logic GD5446 should be detected automatically, I just go with the default 1MB</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-32.png" alt="" class="wp-image-14310" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-32.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-32-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-32-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Next under the mice, select the PS/2 mouse and remove it</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-33.png" alt="" class="wp-image-14311" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-33.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-33-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-33-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">This leaves us with the Bus Mouse driver.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-34.png" alt="" class="wp-image-14312" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-34.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-34-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-34-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Under the network tab, the NE2000 should be automatically detected.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-35.png" alt="" class="wp-image-14313" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-35.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-35-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-35-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">On the last tab, I make a habit of removing the Parallel port freeing IRQ 7, in case I wanted it for something else.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-36.png" alt="" class="wp-image-14314" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-36.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-36-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-36-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Back to the summary, we now have Cirrus Logic video, NE2k networking, with no SCSI, no Audio.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-37.png" alt="" class="wp-image-14315" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-37.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-37-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-37-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">With the config saved, now we can just install as is.  I un-installed Japanese, but it doesn&#8217;t matter.  You absolutely need the Development Tools, so may as well go with eveything.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-38.png" alt="" class="wp-image-14316" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-38.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-38-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-38-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">The installation only takes a few minutes and we are ready to reboot</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-39.png" alt="" class="wp-image-14317" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">The kernel will now shut down.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-39b.png" alt="" class="wp-image-14318" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39b.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39b-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-39b-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">Once more again this is a great time to make another backup of the hard disk.  At this point this is a great backup to save, as we&#8217;ve installed the OS, and selected drivers, in the next reboot we&#8217;ll be personalizing the operating system.</p>



<p class="wp-block-paragraph">We can re-run the last config once the disk has been saved.  We&#8217;ll be greeted with a message that the Server isn&#8217;t responding.  Answer YES to continue without networking.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="507" src="/wp-content/uploads/2024/04/rhapsody-install-40.png" alt="" class="wp-image-14323" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-40.png 642w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-40-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-40-380x300.png 380w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p class="wp-block-paragraph">From here we are in the Setup Assistant, taking a nod from MacOS 8</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-41.png" alt="" class="wp-image-14324" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-41.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-41-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-41-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-41-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">I use USA keyboards. The best keyboards!  I touch type so I don&#8217;t have to deal with weird layouts.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-42.png" alt="" class="wp-image-14325" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-42.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-42-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-42-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-42-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Specify for a LAN connection</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-43.png" alt="" class="wp-image-14326" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-43.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-43-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-43-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-43-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">There is no DHCP support so specify a manual IP address.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-44.png" alt="" class="wp-image-14327" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-44.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-44-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-44-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-44-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">The default stuff is just wrong.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-45.png" alt="" class="wp-image-14328" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-45.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-45-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-45-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-45-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">On my LAN this is good enough.  DONT add a router.  It&#8217;ll just confuse it.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-46.png" alt="" class="wp-image-14329" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-46.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-46-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-46-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-46-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">We don&#8217;t have or want NetInfo.  This would be the server to give out IP addresses, and authentication.  We don&#8217;t need it!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-47.png" alt="" class="wp-image-14330" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-47.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-47-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-47-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-47-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Leave the DNS servers blank</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-48.png" alt="" class="wp-image-14331" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-48.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-48-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-48-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-48-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">You can setup any location, it doesn&#8217;t matter.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-49.png" alt="" class="wp-image-14332" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-49.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-49-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-49-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-49-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Likewise, with NTP, turn it off.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-50.png" alt="" class="wp-image-14321" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-50.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-50-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-50-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-50-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">We will then get the option to set the date/time manually.  The default time is far too old and it&#8217;ll break stuff.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-51.png" alt="" class="wp-image-14322" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-51.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-51-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-51-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-51-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Next up is user accounts.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-52.png" alt="" class="wp-image-14335" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-52.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-52-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-52-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-52-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">I always make local accounts.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-53.png" alt="" class="wp-image-14336" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-53.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-53-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-53-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-53-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Come up with some creative name</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-54.png" alt="" class="wp-image-14337" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-54.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-54-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-54-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-54-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">and a password</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-55.png" alt="" class="wp-image-14338" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-55.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-55-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-55-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-55-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">I don&#8217;t have it doing any automatic login.  You can if you want, it&#8217;s all up to you, this one doesn&#8217;t matter.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-56.png" alt="" class="wp-image-14339" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-56.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-56-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-56-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-56-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">Next is an Administrator password</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-57.png" alt="" class="wp-image-14340" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-57.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-57-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-57-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-57-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">And now we can apply our changes.  </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-58.png" alt="" class="wp-image-14341" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-58.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-58-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-58-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-58-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">It takes seconds!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-59.png" alt="" class="wp-image-14342" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-59.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-59-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-59-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-59-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /></figure>



<p class="wp-block-paragraph">And now we&#8217;ere done.  You may want yet another backup as this is tedious!</p>



<p class="wp-block-paragraph">With the final configured backup in hand, now we can boot back one more time, and now we&#8217;re in SVGA mode! </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-70.png" alt="" class="wp-image-14344" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-70.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-70-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-70-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-70-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /><figcaption class="wp-element-caption">Rhapsody DR2 Login Screen</figcaption></figure>



<p class="wp-block-paragraph">Logging in as root will give me the desktop</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="802" height="627" src="/wp-content/uploads/2024/04/rhapsody-install-72.png" alt="" class="wp-image-14345" srcset="https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-72.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-72-300x235.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-72-768x600.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/04/rhapsody-install-72-384x300.png 384w" sizes="auto, (max-width: 802px) 100vw, 802px" /><figcaption class="wp-element-caption">Desktop</figcaption></figure>



<p class="wp-block-paragraph">And there we are, all installed.</p>



<p class="wp-block-paragraph">For anyone brave enough to have read all of this, but wants the quick and easy version, it&#8217;s up on <a href="https://archive.org/details/rhapsody-install-ready-to-configure" target="_blank" rel="noreferrer noopener">archive.org</a>!</p>



<p class="wp-block-paragraph">In <a href="/2024/04/23/rebuilding-darwin-from-source-part-2-building-the-kernel/" target="_blank" rel="noreferrer noopener">part two I&#8217;ll pick up</a> with the source CD-ROM I&#8217;ve prepared, so we can start compiling Darwin!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/04/22/rebuilding-darwin-from-source-part-1-qemu/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Announcing EmuWoW Beta 1 (AXP Preview1)</title>
		<link>https://virtuallyfun.com/2024/02/17/announcing-emuwow-beta-1-axp-preview1/</link>
					<comments>https://virtuallyfun.com/2024/02/17/announcing-emuwow-beta-1-axp-preview1/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sat, 17 Feb 2024 08:57:28 +0000</pubDate>
				<category><![CDATA[DEC Alpha]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[syscall emulation]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13972</guid>

					<description><![CDATA[This is a guest post by CaptainWillStarblazer Hello, everyone. This is a continuation of my previous blogpost on EmuWoW (formerly win32emu) found here, but to summarize, I’m the 18-year-old developer behind a project that allows running applications compiled for the MIPS/Alpha &#8230; <a href="https://virtuallyfun.com/2024/02/17/announcing-emuwow-beta-1-axp-preview1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/20240217-194140.gif" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1016" height="748" src="/wp-content/uploads/2024/02/20240217-194140.gif" alt="" class="wp-image-13986"/></a><figcaption class="wp-element-caption">Freecell &amp; Winver</figcaption></figure>



<p class="wp-block-paragraph">This is a guest post by <a href="https://github.com/BHTY">CaptainWillStarblazer</a></p>



<p class="wp-block-paragraph">Hello, everyone. This is a continuation of my previous blogpost on <a href="https://github.com/BHTY/EmuWoW" target="_blank" rel="noreferrer noopener">EmuWoW</a> (formerly win32emu) <a href="/2024/01/04/win323mu-diy-wow/" target="_blank" rel="noreferrer noopener">found here</a>, but to summarize, I’m the <a href="https://github.com/BHTY" target="_blank" rel="noreferrer noopener">18-year-old developer</a> behind a project that allows running applications compiled for the MIPS/Alpha version of Windows NT on standard x86 PCs through emulation, but without requiring a full system emulator. Since that last post, the project has made some substantial strides.</p>



<p class="wp-block-paragraph">Since then, I’ve adapted the MIPS emulator from MAME, which is both more accurate and faster than my own (writing my own was a fun exercise but to the end of running applications, borrowing an emulator was a better decision). This alone enabled WinMine to function, which can be seen below.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/EmuWoW-running-MIPS-Winmine.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="753" height="403" src="/wp-content/uploads/2024/02/EmuWoW-running-MIPS-Winmine.png" alt="" class="wp-image-13973" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/EmuWoW-running-MIPS-Winmine.png 753w, https://virtuallyfun.com/wp-content/uploads/2024/02/EmuWoW-running-MIPS-Winmine-300x161.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/EmuWoW-running-MIPS-Winmine-500x268.png 500w" sizes="auto, (max-width: 753px) 100vw, 753px" /></a><figcaption class="wp-element-caption">Winmine for MIPS!</figcaption></figure>



<p class="wp-block-paragraph">Around the same time, another <a href="/2020/05/20/discord-channel-added-by-popular-request/" target="_blank" rel="noreferrer noopener">VirtuallyFun </a>member named <a href="https://www.x86matthew.com/" target="_blank" rel="noreferrer noopener">x86matthew</a> entered the scene. His prior credits include a similar project, for Win16.  He was inspired by the initial win32emu blog post, created his own similar project called <a href="https://github.com/x86matthew/WoWMIPS" target="_blank" rel="noreferrer noopener">WoWMIPS</a>, which quickly started running a few simple apps, such as WinMine, Solitaire, and Notepad.  Be sure to check out <a href="https://www.x86matthew.com/view_post?id=mips_1" target="_blank" rel="noreferrer noopener">WoWMIPS &#8211; MIPS Emulator for Windows, Part 1: Introduction</a>, and parts <a href="https://www.x86matthew.com/view_post?id=mips_2" target="_blank" rel="noreferrer noopener">2</a>,<a href="https://www.x86matthew.com/view_post?id=mips_3" target="_blank" rel="noreferrer noopener">3</a>,<a href="https://www.x86matthew.com/view_post?id=mips_4" target="_blank" rel="noreferrer noopener">4</a>,<a href="https://www.x86matthew.com/view_post?id=mips_5" target="_blank" rel="noreferrer noopener">5</a>,<a href="https://www.x86matthew.com/view_post?id=mips_6" target="_blank" rel="noreferrer noopener">6</a>!</p>



<p class="wp-block-paragraph">This had actually been what I was hoping for from the beginning; I always saw win32emu as a proof of concept for a smarter person (either myself in the future or someone else altogether) to come back later and do it better, and this is a massive undertaking for a single individual. What makes x86matthew&#8217;s WoWMIPS so incredible is its clean design. For one, there’s no thunk DLLs required. When an application tries to import a DLL, the host x86 DLL is first loaded, and then any attempts to get the address of an exported procedure from it are then redirected to an auto-generated stub of MIPS code which invokes the emulator to call the function. In other words, the thunk DLLs are generated at load time. Additionally, there’s no window procedure thunks required either. Instead, MIPS code pages are marked as non-executable, causing an access violation when Windows attempts to call them. Using an exception handler implemented via Windows XP’s <a href="https://learn.microsoft.com/en-us/windows/win32/debug/vectored-exception-handling" target="_blank" rel="noreferrer noopener">Vectored Exception Handling</a> feature, one can detect this and then invoke the emulator to execute the callback. Storing the CPU state in thread-local-storage allowed proper support for multithreading. I duplicated these design choices into EmuWoW, and the results largely speak for themselves. Unlike WoWMIPS (at time of writing), EmuWoW is still capable of loading MIPS DLLs (and will prefer to do so if possible), however.</p>



<figure class="wp-block-image size-large"><a href="/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="652" src="/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running-1024x652.png" alt="" class="wp-image-13977" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running-1024x652.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running-300x191.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running-768x489.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running-471x300.png 471w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-MIPS-apps-running.png 1165w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Various MIPS Windows NT applications running</figcaption></figure>



<p class="wp-block-paragraph">To aid the process of fixing faults in the emulator, I hacked up a quick, minimal debugger into EmuWoW. First of all, there’s a “crash screen” which will indicate the type of error and dump registers and the current instruction if there’s a fault, and a running disassembly can be printed as you go, but most crucially, there’s a limited degree of interactive debugging functionality.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="979" height="512" src="/wp-content/uploads/2024/02/emuwow-debugger.png" alt="" class="wp-image-13975" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/emuwow-debugger.png 979w, https://virtuallyfun.com/wp-content/uploads/2024/02/emuwow-debugger-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/emuwow-debugger-768x402.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/emuwow-debugger-500x261.png 500w" sizes="auto, (max-width: 979px) 100vw, 979px" /><figcaption class="wp-element-caption">The built in debugger to EmuWow</figcaption></figure>



<p class="wp-block-paragraph">The main capabilities contained herein are dumping registers and memory to the screen, disassembling regions of memory, listing loaded modules, getting import entry points, setting breakpoints, and single-stepping, along with printing functions. It’s no gdb (especially for the lack of PDB symbol support), but it’s something.</p>



<p class="wp-block-paragraph">MIPS is all well and good, however, but we can already emulate Windows NT for MIPS. MIPS is a fairly clean, simple architecture, often used for teaching, and short of weirdness like delay slots, is dead simple to emulate. And it fits the bill for what I’m trying to do here &#8211; a RISC architecture Microsoft abandoned, fixed-length 32-bit instructions, the works. However, adding support for the DEC Alpha AXP will finally get this project to where it was intended to be from the beginning, and I hope for it to eventually be able to run the Visual C++ compiler toolchain under EmuWoW. Being able to compile (and even test!) Alpha apps on readily available modern PCs will be a game-changer, and I intentionally wrote EmuWoW to be CPU-agnostic, so adding rudimentary support for the Alpha wasn&#8217;t difficult. Like with MIPS, I lifted the emulator from MAME. This admittedly did pose some challenges, due to MAME’s use of C++ features such as</p>



<ul class="wp-block-list">
<li>Classes (which I had to substitute for passing pointers to structs)</li>



<li>Templates (which I had to substitute for macros)</li>



<li>Function-style casts (which I had to change into C-style casts)</li>
</ul>



<p class="wp-block-paragraph">There was a lot of weirdness in how Alpha function calls, but it was my misunderstanding of the calling convention, and when to consider values to be 32-bit vs 64-bit posed a modest issue, but I got it to the point where some very simple DEC Alpha programs started to run, though many of them have various issues.</p>



<figure class="wp-block-image size-large"><a href="/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running.png"><img loading="lazy" decoding="async" width="1024" height="537" src="/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running-1024x537.png" alt="" class="wp-image-13974" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running-1024x537.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running-768x403.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running-500x262.png 500w, https://virtuallyfun.com/wp-content/uploads/2024/02/Windows-NT-Dec-Alpha-apps-running.png 1469w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Various Dec Alpha Windows NT applications running</figcaption></figure>



<p class="wp-block-paragraph">This is the first time this has ever been possible; emulation of AXP NT programs on standard PCs has just become possible now. I’m hoping to see EmuWoW continue to evolve, and I welcome contributions, whether that be improving support for the CPUs I already have, adding support for another (such as PowerPC) or anything else. To take a look at the code, go to <a href="https://github.com/BHTY/EmuWoW" target="_blank" rel="noreferrer noopener">github.com/bhty/emuwow</a> and to download EmuWoW and try it out for yourself, <a href="https://github.com/BHTY/EmuWoW/releases/tag/beta" target="_blank" rel="noreferrer noopener">click here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/02/17/announcing-emuwow-beta-1-axp-preview1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Targeting OS/2 with Visual Studio 2003</title>
		<link>https://virtuallyfun.com/2024/02/11/targeting-os-2-with-visual-studio-2003/</link>
					<comments>https://virtuallyfun.com/2024/02/11/targeting-os-2-with-visual-studio-2003/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 11 Feb 2024 09:08:22 +0000</pubDate>
				<category><![CDATA[assembly]]></category>
		<category><![CDATA[OS/2 2.0]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[Visual C++ toolkit 2003]]></category>
		<category><![CDATA[Visual Studio 2003]]></category>
		<category><![CDATA[Watcom C++]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13926</guid>

					<description><![CDATA[No, it&#8217;s not a typo. This is a long-winded post, but the short version is that I found a working combination to get the C compiler from Visual Studio 2003 targeting OS/2. Once I&#8217;d learned how C compilers are a &#8230; <a href="https://virtuallyfun.com/2024/02/11/targeting-os-2-with-visual-studio-2003/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2.jpg"><img loading="lazy" decoding="async" width="1024" height="1024" src="/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2.jpg" alt="" class="wp-image-13931" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2.jpg 1024w, https://virtuallyfun.com/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2-300x300.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2-150x150.jpg 150w, https://virtuallyfun.com/wp-content/uploads/2024/02/syneys-idea-of-visual-c-for-os2-768x768.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Sydney&#8217;s idea of what Visual C++ for OS/2 should look like</figcaption></figure>



<p class="wp-block-paragraph">No, it&#8217;s not a typo.</p>



<p class="wp-block-paragraph">This is a long-winded post, but the short version is that I found a working combination to get the C compiler from Visual Studio 2003 targeting OS/2.</p>



<p class="wp-block-paragraph">Once I&#8217;d learned how C compilers are a collection of programs working in concert, I&#8217;d always wanted to force Microsoft C to work in that fashion, however it is born to be a compiler that integrates everything but linking. There has been a &#8220;/Fa&#8221; or output assembly option, but I&#8217;ve never gotten it to do anything useful.  I&#8217;m not that much into assembly but it seemed insurmountable.</p>



<p class="wp-block-paragraph">But for some reason this time things were different.</p>



<p class="wp-block-paragraph">This time I used:</p>



<p class="wp-block-paragraph"><strong>Microsoft (R) Macro Assembler Version 6.11</strong></p>



<p class="wp-block-paragraph">After the great divorce and the rise of Windows NT, Microsoft had shifted from the OMF format to COFF.  However somewhere buried in their old tools it still supports it, namely MASM.  For example, if I try to run LINK386 (the OS/2 Linker) against output from Visual C++ 2003 I get his</p>



<pre class="wp-block-code"><code>abandon.obj :  fatal error L1101: invalid object module
 Object file offset: 1  Record type: 4c</code></pre>



<p class="wp-block-paragraph">However if I output to assembly and then have MASM assemble that, and try the linker, I&#8217;m bombarded with errors like this:</p>



<pre class="wp-block-code"><code>warp.obj(warp.asm) :  error L2025: __real@4059000000000000 : symbol defined more than once
warp.obj(warp.asm) :  error L2029: '__ftol2' : unresolved external</code></pre>



<p class="wp-block-paragraph">If I was smart I&#8217;d have given up, there is pages and pages of this stuff.  But I&#8217;m not smart, so instead I decided to something different, and use SED, the stream editor, and try to patch out the errors.</p>



<p class="wp-block-paragraph">The ftol2 call is for newer CPU&#8217;s and any OS/2 library won&#8217;t have it.  But instead of binary editing symbols we can replace the ftol2 with ftol with this simple line:</p>



<pre class="wp-block-code"><code> sed -e 's/_ftol2/_ftol/g'</code></pre>



<p class="wp-block-paragraph">For some reason Visual C++ likes to make all it&#8217;s reals &#8220;public&#8221; meaning there can only be one, but yet there is so many.  Why not comment them all out?</p>



<pre class="wp-block-code"><code>sed -e 's/PUBLIC\t__real@/;PUBLIC\t__real@/g'</code></pre>



<p class="wp-block-paragraph">And there are various other annoying things, but again they can be all patched out.  Just as the older Windows 1991 Pre-release compilers also have weird syntax that MASM doesn&#8217;t understand.</p>



<pre class="wp-block-code"><code>astro.asm(59): error A2138: invalid data initializer</code></pre>



<p class="wp-block-paragraph">which goes into how Microsoft C used to initialize floating point constants:</p>



<pre class="wp-block-code"><code>CONST   SEGMENT  DWORD USE32 PUBLIC 'CONST'
$T20000         DQ      0a0ce51293ee845c8r    ; 1.157407407407407E-05
$T20001         DQ      0bffffd3441429ec5r    ; 2440587.499999667
CONST      ENDS</code></pre>



<p class="wp-block-paragraph">while I found that the C compiler in Xenix 386 initialises them like this:</p>



<pre class="wp-block-code"><code>$T20000         DQ      0a0ce51293ee845c8h    ; 1.157407407407407E-05
$T20001         DQ      0bffffd3441429ec5h    ; 2440587.499999667</code></pre>



<p class="wp-block-paragraph">This one was a little hard for me as I&#8217;m not a sed expert, but I did figure out how to mark the section, and then to replace it</p>



<pre class="wp-block-code"><code>sed -e "s/DQ\t&#91;0-9a-f]<em>r/&amp;XMMMMMMX/g" $</em>.a1 |  sed -e "s/rXMMMMMMX/H/g"</code></pre>



<p class="wp-block-paragraph">And so on.  At the moment my &#8216;mangle&#8217; script is now this:</p>



<pre class="wp-block-code"><code>.c.obj:
        $(CC) $(INC) $(OPT) $(DEBUG) /c /Fa$*.a $*.c
        wsl sed -e 's/FLAT://g' $*.a &gt; $*.a1
        wsl sed -e "s/DQ\t&#91;0-9a-f]*r/&amp;XMMMMMMX/g" $*.a1 \
        | wsl sed -e "s/rXMMMMMMX/H/g" \
        | wsl sed -e 's/call \t\&#91;/call DWORD PTR\&#91;/g' \
        | wsl sed -e 's/PUBLIC\t__real@/;PUBLIC\t__real@/g' \
        | wsl sed -e 's/_ftol2/_ftol/g' &gt; $*.asm
        ml /c $*.asm
        del $*.a $*.a1 $*.asm</code></pre>



<p class="wp-block-paragraph">This allows me to plug it into a Makefile, so I only have to edit it in one place.</p>



<p class="wp-block-paragraph">Not surprisingly, this allows the LINK from Visual C++ 1.0 to link the MASM generated object files and get a native Win32 executable.  Even from the oldest compiler I have from the Microsoft OS/2 2.00 Beta 2 SDK from 1989!</p>



<p class="wp-block-paragraph">But now that we have the C compilers being able to output to something we can edit and force into a Win32, there is a few more things and suddenly:</p>



<pre class="wp-block-code"><code>        C:\cl386-research\bin\13.10.6030\cl386 /u /w /G3 /O  /c /Faphoon.a phoon.c
C:\cl386-research\bin\13.10.6030\CL386.EXE: warning: invoking C:\cl386-research\bin\13.10.6030\CL.EXE
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.6030 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

phoon.c
        wsl sed -e 's/FLAT://g' phoon.a &gt; phoon.a1
        wsl sed -e "s/DQ\t&#91;0-9a-f]*r/&amp;XMMMMMMX/g" phoon.a1  | wsl sed -e "s/rXMMMMMMX/H/g"  | wsl sed -e 's/call \t\&#91;/call DWORD PTR\&#91;/g'  | wsl sed -e 's/PUBLIC\t__real@/;PUBLIC\t__real@/g'  | wsl sed -e 's/_ftol2/_ftol/g' &gt; phoon.asm
        ml /c phoon.asm
Microsoft (R) Macro Assembler Version 6.11
Copyright (C) Microsoft Corp 1981-1993.  All rights reserved.

 Assembling: phoon.asm
        del phoon.a phoon.a1 phoon.asm
        msdos286 run286 C:\cl386-research\bin\ddk12\LINK386.EXE @phoon.lnk

Operating System/2 Linear Executable Linker
Version 2.01.012 Nov 02 1993
Copyright (C) IBM Corporation 1988-1993.
Copyright (C) Microsoft Corp. 1988-1993.
 All rights reserved.

Object Modules &#91;.obj]: astro.obj date_p.obj phoon.obj
Run File &#91;astro.exe]: phoon2 /NOE /NOI /NOD:OLDNAMES
List File &#91;nul.map]: nul.map
Libraries &#91;.lib]: ..\..\lib2\libc.lib +
Libraries &#91;.lib]: ..\..\lib2\os2386.lib
Definitions File &#91;nul.def]: nul.def;
LINK386 :  warning L4071: application type not specified; assuming WINDOWCOMPAT</code></pre>



<p class="wp-block-paragraph">I know it&#8217;s a bit of a word salad, but the key thing here is that using Visual C++ 2003&#8217;s compiler (version 13.10.6030), and outputting to assembly that we can edit, we can then use MASM to build objects that surprisingly LINK386 version 2.01.012 will link with.  I suspect this has to do with device drivers, and probably the majority of the OS/2 operating system.</p>



<p class="wp-block-paragraph">Anways, we&#8217;ve done the incredible, using the same object files, we made both a Win32 application, and an OS/2 application!</p>



<pre class="wp-block-code"><code>phoon-13.10.6030.exe: PE32 executable (console) Intel 80386, for MS Windows<br>phoon2.exe: MS-DOS executable, LX for OS/2 (console) i80386</code></pre>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003.png"><img loading="lazy" decoding="async" width="802" height="633" src="/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003.png" alt="" class="wp-image-13927" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003.png 802w, https://virtuallyfun.com/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003-300x237.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003-768x606.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/phoon-on-os2-compiled-by-visual-cplus-plus-2003-380x300.png 380w" sizes="auto, (max-width: 802px) 100vw, 802px" /></a><figcaption class="wp-element-caption">Phoon compiled by Visual C++ 2003 on OS/2 2.00</figcaption></figure>



<p class="wp-block-paragraph">Incidentally Happy CNY!</p>



<p class="wp-block-paragraph">Obviously, this is <em>VERY</em> cool stuff.</p>



<p class="wp-block-paragraph">I know the next question is do we have to rely on a 16bit linker?  How about Watcom?</p>



<pre class="wp-block-code"><code>C:\cl386-research\proj\trek&gt;wlink @trek.wlk
WATCOM Linker Version 10.0
Copyright by WATCOM International Corp. 1985, 1994. All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
loading object files
searching libraries
Warning(1008): cannot open LIBC.lib : No such file or directory
Warning(1008): cannot open OLDNAMES.lib : No such file or directory
creating an OS/2 32-bit executable
</code></pre>



<p class="wp-block-paragraph">Ignore the warnings and <strong><em>YES</em></strong> <em>we can</em> Link from something much newer &amp; 32bit!  In this example I linked the old TREK game, also built with Visual C++ 2003.  The response file looks lke:</p>



<pre class="wp-block-code"><code>SYS os2v2
NAME trek2w
FILE abandon.obj,attack.obj,autover.obj,capture.obj,cgetc.obj,checkcond.obj
FILE check_out.obj,compkl.obj,computer.obj,damage.obj,damaged.obj,dcrept.obj
FILE destruct.obj,dock.obj,dumpgame.obj,dumpme.obj,dumpssradio.obj,events.obj
FILE externs.obj,getcodi.obj,getpar.obj,help.obj,impulse.obj,initquad.obj
FILE kill.obj,klmove.obj,lose.obj,lrscan.obj,main.OBJ,move.obj
FILE nova.obj,nullsleep.obj,out.obj,phaser.obj,play.obj,ram.obj
FILE ranf.obj,rest.obj,schedule.obj,score.obj,setup.obj,setwarp.obj
FILE shield.obj,snova.obj,srscan.obj,systemname.obj,torped.obj,utility.obj
FILE visual.obj,warp.obj,win.obj
LIBR ..\..\lib2\LIBC.LIB
LIBR ..\..\lib2\OS2386.LIB</code></pre>



<p class="wp-block-paragraph">It&#8217;s probably needing additional stack space, maybe some other stuff, or resources, maybe how to flag it&#8217;s windowing compatible.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/02/watcom-linked-trek.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="770" height="412" src="/wp-content/uploads/2024/02/watcom-linked-trek.png" alt="" class="wp-image-13928" srcset="https://virtuallyfun.com/wp-content/uploads/2024/02/watcom-linked-trek.png 770w, https://virtuallyfun.com/wp-content/uploads/2024/02/watcom-linked-trek-300x161.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/02/watcom-linked-trek-768x411.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/02/watcom-linked-trek-500x268.png 500w" sizes="auto, (max-width: 770px) 100vw, 770px" /></a><figcaption class="wp-element-caption">TREK built by Visual C++ 2003, and Linked using Watcom C/C++ 10.0</figcaption></figure>



<p class="wp-block-paragraph">How do I get started, if I dare?!  First download and unpack <a href="https://archive.org/details/cl386-research-v2">cl386-research-v2</a>.  Ideally on the root of your C: drive, because why not?</p>



<p class="wp-block-paragraph">run the &#8216;env&#8217; command to set your environment up. Its pretty complicated but in the proj directly there is currently:</p>



<p class="wp-block-paragraph"><strong>*NOTE</strong> that I do use <strong>SED</strong> scripts, I have it set to use Linux in the WSL package.<br>I tried some Win32 sed but it didn&#8217;t work. So you need <strong>WSL</strong> or a working sed!</p>



<ul class="wp-block-list">
<li>bench</li>



<li>doom</li>



<li>info</li>



<li>phoon</li>



<li>trek</li>



<li>(<a href="https://github.com/neozeed/cl386-research" target="_blank" rel="noreferrer noopener">more stuff being added or updated on github</a>)</li>
</ul>



<p class="wp-block-paragraph">you can then go into each directory and run</p>



<pre class="wp-block-code"><code>make os2</code></pre>



<p class="wp-block-paragraph">and it&#8217;ll compile populate a floppy and launch the emulator</p>



<p class="wp-block-paragraph">Its all good fun.</p>



<p class="wp-block-paragraph">Read the Makefiles to configure a compiler, how to run it, and if you need to mangle the assembly. The 32bit new stuff needs to be mangled, the older stuff almost always works with just compile.</p>



<pre class="wp-block-code"><code># Version 6.00.054      1989
# https://archive.org/details/os-2-cd-rom_202401
PLATFORM = ddksrc</code></pre>



<p class="wp-block-paragraph">In this case it&#8217;ll select the platform from the &#8216;ddksdk&#8217; release. The next is if the compiler is OS/2 based or native win32. Basically 73g / windows 95 &amp; below are native Win32.</p>



<p class="wp-block-paragraph">In the above example we comment out the dos extended cross</p>



<pre class="wp-block-code"><code># dos exteded cross
CC =  $(EMU) $(DOSX) $(CL386ROOT)\$(PLATFORM)\cl386
# native CC
# CC =  $(CL386ROOT)\$(PLATFORM)\cl386</code></pre>



<p class="wp-block-paragraph">Next is the mangle strategy. In this case it&#8217;s an ancient OS/2 (like) compile so<br>try un commenting the &#8216;just compile&#8217; line</p>



<pre class="wp-block-code"><code># must include ONLY ONE strategey..
# for OS/2 it must have been assembled my MASM 6.11

include ..\-justcompile.mak
#include ..\-mangleassembly.mak
#include ..\-plainassembly.mak</code></pre>



<p class="wp-block-paragraph">save the makefile, and run</p>



<pre class="wp-block-code"><code>nmake os2</code></pre>



<p class="wp-block-paragraph">You can just close the emulator as after each run it&#8217;ll unpack a hard disk image, so nothing will be lost. or saved. It&#8217;s just for testing.  You may need to periodically clean the floppy drive, as that is the only way to transfer stuff in and out of the VM.</p>



<p class="wp-block-paragraph">What versions of CL386 have I found?  Well, it&#8217;s quite a few, although I know I&#8217;m missing quite a few.  </p>



<pre class="wp-block-code"><code>== c386 ============================
Microsoft C 5 386 Compiler

Microsoft C 5.2 286/386 Compiler -- Driver

@(#)C Compiler Apr 19 1990 11:48:30

Copyright (c) Microsoft Corp
1984-1989. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 1.00.075
Quick C Compiler Version 2.00.000
1.00.075

== ddk12 ============================

C 6.00 (Alpha) Aug 24 1990 19:12:31

Copyright (c) Microsoft Corp
1984-1989. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.054
Quick C Compiler Version 2.00.000
6.00.054

== ddk20 ============================

C 6.00 (Alpha) Aug 16 1990 23:04:06

Copyright (c) Microsoft Corp
1984-1989. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.054
Quick C Compiler Version 2.00.000
6.00.054

== ddksrc ============================

C 6.00 (Alpha) Aug 24 1990 19:21:49

Copyright (c) Microsoft Corp
1984-1989. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.054
Quick C Compiler Version 2.00.000
6.00.054

== nt-sep ============================

@(#)C Compiler 6.00 Feb 06 1991 17:15:19
@(#)C Compiler 6.00 May 13 1991 23:54:12
@(#)C Compiler 6.00 Jun 03 1991 15:16:22


Copyright (c) Microsoft Corp
1984-1991. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.077
Quick C Compiler Version 2.00.000
6.00.077

== nt-oct ============================

@(#)C Compiler 6.00 Jun 03 1991 15:16:22
@(#)C Compiler 6.00 Jun 13 1991 22:07:23
@(#)C Compiler 6.00 Oct 10 1991 00:42:24

Copyright (c) Microsoft Corp
1984-1991. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.080
Quick C Compiler Version 2.00.000
6.00.080

== nt-dec ============================
@(#)C Compiler 6.00 Jun 03 1991 15:16:22
@(#)C Compiler 6.00 Jun 13 1991 22:07:23
@(#)C Compiler 6.00 Oct 10 1991 00:42:24

Copyright (c) Microsoft Corp
1984-1991. All rights reserved.
  (press &lt;return&gt; to continue)
Microsoft 386 C Compiler. Version 6.00.081
Quick C Compiler Version 2.00.000
6.00.081

== 73g  ============================
1984-1993. All rights reserved.
Copyright (c) Microsoft Corp
8.00.3200
32-bit C/C++ Optimizing Compiler Version
Microsoft (R)


== msvc32s ============================

Microsoft 8.00.0000 - Copyright (C) 1986-1993 Microsoft Corp.
Microsoft 8.00.0000 - Copyright (C) 1986-1993 Microsoft Corp.
@(#) Microsoft C/C++ 32 bits x86 Compiler Version 8.00.XXXX

8.00.000

== 13.10.6030 ============================

Microsoft (R) C/C++ Compiler Version 13.10.6030
From my install of Visual Studio 2003 Enterprise</code></pre>



<p class="wp-block-paragraph">As you can see many of these earlier OS/2 compilers report the same versions but are in fact different builds on the inside.  I suspect Microsoft had to support one version, and an Alpha version of version 6 is as good as it got.  I would have imagined there were internal 32bit versions of 6 or 7, but I haven&#8217;t seen them.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="960" height="609" src="/wp-content/uploads/2024/02/trek_3.gif" alt="" class="wp-image-13936"/><figcaption class="wp-element-caption">Compiling and running TREK</figcaption></figure>



<p class="wp-block-paragraph">Hopefully this gives some idea of how I tried to made a probably too modular build system to try all kinds of different compilers.  I might have to see if it&#8217;s possible to run the tools from the 1992 versions of Windows NT in this setup, perhaps they are interesting as well.</p>



<p class="wp-block-paragraph">One thing in my <a href="https://virtuallyfun.com/2024/02/10/porting-gcc-to-32bit-os-2/" target="_blank" rel="noreferrer noopener">porting GCC to OS/2 experience</a> is that the usability of the C compilers from 1991 were dramatically better than what Microsoft had given IBM at the time of the divorce.  No doubt the upcoming NTOS/2 project was placing a bigger demand on the tools team.</p>



<p class="wp-block-paragraph">If anyone has any access to other &#8216;cl386&#8217; compilers, or early OS/2 2.00 stuff, please let me know!  I&#8217;d love to do build/tests and see if my idea of distributing objects &#8216;just works&#8217;!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/02/11/targeting-os-2-with-visual-studio-2003/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Totally unfair comparison of Microsoft C</title>
		<link>https://virtuallyfun.com/2024/02/05/totally-unfair-comparison-of-microsoft-c/</link>
					<comments>https://virtuallyfun.com/2024/02/05/totally-unfair-comparison-of-microsoft-c/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 05 Feb 2024 03:15:48 +0000</pubDate>
				<category><![CDATA[80386]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[OS/2]]></category>
		<category><![CDATA[OS/2 2.0]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13896</guid>

					<description><![CDATA[Because I hate myself, I tried to get the Microsoft OS/2 Beta 2 SDK&#8217;s C compiler building simple stuff for text mode NT. Because, why not?! Since the object files won&#8217;t link, we have to go in with assembly. And &#8230; <a href="https://virtuallyfun.com/2024/02/05/totally-unfair-comparison-of-microsoft-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Because I hate myself, I tried to get the Microsoft OS/2 Beta 2 SDK&#8217;s C compiler building simple stuff for text mode NT.  Because, why not?!</p>



<p class="wp-block-paragraph">Since the object files won&#8217;t link, we have to go in with assembly.  And that of course doesn&#8217;t directly assemble, but it just needs a little hand holding:</p>



<pre class="wp-block-code"><code>Microsoft (R) Program Maintenance Utility   Version 1.40
Copyright (c) Microsoft Corp 1988-93. All rights reserved.

        cl386 /Ih /Ox /Zi /c /Fadhyrst.a dhyrst.c
Microsoft (R) Microsoft 386 C Compiler. Version 1.00.075
Copyright (c) Microsoft Corp 1984-1989. All rights reserved.

dhyrst.c
        wsl sed -e 's/FLAT://g' dhyrst.a &gt; dhyrst.a1
        wsl sed -e "s/DQ\t&#91;0-9a-f]*r/&amp;XMMMMMMX/g" dhyrst.a1  | wsl sed -e "s/rXMMMMMMX/H/g" &gt; dhyrst.asm
        ml /c dhyrst.asm
Microsoft (R) Macro Assembler Version 6.11
Copyright (C) Microsoft Corp 1981-1993.  All rights reserved.

 Assembling: dhyrst.asm
        del dhyrst.a dhyrst.a1 dhyrst.asm
        link -debug:full -out:dhyrst.exe dhyrst.obj libc.lib
Microsoft (R) 32-Bit Executable Linker Version 1.00
Copyright (C) Microsoft Corp 1992-93. All rights reserved.
</code></pre>



<p class="wp-block-paragraph">I use sed to remove the FLAT: directives which makes everything upset.  Also there is some weird confusion on how to pad float constants and encode them.</p>



<pre class="wp-block-code"><code>CONST   SEGMENT  DWORD USE32 PUBLIC 'CONST'
$T20001         DQ      0040f51800r    ;        86400.00000000000
CONST      ENDS</code></pre>



<p class="wp-block-paragraph">MASM 6.11 is very update with this.  I just padded it with more zeros, but it just hung.  I suspect DQ isn&#8217;t the right size?  I&#8217;m not 386 MASM junkie.  I&#8217;m at least getting the assembler to shut-up but it doesn&#8217;t work right. I&#8217;ll have to look more into it.</p>



<p class="wp-block-paragraph">Xenix 386 also includes an earlier version of Microsoft C / 386, and it formats the float like this:</p>



<pre class="wp-block-code"><code>CONST   SEGMENT  DWORD USE32 PUBLIC 'CONST'
$T20000         DQ      0040f51800H    ;        86400.00000000000
CONST      ENDS</code></pre>



<p class="wp-block-paragraph">So I had thought maybe if I replace the &#8216;r&#8217; with a &#8216;H&#8217; that might be enough?  The only annoying thing about the Xenix compiler is that it was K&amp;R so I spent a few minutes porting phoon to K&amp;R, dumped the assembly and came up with this sed string to find the pattern, mark it, and replace it (Im not that good at this stuff)</p>



<pre class="wp-block-code"><code>wsl sed -e "s/DQ\t&#91;0-9a-f]<em>r/&amp;XMMMMMMX/g" $</em>.a1 \
| wsl sed -e "s/rXMMMMMMX/H/g" > $*.asm</code></pre>



<p class="wp-block-paragraph">While it compiles with no issues, and runs, it just hangs.  I tried the transplanted Xenix assembly and it just hangs as well.  Clearly there is something to do with how to use floats.</p>



<p class="wp-block-paragraph">I then looked at whetstone, and after building it noticed this is the output compiling with Visual C++ 8.0</p>



<pre class="wp-block-code"><code>      0       0       0  1.0000e+000 -1.0000e+000 -1.0000e+000 -1.0000e+000
  12000   14000   12000 -1.3190e-001 -1.8218e-001 -4.3145e-001 -4.8173e-001
  14000   12000   12000  2.2103e-002 -2.7271e-002 -3.7914e-002 -8.7290e-002
 345000       1       1  1.0000e+000 -1.0000e+000 -1.0000e+000 -1.0000e+000
 210000       1       2  6.0000e+000  6.0000e+000 -3.7914e-002 -8.7290e-002
  32000       1       2  5.0000e-001  5.0000e-001  5.0000e-001  5.0000e-001
 899000       1       2  1.0000e+000  1.0000e+000  9.9994e-001  9.9994e-001
 616000       1       2  3.0000e+000  2.0000e+000  3.0000e+000 -8.7290e-002
      0       2       3  1.0000e+000 -1.0000e+000 -1.0000e+000 -1.0000e+000
  93000       2       3  7.5000e-001  7.5000e-001  7.5000e-001  7.5000e-001</code></pre>



<p class="wp-block-paragraph">However this is the output from C/386:</p>



<pre class="wp-block-code"><code>      0       0       0  5.2998e-315  1.5910e-314  1.5910e-314  1.5910e-314
  12000   14000   12000  0.0000e+000  0.0000e+000  0.0000e+000  0.0000e+000
  14000   12000   12000  0.0000e+000  0.0000e+000  0.0000e+000  0.0000e+000
 345000       1       1  5.2998e-315  1.5910e-314  1.5910e-314  1.5910e-314
 210000       1       2  6.0000e+000  6.0000e+000  0.0000e+000  0.0000e+000
  32000       1       2  5.2946e-315  5.2946e-315  5.2946e-315  5.2946e-315
 899000       1       2  5.2998e-315  5.2998e-315  0.0000e+000  0.0000e+000
 616000       1       2  5.3076e-315  5.3050e-315  5.3076e-315  0.0000e+000
      0       2       3  5.2998e-315  1.5910e-314  1.5910e-314  1.5910e-314
  93000       2       3  5.2972e-315  5.2972e-315  5.2972e-315  5.2972e-315</code></pre>



<p class="wp-block-paragraph">Great they look nothing alike. So something it totally broken.  I guess the real question is, does it even work on OS/2?</p>



<p class="wp-block-paragraph">Since I should post the NMAKE Makefile so I can remember how it can do custom steps so I can edit the intermediary files.  Isn&#8217;t C fun?!</p>



<pre class="wp-block-code"><code>INC = /Ih
OPT = /Ox
DEBUG = /Zi
CC = cl386

OBJ = dhyrst.obj

.c.obj:
	$(CC) $(INC) $(OPT) $(DEBUG) /c /Fa$*.a $*.c
	wsl sed -e 's/FLAT://g' $*.a &gt; $*.a1
	wsl sed -e "s/DQ\t&#91;0-9a-f]*r/&amp;XMMMMMMX/g" $*.a1 \
	| wsl sed -e "s/rXMMMMMMX/H/g" &gt; $*.asm
	ml /c $*.asm
	del $*.a $*.a1 $*.asm

dhyrst.exe: $(OBJ)
        link -debug:full -out:dhyrst.exe $(OBJ) libc.lib

clean:
        del $(OBJ)
        del dhyrst.exe
        del *.asm *.a *.a1</code></pre>



<p class="wp-block-paragraph">As you can see, I&#8217;m using /Ox or maximum speed!  So how does it compare?</p>



<pre class="wp-block-code"><code>Dhrystone(1.1) time for 180000000 passes = 20
This machine benchmarks at 9000000 dhrystones/second</code></pre>



<p class="wp-block-paragraph">And for the heck of it, how does Visual C++ 1.0&#8217;s performance compare?</p>



<pre class="wp-block-code"><code>Dhrystone(1.1) time for 180000000 passes = 7<br>This machine benchmarks at 25714285 dhrystones/second</code></pre>



<p class="wp-block-paragraph">That&#8217;s right the 1989 compiler is 35% the speed of the 1993 compiler. wow.  Also it turns out that MASM 6.11 actually can (mostly) assemble the output of this ancient compiler.  It&#8217;s nice when something kind of work.  I can also add that the Infocom &#8217;87 interpreter works as well. </p>



<p class="wp-block-paragraph">YAY!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/02/05/totally-unfair-comparison-of-microsoft-c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>So it turns out GCC could have been available on Windows NT the entire time!</title>
		<link>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/</link>
					<comments>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 08 Jan 2024 18:32:14 +0000</pubDate>
				<category><![CDATA[cross compiler]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows NT 3.1]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13729</guid>

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



<p class="wp-block-paragraph">I uploaded the source on <a href="https://github.com/neozeed/gcc-140_gas-138_WindowsNT_v239">github</a>, along with <a href="https://github.com/neozeed/gcc-140_gas-138_WindowsNT_v239/releases">some binaries</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/01/08/so-it-turns-out-gcc-could-have-been-available-on-windows-nt-the-entire-time/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Rise of Unix. The Seeds of its Fall. / A Chronicle of the Unix Wars</title>
		<link>https://virtuallyfun.com/2024/01/05/the-rise-of-unix-the-seeds-of-its-fall-a-chronicle-of-the-unix-wars/</link>
					<comments>https://virtuallyfun.com/2024/01/05/the-rise-of-unix-the-seeds-of-its-fall-a-chronicle-of-the-unix-wars/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 05 Jan 2024 09:42:29 +0000</pubDate>
				<category><![CDATA[32v]]></category>
		<category><![CDATA[386BSD]]></category>
		<category><![CDATA[4 BSD]]></category>
		<category><![CDATA[4.2 BSD]]></category>
		<category><![CDATA[4.3 BSD]]></category>
		<category><![CDATA[4.3 BSD RENO]]></category>
		<category><![CDATA[80386]]></category>
		<category><![CDATA[AT&T Unix]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[SIMH]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[videos]]></category>
		<category><![CDATA[virtual networking]]></category>
		<category><![CDATA[Win32]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13695</guid>

					<description><![CDATA[It&#8217;s not mine, rather it&#8217;s Asianometry&#8216;s. It&#8217;s a nice overview of the rise of Unix. I&#8217;d recommend checking it out, it&#8217;s pretty good. And of course, as I&#8217;m referenced! And part 2: A Chronicle of the Unix Wars Years ago &#8230; <a href="https://virtuallyfun.com/2024/01/05/the-rise-of-unix-the-seeds-of-its-fall-a-chronicle-of-the-unix-wars/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">It&#8217;s not mine, rather it&#8217;s <a href="https://www.youtube.com/@Asianometry">Asianometry</a>&#8216;s.  It&#8217;s a nice overview of the rise of Unix.  I&#8217;d recommend checking it out, it&#8217;s pretty good.  And of course, as I&#8217;m referenced!<a href="https://www.youtube.com/@Asianometry"></a></p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="The Rise of Unix. The Seeds of its Fall." width="584" height="329" src="https://www.youtube.com/embed/HADp3emVABg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption">The Rise of Unix. The Seeds of its Fall.</figcaption></figure>



<p class="wp-block-paragraph">And part 2: A Chronicle of the Unix Wars</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="A Chronicle of the Unix Wars" width="584" height="329" src="https://www.youtube.com/embed/Ffh3DRFzRL0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption"><a href="https://www.youtube.com/watch?v=Ffh3DRFzRL0">A Chronicle of the Unix Wars (youtube.com)</a></figcaption></figure>



<p class="wp-block-paragraph">Years ago I had tried to make these old OS&#8217;s accessible to the masses with a simple windows installer where you could click &amp; run these ancient artifacts.  Say 4.2BSD.</p>



<p class="wp-block-paragraph"><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.3%20Beta%201/BSD4.2-install-0.3.exe/download">Download BSD4.2-install-0.3.exe (Ancient UNIX/BSD emulation on Windows) (sourceforge.net)</a></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="649" src="https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows-1024x649.png" alt="" class="wp-image-13696" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows-1024x649.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows-300x190.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows-768x487.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows-473x300.png 473w, https://virtuallyfun.com/wp-content/uploads/2024/01/install-4.2BSD-on-windows.png 1305w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Installing should be pretty straight forward, I just put the license as a click through and accept defaults.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="622" src="https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD-1024x622.png" alt="" class="wp-image-13697" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD-1024x622.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD-300x182.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD-768x466.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD-494x300.png 494w, https://virtuallyfun.com/wp-content/uploads/2024/01/booted-into-4.2BSD.png 1031w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Starting BSD via &#8216;RUN BSD42&#8217; and the emulator will fire up, and being up a console program (Tera Term) giving you the console access.  Windows will probably warn you that it requested network access.  This will allow you to access the VAX over the network, including being able to telnet into the VAX via &#8216;Attach a PTY&#8217; which will spawn another Tera Term, prompting you to login.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="822" height="427" src="https://virtuallyfun.com/wp-content/uploads/2024/01/attach-a-ptty.png" alt="" class="wp-image-13698" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/attach-a-ptty.png 822w, https://virtuallyfun.com/wp-content/uploads/2024/01/attach-a-ptty-300x156.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/attach-a-ptty-768x399.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/attach-a-ptty-500x260.png 500w" sizes="auto, (max-width: 822px) 100vw, 822px" /><figcaption class="wp-element-caption">telnettting into the VAX</figcaption></figure>



<p class="wp-block-paragraph">You can login as root, there is no password, and now you are up and running your virtual VAX with 4.2BSD!</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-items.png"><img loading="lazy" decoding="async" width="748" height="652" src="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-items.png" alt="" class="wp-image-13699" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-items.png 748w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-items-300x261.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-items-344x300.png 344w" sizes="auto, (max-width: 748px) 100vw, 748px" /></a><figcaption class="wp-element-caption">All the items</figcaption></figure>



<p class="wp-block-paragraph">I converted many of the old documents into PDF&#8217;s so you may want to start with the Beginners guide to Unix.  I thought this was a great way to bring a complex system to the masses, but I&#8217;m not sure if I succeded.</p>



<figure class="wp-block-image size-large"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats.png"><img loading="lazy" decoding="async" width="1024" height="488" src="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats-1024x488.png" alt="" class="wp-image-13700" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats-1024x488.png 1024w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats-300x143.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats-768x366.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats-500x238.png 500w, https://virtuallyfun.com/wp-content/uploads/2024/01/4.2BSD-download-stats.png 1171w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">776 downloads</figcaption></figure>



<p class="wp-block-paragraph">As it sits now, since 2007 it&#8217;s had 776 downloads.  I&#8217;d never really gotten any feedback so I&#8217;d hoped it got at least a few people launched into the bewildering world of ancient Unix.  Of course I tried to make many more packages but I&#8217;d been unsure if any of them went anywhere.  It&#8217;s why I found these videos so interesting as at least the image artifacts got used for something!</p>



<p class="wp-block-paragraph">But in the off hand, maybe this can encourage some Unix curious into a larger world.</p>



<p class="wp-block-paragraph">Other downloads in the same scope are:</p>



<ul class="wp-block-list">
<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.3%20Beta%201/Research-unixv1-0.3.exe/download">Research-unixv1</a></li>



<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.3%20Beta%201/unix32v-0.3.exe/download">unix32v</a></li>



<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.3%20Beta%201/BSD4.3-install-0.3.exe/download">BSD4.3</a></li>



<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.4/4.3BSD-Uwisc-install-0.4.exe/download">4.3BSD-Uwisc</a></li>



<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.3%20Beta%201/BSD4.3-Reno-installer-0.3.exe/download">BSD4.3-Reno</a></li>



<li><a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.4/386BSD-0.1.exe/download">386BSD-0.1</a></li>
</ul>



<p class="wp-block-paragraph">Enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/01/05/the-rise-of-unix-the-seeds-of-its-fall-a-chronicle-of-the-unix-wars/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Win32Emu / DIY WOW</title>
		<link>https://virtuallyfun.com/2024/01/04/win323mu-diy-wow/</link>
					<comments>https://virtuallyfun.com/2024/01/04/win323mu-diy-wow/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 04 Jan 2024 00:10:22 +0000</pubDate>
				<category><![CDATA[guest post]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[syscall emulation]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows NT 4.0]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=13684</guid>

					<description><![CDATA[This is a guest post by CaptainWillStarblazer When the AXP64 build tools for Windows 2000 were discovered back in May 2023, there was a crucial problem. Not only was it difficult to test the compiled applications since you needed an &#8230; <a href="https://virtuallyfun.com/2024/01/04/win323mu-diy-wow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This is a guest post by <a href="https://github.com/BHTY">CaptainWillStarblazer</a></p>



<p class="wp-block-paragraph">When the <a href="https://virtuallyfun.com/2023/05/05/hiding-in-plain-sight-the-64bit-dec-alpha-c-compiler/">AXP64 build tools for Windows 2000</a> were discovered back in May 2023, there was a crucial problem. Not only was it difficult to test the compiled applications since you needed an exotic and rare DEC Alpha machine running a leaked version of Windows, it was also difficult to even compile the programs, since you needed the same DEC Alpha machine to run the compiler; there was no cross-compiler.</p>



<p class="wp-block-paragraph">As a result, I began writing a program conceptually similar to WOW64 on Itanium (or WX86, or FX-32), only in reverse, to allow RISC Win32 programs to run on x86.</p>



<p class="wp-block-paragraph">The PE/COFF file format is surprisingly simple once you get the hang of it, so loading a basic Win32 EXE that I assembled with NASM&nbsp;&nbsp;was pretty simple – just map the appropriate sections to the appropriate areas, fix up import tables, and start executing.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/image001.png"><img loading="lazy" decoding="async" width="965" height="508" src="https://virtuallyfun.com/wp-content/uploads/2024/01/image001.png" alt="" class="wp-image-13673" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/image001.png 965w, https://virtuallyfun.com/wp-content/uploads/2024/01/image001-300x158.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/image001-768x404.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/01/image001-500x263.png 500w" sizes="auto, (max-width: 965px) 100vw, 965px" /></a></figure>



<p class="wp-block-paragraph">To start, I wrote a basic 386 emulator core. To complement it, I wrote my own set of Windows NT system DLLs (USER32, KERNEL32, GDI32) that execute inside of the emulator and then use an interrupt to signal a system call&nbsp;&nbsp;which is trapped by the emulator and thunked up to execute the API call on the host.</p>



<p class="wp-block-paragraph">For example, up above, you can see that the emulated app calls MessageBoxA inside of the emulated USER32, which puts 0 in EAX (the API call number for MessageBoxA) and then does the syscall interrupt (int 0x80 in my case), which causes the emulator to grab the arguments off of the stack and call MessageBoxA.</p>



<p class="wp-block-paragraph">To ease communication between the host’s Win32 environment and the emulated Win32 environment, I ran the emulated CPU inside of the host’s memory space, which means that to run applications written for a 32-bit version of Windows NT, you need a 32-bit version of win32emu (or a 64-bit version with /LARGEADDRESSAWARE:NO passed to the linker) to avoid pointer truncation issues, to prevent Windows from mapping memory addresses inaccessible by the emulated CPU.</p>



<p class="wp-block-paragraph">To get “real” apps working, a lot of single-stepping through the CRT was required, but eventually I did get Reversi – one of the basic Win32 SDK samples – to work, albeit with some bugs at first. Calling a window procedure essentially requires a thunk in reverse, so I inserted a thunk window procedure on the host side that calls the emulated window procedure and returns the result.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/image012.jpg"><img loading="lazy" decoding="async" width="465" height="388" src="https://virtuallyfun.com/wp-content/uploads/2024/01/image012.jpg" alt="" class="wp-image-13669" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/image012.jpg 465w, https://virtuallyfun.com/wp-content/uploads/2024/01/image012-300x250.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/image012-360x300.jpg 360w" sizes="auto, (max-width: 465px) 100vw, 465px" /></a><figcaption class="wp-element-caption">It&#8217;s amazing, it&#8217;s reversi!</figcaption></figure>



<p class="wp-block-paragraph">After this, I got to work on getting more complicated applications to work. Several failed due to lack of floating-point support, some failed due to unsupported DLLs, but I was able to get FreeCell and WinMine to work (with some bugs) after adding SHELL32. I was able to run the real SHELL32.DLL from Windows NT 3.51 under this environment.</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/image013.jpg"><img loading="lazy" decoding="async" width="624" height="325" src="https://virtuallyfun.com/wp-content/uploads/2024/01/image013.jpg" alt="" class="wp-image-13670" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/image013.jpg 624w, https://virtuallyfun.com/wp-content/uploads/2024/01/image013-300x156.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/image013-500x260.jpg 500w" sizes="auto, (max-width: 624px) 100vw, 624px" /></a><figcaption class="wp-element-caption">Freecell</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="623" height="338" src="https://virtuallyfun.com/wp-content/uploads/2024/01/image014.jpg" alt="" class="wp-image-13671" srcset="https://virtuallyfun.com/wp-content/uploads/2024/01/image014.jpg 623w, https://virtuallyfun.com/wp-content/uploads/2024/01/image014-300x163.jpg 300w, https://virtuallyfun.com/wp-content/uploads/2024/01/image014-500x271.jpg 500w" sizes="auto, (max-width: 623px) 100vw, 623px" /><figcaption class="wp-element-caption">Minesweeper</figcaption></figure>



<p class="wp-block-paragraph">One might wonder why I put all this work into running x86 programs on x86, but the reason is that there’s the most information about, and I’m most proficient with, Windows on the 386. Not only does Windows on other CPUs use other CPUs, but also there’s different calling conventions and a lot of other stuff I didn’t want to mess with at first. But this was at least a proof-of-concept to build a framework where I could swap the CPU core for an emulator for MIPS or PPC or Alpha or whatever I wanted and get stuff running.</p>



<p class="wp-block-paragraph">Astute readers might be wondering why I didn’t take the approach taken by WOW64. For those who don’t know, most system DLLs on WOW64 are the same as those in 32-bit Windows, the only ones that are different are ones with system call stubs that call down to the kernel (NTDLL, GDI32, and USER32, the first of which calls to NTOSKRNL and the latter two calling to WIN32K.SYS). WOW64 instead calls a function with a system call dispatch number, which does essentially the same thing. The reason for this is that the system call numbers are undocumented and change between versions of Windows. WOW64, being an integrated component of Windows, can stay up to date. If I took this approach, I’d either have to stay locked to one emulated set of DLLs (i.e. from NT 4.0) and use their system call numbers on the emulated side, or write my own emulated DLLs and stick to a fixed set of numbers, but either way I’d somehow have to map them to whatever syscall numbers are being used on the host.</p>



<p class="wp-block-paragraph">As I went on, I should probably also mention that what I said earlier about loading Win32 apps being easy was wrong. Loading a PE image is pretty straightforward, but once you get into populating the TEB and PEB (many of whose fields are undocumented), it quickly gets gnarly, and my PEB emulation is incomplete.</p>



<p class="wp-block-paragraph">Adding MIPS support wasn’t too much of a hassle, since the MIPS ISA (ignoring delay slots, which gave me no shortage of trouble) is pretty clean and writing&nbsp;&nbsp;an emulator wasn’t difficult. The VirtuallyFun Discord pointed me to Embedded Visual C++ 4.0, which was invaluable to me during development, since it included a MIPS assembler and disassembler, which I haven’t seen elsewhere. After writing a set of MIPS thunk DLLs and doing some more debugging, I finally got Reversi working.</p>



<p class="wp-block-paragraph">There’s still some DLL relocation/rebasing issues, but Reversi is finally working in this homebrewed WOW!</p>



<figure class="wp-block-image size-full"><a href="https://virtuallyfun.com/wp-content/uploads/2024/01/image015.gif"><img loading="lazy" decoding="async" width="624" height="326" src="https://virtuallyfun.com/wp-content/uploads/2024/01/image015.gif" alt="" class="wp-image-13672"/></a></figure>



<p class="wp-block-paragraph">I’d encourage someone to write a CPU module for the DEC Alpha AXP (or even PowerPC if anyone for some reason wants that). The API isn’t too complicated, and the i386 emulator is available for reference to see how the CPU emulator interfaces with the Win32 thunking side. An Alpha backend for the thunk compiler can definitely be written without too much trouble. Obviously, the AXP presents the challenge that fewer people are familiar with its instruction set than MIPS or 386, but this approach does free one from having to emulate all of the intricate hardware connections in actual Alpha applications while still running applications designed for it, and I’ve heard the Alpha is actually quite nice and clean. MAME’s Digital Alpha core could be a good place to start, but it’ll need some adaptation to work in this codebase. Remember that while being a 64-bit CPU with 64-bit registers and operations, the Alpha still runs Windows with 32-bit pointers, so it should run in a 32-bit address space (i.e. pass /LARGEADDRESSAWARE:NO to the linker).</p>



<p class="wp-block-paragraph">Theoretically, recompiling the application to support the full address space should enable emulation of AXP64 applications, since the Alpha’s 64-bit pointers will allow it to address the host’s 64-bit address space, but I’m not sure if my emulator is totally 64-bit clean, or if the AXP64’s calling convention is materially different from that on the AXP32 in such a way that would require substantial changes. In either case, most of the code should still be transferable.</p>



<p class="wp-block-paragraph">I also want to get more “useful” applications running, like development tools (i.e. the MSVC command line utilities &#8211; CL, MAKE, LINK, etc.) and CMD. Most of that probably involves implementing more thunks and potentially fixing CPU bugs.</p>



<p class="wp-block-paragraph">This project is obviously still in a quite early stage, but I’m hoping to see it grow and become something useful for those in the hobby.</p>



<p class="wp-block-paragraph">For those who want to play along at home, you can download the <a href="https://github.com/BHTY/Win32Emu/releases/download/alpha/w32emu.zip">binary snapshot here: w32emu.zip</a></p>



<p class="wp-block-paragraph">A more complete version of the writeup is available here:&nbsp;<a href="https://bhty.github.io/og/win32emu_VirtuallyFun_Post.htm">https://bhty.github.io/og/win32emu_VirtuallyFun_Post.htm</a>&nbsp;and you can find the project here&nbsp;<a href="https://github.com/BHTY/Win32Emu/">https://github.com/BHTY/Win32Emu/</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/01/04/win323mu-diy-wow/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
