Quake for the MIPS (NT4)

Well I started this off hoping I could get Quake running on Windows NT 3.1 … I’m almost there I have the null version running just fine. However I’m not all that great with DIB programming so I was looking thru SDL and saw that it has a WINDIB driver!

So with a LOT of tweaking through SDL 1.2.13 I got it to compile with Visual C++ 1.0!! However it is lacking one critical call, the CreateDIBSection api call in GDI is not present in NT 3.1. So remembering all the MIPS stuff as of late, and that I have Visual C++ 4.0 which should easily support this call, I first got it running with Visual C++ 2.0 on the i386 (Under XP of all things). So it was just a matter of building the source, and making sure there is no errors, uploading it to the emulator, and rebuilding for the MIPS.

And after 30 minutes, I got my exe, and it ran!

Quake 1.06 on the MIPS/NT

Quake 1.06 on the MIPS/NT

I’ve included a link for any other MIPS people out there that want to play quake. I haven’t built the networking as I was having issues with my network earlier and couldn’t get it working…

The exe is available here.

And the source code with all the bits is right here.

In this build I’m not building SDL as a DLL or static library, but rather compiling Quake right into the source. Now that SDL is running on the MIPS, and possibly other Win32 OS’s (I have yet to test Win32s… I suspect the inherent threading in SDL will prevent it, but could the DBI calls be made directly stripping out SDL…?) but who knows, I think anything past 3.51 would work.

Tip on memory for Windows NT 3.1 users

I just found out that if you replace the ntldr & ntdetect.com from Windows NT 3.51 service pack 5, you can access as much memory as the 32bit platform will let you!!! This is of course, 2GB per process, 1GB for Windows NT, the other 1GB is reserved for PCI hardware (remember the upper 384k in MS-DOS??). I have to say it’s GREAT to shatter the 64MB barrier of the earlier PC’s.

Anyways it’s quite simple to do, just download and extract service pack 5, then just copy the ntldr & ntdetect.com in the c:\ directory.

And here is a screen shot for the heck of it, of my Windows NT 3.1 with NT 3.51’s loader running with 3GB of ram! This makes compiling bigger things way easier, and I don’t have to page like crazy with Netscape…

Windows NT 3.1 with 3GB of RAM!

Windows NT 3.1 with 3GB of RAM!

For what it’s worth, I wouldn’t go beyond 3GB, as you’ll never get to use any more then that much, just as it is with Windows 2000,XP,2003,Vista on the i386 32bit platform. That is just the way it is, and yes XP & Vista that tell you about your 4GB of ram are simply reporting installed ram, not available memory.

Minor tip for Virtual PC 2007 users

On vista with some fancy multi core machines… I’ve found that some OS’s will just DOG big time, inducing major latency, disk errors, and of course it’ll eventually corrupt the guest OS into not working.

As an instance, NT 3.1 takes about 30 minutes to install (compare to Qemu in about 2 minutes tops) and every time I’d try to convert the disk to NTFS it would either corrupt the disk so it couldn’t boot or it would fail saying the disk was unable to convert…

Anyways back when Virtual PC was a connectix product it was meant to run on a SINGLE CPU/CORE.  Back then multiproc machines were servers…  And who would be running Windows NT 4.0 server on a Windows NT 4.0 server??

Anyways the ‘fix’ here is to set Virtual PC’s affinity to a single core BEFORE you start any VM’s.  I’ve been setting mine to 0, but i suspect it doesn’t matter as long as no other VM’s have started before hand.  Anyways start up Virtual PC, then launch task manager, and set it’s affinity to a single core, then you’ll be good to go!

So far it would seem that Virtual Server is not hit by this, and I have to wonder if you install Virtual server onto a machine running Virtual PC with the new ‘core’ would it work correctly…..?

Anyways this fix is good enough for me.  It’s nice to boot up in a few seconds.

Networking with Windows NT 3.1 under emulation

 

Windows NT 3.1 does NOT support the PCI bus, making most emulation difficult to impossible.

However some vendors wrote their own PCI routines allowing their PCI devices to work under Windows NT 3.1!

And as luck would have it, the two that I found should work for both VMWare & Virtual PC users!

First the Virtual PC users, you’ll want this file GF10011.EXE , and just extract it, and put it on a floppy.  x64 users will either need to do this under dosbox / MS-DOS in a VM… Also another note about Virtual PC & NT 3.1 is that it has massive pauses, to where it seems to be unusable.  I’ve found that altering the Virtual PC process, and binding it to only a single CPU, and boosting it’s priority helps a great deal, although it’s nothing compared to the speed of Qemu…

VMWare users can download an AMD Pcnet driver here that will happily bind on PCI.  Once you install the driver, you can have it scan the appropriate busses and it should pull up and work.

Another fun thing I found for Virtual PC users, is that the HP Pavilion 5000 desktop shipped ready for Windows NT 3.1, and it was equiped with a S3 video card! And it’s video driver will work with Virtual PC! You can download it from HP’s site here.

This brings Windows NT 3.1 into a far more usable state. Another fun thing I found is that Netscape 2 & 3 for Windows 3.1 WILL RUN! One of these days I’ll have to sort out the exchange client situation…

And if anyone wants to see it in action, be sure to check out Apache running on Windows NT 3.1!

Or you can hit it directly:

http://winnt31.superglobalmegacorp.com/

Visual C++ 4.0 arrived today!

For the RISC cpu!… That being Alpha & MIPS. Although the back of the box does mention PowerPC there is no PowerPC anything here…

Visual C++ 4.0 RISC box

Visual C++ 4.0 RISC box

I always did like the old Microsoft boxes during this time period… They always looked somewhat professional, not like today’s weird boxes that look like some kind of toy should be inside.

Also speaking of RISC cpu’s check the back of the Visual C++ 2.0 for mips box:

Visual C++ 2.0 MIPS box back

Visual C++ 2.0 MIPS box back

You have to remember it was “time” the golden age of the promised RISC cpu… Intel was hitting that wall with the 486, but lo the pentium changed all of that. And the Pentium PRO cemented all the little RISC cpu’s death. It’s funny how at the same time the “itanic/itanium” is just as dead as well.. MIPS. At least MIPS has their embedded space.. Which is funny looking back at the R4000 as a workstation CPU, and now it’s available in handhelds & set tops.. Although the Acorn derived strongarm is well… Strong-arming MIPS & Power for embedded dominance.

I’m pretty sure that Visual C++ 4.0 brought a lot of Windows 95 like functionality to NT, so I’ll have to see just how much(or little) of modern stuff will build. According to this link, 4.0a was the LAST version to support the MIPS, so Unless I can find 4.0a this is as good as it’s going to get.

If anyone has either insight on where to get Visual C++ 4.0a for the MIPS, or even where to get NT 3.1 for the Alpha give me a line…. Not to mention service pack 3 for the MIPS running NT 3.1… I have a feeling the shiped kernel is at fault in the emulator…

Microsoft eMbedded Visual C++ 4.0

Well I was looking for a way to cross compile to the MIPS and also if I could use my old Platform builder 2.11… Anyways Platform builder has cross compilers, but no libraries, I figured you need the eMbeded Visual C++.. And as luck has it, you can download it right here!. Also you’ll probably want service pack 4.(local mirror), and don’t forget the code TRT7H-KD36T-FRH8D-6QH8P-VFJHQ

System Requirements

  • Supported Operating Systems: Windows 2000; Windows XP
  • Microsoft Windows® 2000 Professional SP2, Microsoft Windows 2000 Server SP2, or Microsoft Windows XP Professional
  • A desktop computer with a Pentium-II class processor, 450 MHz or faster
  • 96 MB (128 MB recommended) memory for Windows 2000 Professional or Windows XP Professional. 192 MB (256 MB recommended) memory for Windows 2000 Server.
  • 200 MB hard disk space
  • CD-ROM drive
  • VGA or higher-resolution monitor. A Super VGA (800 x 600 or larger) monitor is recommended.
  • Mouse or compatible pointing device

If your machine is NOT up to this kind of capability, then you can download the older eMbedded Visaul C++ 3.0, that will run on Windows NT 4.0 (i386 of course). Purdue also had a nice walkthrough on installing the 3.0 tool kit.

I DO recommend that you install IIS on your cross compiling machine, as it’s an easy way to move your object files to the MIPS host for linking.

It is worth noting that Visual C++ 4.0’s emulator will NOT run under Virtual PC.. They use the same call set, and it thinks VPC is Windows CE… I know it’s confusing.

I would imagine everyone could run this. Well if they were so inclined.. Well the installation is pretty simple but now for the ‘fun’ stuff.

First let’s download the source code to Quake.. ID software has been most kind to provide the Quake engine under the GPL!. So we can use it for a MIPS cross compile test.. (As far as I know there is no Dec Alpha cross compiler, but there is a PowerPC.. Anyone use a PowerPC NT machine?). You can download it here. .This went nowhere, as it turns out WindowsCE and Windows NT use different models for floating point, and are incompatible.

Ok with your embedded tools installed, we are now going to merge our Visual C++ MIPS CD so we use it for libraries & include files.. Since we are all going to use the same compiler it’ll be somewhat easy.. I’m using the tools out of “C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE400”

11/27/2001. 03:00 AM........ 1,073,152 C1XX_MP.DLL
11/27/2001. 03:00 AM.......... 581,632 C1_MP.DLL
11/27/2001. 03:00 AM........ 1,056,768 C2_MP.DLL
11/27/2001. 03:00 AM........... 69,632 CLMIPS.EXE
06/13/2001. 03:00 AM.......... 180,276 MSPDB60.DLL

To make it “feel” like visual c++ 2.0 I’m going to put them in the c:\msvc20\bin directory on my HOST pc (Vista Pro x64).. Then I simply copy the include & lib directory from the MIPS Visual C++ CD into the corresponding directories on my host.. We are ALMOST there.

The next thing I did was to grab an intel copy of Visual C++ 2.0 (I almost be dammed near all of them can do this..) and take it’s linker.. The linker out of the embedded tools is obsessed with the WindowsCE subsystem which won’t help us at ALL.

09/16/1994. 01:00 PM........... 67,584 DBI.DLL
09/16/1994. 01:00 PM........... 12,980 LINK.ERR
09/16/1994. 01:00 PM.......... 420,352 LINK.EXE

Go ahead and place those files into the c:\msvc20\bin directory.

Now we just need to create a simple batch file to keep our environment in order:

set LIB=c:\msvc20\lib
set PATH=c:\msvc20\bin;%path%
set include=c:\msvc20\include

Save that to something like mipvars.cmd, and run it & we should be ready to start compiling!

To test the cross compiler I’m going to build a SIMPLE program that has 2 files.

hi.c


#include <stdio.h>

extern int bob(void);

void main(void)
{
printf("%d",bob());
}

bob.c

int bob(void)
{
return 3;
}

Ok, now we compile it like so:

C:\msvc20>clmips *.c -o bob.exe
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9419 for MIPS R-Series
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.

bob.c
hi.c
Generating Code...
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

/out:bob.exe
/out:bob.exe
bob.obj
hi.obj
LINK : error LNK1104: cannot open file "corelibc.lib"

Oh no trouble!. Because this was all ripped from the embeded tools it wants to think it has corelibc not libc.. But we can cheat, just copy libc.lib to corelibc.lib and I’ve also copied rpcndr.lib to coredll.lib to satisfy the linker.. Now when we re-compile:

C:\msvc20>clmips *.c -o bob.exe
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9419 for MIPS R-Series
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.

bob.c
hi.c
Generating Code...
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

/out:bob.exe
/out:bob.exe
bob.obj
hi.obj

That’s right, we got an executable!. Now if you run it on your x86(or x64) host you’ll get this:

c:\msvc20\bob.exe is not a valid Win32 application.

And of course, since you installed IIS on your HOST (or cross compiling VM) you can connect to it from your MIPS VM, download the exe & run it.

MIPS cross compile
MIPS cross compile

I’m kind of surprised it worked.. It does go to show though, that somewhere inside Microsoft they have some COOL cross compiler technology, it’s just too bad they didn’t make it into an easy package for the RISC stuff.. But now that the MIPS is coming back to life via Qemu, and NT 4.0 can be had for $5 a retail box on ebay, I figure it’s worth this much for those people who can find Visual C++ for MIPS/RISC.

SoftPC –AT Version 3

Ok, so I’ve been on this MIPS kick as of late.. Me & Antoni just split the cost of Visual C++ 4.0 for the MIPS…  All being well it’ll arrive on Wednesday and we can do some more stuff.  As I understand it, Visual C++ 4.0 was THE compiler for Windows 95 people at the time, and it will have all the controls & stuff that Visual C++ 2.0 simply does NOT have.

Anyways while I was playing with my virtual MIPS machine, I decided to try the MS-DOS emulation out..  I had heard that they had a pretty advanced emulator to run stuff.  So I downloaded a new version of MSD, and was really surprised at the CPU that it was emulating… a 486!  And this is on a MIPS machine, I had to wonder why they couldn’t have continued this for the x64 product…

486!

486!

Anyways ok so it’s a 486, but can it play DOOM?

doom under MIPS NT (1)

Much to my amazement, the answer is YES.  Ok the pallet is all screwed up, and yes it is SLOW.. It reminds me of a 386, but it’s actually running!

Now I was interested, I opened up the ntvdm.exe in notepad to reveal it’s origin:

SoftPC-AT Version 3

(C)Copyright Insignia Solutions Inc. 1987-1992

@(#)sun4_a3cpu.c    1.2 5/24/91 Copyright Insignia Solutions Ltd.

Now what is really interested is this bit.. It only appears in the MIPS binary:

This version is subject to confidentiality provisions and should not be distributed. %s %s%s Copyright %s, an unpublished work by Insignia Solutions Inc.%s %s %s Copyright %s by Insignia Solutions Inc. All rights reserved.

Otherwise there is a LOT of mentions of D:\nt\private\mvdm\softpc.new  I guess it’s about their build process since the DDK is nt\public.

Anyways I thought it was really interesting to see just how involved the NTVDM was on the RISC cpu’s.  I think there is no doubt that the Connectix product was faster, and of course on Ghz+ machines its usable.  Not to mention once Connectix made a native version of Virtual PC for Windows… It’s really not that surprising why Microsoft snatched the product up!

Somewhere around here I have SoftPC 3.0 for the Apple Macintosh… I wonder if it can load doom?

SimpleIRC & ROIDS for the MIPS!

 

Well I’ve been looking for an IRC client for the MIPS and I’ve come up with nothing… And looking for source to much of anything win32 is LONG past something that will compile with Visual C++ 2.0 …

However I did find this simple library built by Andrew Cater: http://www.rohitab.com/discuss/index.php?showtopic=33056

So with very little understanding of how IRC actually works I was able to build a SUPER simple client.  Please note that it’s so simple the / commands that you’ve come to love are not implemented…!  You get one shot for your name/nick/server & channel.. But hey the exe is like 70kb for the MIPS/x64 and 35 for the i386.

sirc and roids MIPS in action

sirc and roids MIPS in action

You can find it’s source & binaries right here.

Also Antoni Sawicki has given me a BUNCH of leads on old public source, and binaries, namely ROIDS the first real graphical game we seem to have now for the MIPS.  The source was a part of a PDTools thing that Dec had put together, however a lot of it will build for both i386 & MIPS. I’ve extracted the source for roids here.

I don’t want to over promise but I’ll see if I can get quake to build some time in the next week.. I don’t know if I can get any graphics out of it, but it’d be fun for a server at least…  Windows NT 4.0 sp1 should have DirectX 2.0 …  The pinball game is quite playable (although the colors are all screwed up, due to a pallet glitch in the emulator) so we shall see.

More fun with Nethack & MIPS NT!

Well a friend of mine pointed out some great archives of OLD Windows NT software..  Checking the list I noticed that there was a port of Nethack to Windows NT, namely Nethack 3.1.2  So using the nethack wiki I got the source code, and converted it to a zip file ( tar & gzip on SFU!)

The build was a little weird as it’s expecting the first compiler tools that shipped with the Win32 SDK “Final release” for Windows NT 3.1  While it may have been ‘easier’ to just install the old SDK, you can just copy cl.exe to mcl.exe & make a dummy ntdll.lib ….

Anyways with a little poking around I got it to build & run!  It’s cool!  Although to be honest I SUCK at nethack.

You can download it here.  It’s lovingly hard coded to use c:\games\nethack … I’m sorry about that, as I’ve given up on having C/D/E drives like a ‘secure’ MIPS machine, and just have a giant (haha!) 2GB system partition.

nethack MIPS

nethack MIPS

It’s also worth noting that it’s easier to try to build stuff on a ‘native’ machine running MSVC 2.0/2.1 then copy the stuff over the the MIPS simulator as it is SLOW.  But then that is to be expected.. It’s too bad the Qemu MIPS simulator cannot idle… as it runs one of my cores @ 100%.

MIPS blast from the past..

WindowsNT 4.0 MIPS

WindowsNT 4.0 MIPS

Personally I’ve never used any MIPS workstations with Windows NT, I’ve been lucky to have used the PowerPC build for IIS (it was cool in that intel hacks wouldn’t work.. It’s too bad it didn’t live long from Microsoft’s end) and of course SQL server on the Dec Alpha.  I also used a Dec Alpha as a workstation (the multia!) at the time I recall it was cool as it could decode MP3’s in realtime!  Sadly my multia died the day Microsoft killed the port.

Anyways while I was searching around hoping the qemu forum had come alive (it is!) I came across this post:

Hello,
I wanted to let you know that I succeeded to run MS Windows NT/MIPS in the Qemu emulator.
As far as I know, Qemu is the first emulator to be able to run Windows NT non i386/x64.
Some screenshots:
http://hpoussineau.free.fr/qemu/arc20081202-nt350-4.png
http://hpoussineau.free.fr/qemu/arc20090315_nt4.png
Code needs to be cleaned up and will be contributed upstream.
Hervé

What is this?  Well click the links!  It is what it sounds like, Hervé got Windows NT running on the MIPS emulation for Qemu!!

I’ve tested a 3.51 workstation CD to no avail… It hangs checking the hard disk.  I also have a 3.1 CD with the win32 sdk & it doesn’t work either.  However 4.0 works fine!  I should also add, this gave me a chance to install Microsoft Visual C++ 2.0 for the MIPS, and to try SQL 4.21 for the MIPS out.

One of the first thing you’ll find out, is that the Dec Alpha was popular non intel machine to run because of FX!32.  This program from Dec, allowed for dynamic translation of 32bit binaries on the Alpha.  So that you could run Office 97 for the i386 on the Alpha.  And on the 2nd run it was effectively a native copy as it had been translated at that point.  Nothing like this existed for the MIPS.  Thus native applications are RARE if any.  Another thing contributing to the lack of MIPS stuff, is that right after sp1 for Windows NT 4.0 came out, a week later all support for the MIPS ended.  Thus there is no internet explorer 3, and any of those resulting projects…  Which is really sad.  I *think* there may still be some copies floating out there for the PowerPC, but it was killed around the time of service pack 3.

Anyways if you want to run this, I did find thru a little digging around the win32 exe is available on Hervé’s site.

Download both of these files:

qemu-system-mips64el

setup.zip

And go ahead and unzip them.  In the setup.zip you will have found a file called NTPROM.RAW, rename it mipsel_bios.bin  .

Now we are ready to go!

Create a 2GB disk like this:

qemu-img create –f qcow2 nt4.disk 2G

Then run the emulator

qemu-system-mips64el.exe -hda nt4.disk  -M magnum -L .  -net nic -net user-cdrom winnt40wks_sp1_en.iso

Your system will initialize and just run thru the quick setup… Keep the display at 800×600 as the mouse will actually work at that resolution!  Also set the date to the correct date, and ensure the MAC address for your Ethernet is not all zeros.  You can make up any address you want.

Then to install NT you have to run 2 programs…

cd:\mips\arcinst

This will install a system partition, and setup the ARC bootloader.  A 5MB partition is all you need, it’ll format it, and just exit arcinst.

cd:\mips\setupldr

This will kick off the install.  It will look & act like every other copy of Windows NT 4.0 that you have installed.  Keep in mind that you will create a ‘d’ partition, and install in there.  I’d recommend you skip the exhaustive disk scan as that seems to always screw up for me.  The install is pretty straight forward, I’d recommend you select an easy password, and you will probably want to setup an automatic logon.

From there you are on your own.  I’ve seen Exchange 4.0 available for the MIPS, and some old versions of SQL Server, SNA Server out there.  I’ve never seen Microsoft Word for NT & Microsoft Excel for NT.  They were 32bit versions released prior to Office 95, and I *THINK* they had i386/mips/powerpc/alpha versions.. But I’m really not that sure.  I think internet explorer 2.0 is the ONLY web browser for the MIPS and no, Windows CE MIPS stuff will NOT run on the MIPS NT.  So don’t be all that disappointed as this isn’t too useful, but it may be interesting to see what all those MIPS directories were all about!