Wolfenstein 3D for DOS/4GW!

After reading about the Blake Stone compile fixes, as it was a Wolf3d port, I came across a post on the forum Wolf3d Haven about trying to find the source code to something called wolf4gw.  Now wolf4gw is a port of the Borland C source of Wolfenstein 3d to Open Watcom C++‘s 32bit MS-DOS extender DOS/4GW, done by ‘ripper’.

The project eventually gave way to wolf4sdl, and as they say the rest is history.

Sadly it seems that just about all the source copies of wolf4gw were lost, except I did manage to find an ‘improved’ version simply refered to as wolf3dx.  From the blurb:

Tricob has released the Wolf4GW-based source code of WolfDX. Included is a text file called (Tricob).TXT.

So I have been using Watcom 10.0 for Duke Nukem 3d, however, this version relies on the _asm inline assembler which was introduced in Watcom 11.  However Watcom 11c had issues with some of the assembly forcing me to go even further to OpenWatcom 1.3.  For me the install was easy, I used CrossOver to install OpenWatcom for DOS-DOS32bit only, copied the compiler into DOSBox, and played mostly with the makefiles, and finally got a working exe!

Screen Shot 2013-07-12 at 11.57.24 AM Screen Shot 2013-07-12 at 11.58.00 AM

I know it may not look like much, but really it is running in 32bit protected mode!

Since all of this is open/freeware/shareware I can redistribute OpenWatcom, the source to wolf3dx, and the shareware levels of Wolfenstein.  Naturally I’m using DOSBox to compile and test, but you can use anything that can run MS-DOS 32bit stuff.

Download my archive here.

Compiling Duke Nukem 3D from source

Well most of it anyways….

I mashed in all you need to build it for MS-DOS under MS-DOS here.

It should be really simple, just run the Watcom C’s setvars, then go into the duke3d\source directory and run ‘wmake’ … All being well it’ll output some exe’s.  I’ve also included the shareware data files so you can test your executables.

Watcom C/C++ 10.0 on DOSBox

Watcom C/C++ 10.0 on DOSBox

Not bad for being under 10Mb, compressed.

It’s been a boring day

My package from Germany finally arrived…!

And it contains Phar Lap 386 versions 4.1 and 5.0!

But something arrived in the mail. So I spent 2 hours cleaning things up and fighting with Watcom getting a skeleton verison of Doom to build. It’s finally running. Now to do some keyboard/video stuff.

Maybe more later though. But I may have to bench them some how Dos4G/W vs Phar Lap 386…. I donno.

Oh my god does watcom suck

The things I see go through my blog… Well someone googled that (blogger.com shows me top hits, on what people search, and how they got here).. and I have to admit it made me laugh.

But my exposure to Watcom really didn’t start until I was in college, and I found some $99 offer to buy Watcom 10.0 CD only package. At the time I thought it was super exciting, because it not only included 32bit tools, but also the 16bit stuff. At the time, I still had a 286 running OS/2 so for me this was awesome!

So for my $99 I got a 32bit MS-DOS,OS/2,Windows NT & Novell Netware compiler, along with a 16bit MS-DOS, Windows & OS/2 compiler.

Ok, so that’s the ‘good’. All the documentation was online, which was ok, but it was in like 30 different files…. The UI was weird, but really in the early 1990s everyones UI was odd. Heh even Microsoft ended up taking over the UI from QuickC for Windows as their ‘professional UI’.

Now what of the Watcom Legacy? Well sure we all know that the iD software guys, used Watcom as their 32bit compile to ship DOOM to the MS-DOS world. Just as 3D Realms used it for Duke Nukem 3d!. But I’d suspect this was mostly because of the DOS4G/W DOS Extender, and it’s royalty free redistribution with Watcom C++. From what I understand Pharlap TNT was *VERY* expensive to license, with regards to it’s royalty price.

Also at the time, Watcom C++ was the fastest compiler available.

But time and competition wasn’t kind to Watcom. Eventually the language company slipped, was purchased for a side product sold off and killed. It’s kind of funny that a language company that produced a SQL server as a necessity ended up being the only product that people sought, and didn’t want to let discontinue.

So sure Watcom C/C++ was a great compiler for it’s time, but the time has passed. In the meantime we are lucky that it’s been open sourced so it hasn’t faded off to oblivion.

Although the C/C++ is what people know them for most, Watcom had a lot more, as seen in their source, they did have support for the Dec Alpha. also did have a Fortran compiler. Back a long long time ago, this Waterloo Ontario based company used to supply computer languages to all kinds of Canadian endeavors. It’s a shame that us kids never got to really see them, but rather it was more so for research as I’m lead to understand.

So really what separated Watcom from say Microsoft? Maybe it was their proximity to research? Maybe government contracts? Perhaps reluctance to enter the operating system business? I don’t know it’s really hard to say, I’m sure it’d make an interesting documentary but I’m afraid the audience would be pretty small.

But then again the Canadian government does like to green light this kind of thing, so maybe someone out there will take it up.

At any rate, I’m sure others may want to chip in on how they feel about Watcom.

I see now that the phrase actually comes from doom

‘!’, // shift-backslash – OH MY GOD DOES WATCOM SUCK

This is in the heads up code, hu_stuff.c

So I guess that ends that eppisode.

OpenWatcom for the DEC Alpha

Someone had contacted me about running some Fortran programs on the DEC Alpha with Windows NT. Now I know that DEC had released some compilers for the Alpha, the Digital Visual Fortran thing which some people still sell for around $600 USD.


But luckily a friend mentioned that I should look at the source code for Open Watcom.

So, I figure for the hell of it, I’ll show how to build a Dec Alpha cross compiler for both C & Fortran. First I’m using Open Watcom 1.8, the current ‘release’ version. You are on your own for older or newer versions.

First install Open Watcom 1.8, with whatever your host is (I’m running on win64, so I’m using the win32 install), and set the target for 32bit NT. We will need the headers so this is the easiest way to ensure your Watcom can make NT exes.

Next you are going to need the file owaxp0401.zip. This is a pre-compiled version of the compiler & libraries for the DEC Alpha. All we need from this is the libaxp directory, which you can just unzip to your Watcom directory.

Now we’ll need to copy some files to satisfy the build process.

C:\WATCOM\binnt>copy wcl386.exe bwcl386.exe
C:\WATCOM\binnt>copy wlib.exe bwlib.exe
C:\WATCOM\binnt>copy wrc.exe bwrc.exe

Ok, now with that out of the way, run c:\watcom\owsetenv.bat to setup your environment, and now let’s extract the source to 1.8. I’m just going to use c:\temp as a place to put it. Also you will have to edit the setvars.bat file, and change the following:

set OWROOT=c:\temp\ow18src
set WATCOM=c:\watcom

Now I suppose you could save this into a batch file, and kick that off, and this will build the needed libraries, then the C compiler.

cd c:\temp\OW18src\bld\builder\nt386
cd c:\temp\ow18src\bld\dwarf\dw\osi386\
cd c:\temp\OW18src\bld\yacc\nt386
copy yacc.exe \WATCOM\binnt\byacc.exe
cd c:\temp\OW18src\bld\re2c\nt386
copy re2c.exe \WATCOM\binnt\re2c.exe
cd c:\temp\ow18src\bld\cg\risc\axp\nt386\
cd c:\temp\ow18src\bld\sdk\rc\wres\flat386\mf_r
cd c:\temp\ow18src\bld\cfloat\osi386
cd c:\temp\ow18src\bld\as\alpha\inline\osi386\
cd c:\temp\ow18src\bld\owl\osi386\

Now this will build the cross compiler…

cd c:\temp\OW18src\bld\cc\wcl\nt386.axp
copy wclaxp.exe \WATCOM\binnt
cd c:\temp\OW18src\bld\cc\nt386.axp
copy wccaxpc.exe \WATCOM\binnt\wccaxp.exe
copy wccdaxpc.dll \WATCOM\binnt\wccdaxp.dll
cd c:\temp\OW18src\bld\as\alpha\nt386
copy wasaxp.exe \WATCOM\binnt

Now for the Fortran 77 compiler. Please note that the default flags include -we which will cause the compiler to error if there is a warning. And as luck would have it, one function doesn’t declare a prototype… So you can either remove the -we flat from the mif file, or fix the c file… The choice is yours.

cd c:\temp\OW18src\bld\f77\wfl\nt386.axp
copy wflaxp.exe \WATCOM\binnt
cd c:\temp\OW18src\bld\f77\wfc\nt386.axp
copy wfcaxp.exe \WATCOM\binnt
attrib c:\temp\OW18src\bld\f77\f77lib\flags.mif -r
notepad c:\temp\OW18src\bld\f77\f77lib\flags.mif

Do a search and replace on -we and replace it with nothing…

cd c:\temp\OW18src\bld\f77\f77lib\winnt.axp\_s
copy flib.lib \WATCOM\libaxp

With all that out of the way, let’s build some test programs…

Let’s start with hello.f for the Fortran compiler.

program hello
print *, ‘Hello!’

c:\temp>wflaxp hello.f
Open Watcom F77 Alpha AXP Compile and Link Utility Version 1.8
Portions Copyright (c) 1990-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wfcaxp hello.f
Open Watcom FORTRAN 77 Alpha AXP Optimizing Compiler Version 1.8
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
hello.f: 3 statements, 40 bytes, 1 extensions, 0 warnings, 0 errors

Open Watcom Linker Version 1.8
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating a Windows NT(AXP) character-mode executable


Watcom Fortran cross on Dec Alpha

Watcom Fortran cross on Dec Alpha

Ok, now that’s enough for now…! Later I’ll show how to build these compilers so they’ll run on the Dec Alpha.

Minor SIMH fun

Well I updated the packages for SIMH last night, and I’ve included the win32s stuff and MS-DOS builds. This ought to allow some old schoole to have some fun!

The packages should be visable from here: https://sourceforge.net/project/showfiles.php?group_id=154308&package_id=244756

I have also decided that the MS-DOS version (being the lowest common denominator) should include some kind of ‘sampler’ of OS’s so that you can see right out of the gate what simh is capable of. Naturally you can download the MS-DOS version, and simply replace the exe’s with stuff for windows/win32s/linux etc..

SIMH 3.8-0 for MS-DOS

This is a quick survey of SIMH 3.8-0 for MS-DOS. I’ve built these exe’s with Watcom C++ 11.0a.

You can break out of any of the simulators by pressing CONTROL+E.

All of the EXE’s are for the MS-DOS environment, and I’ve built them with DOS/4GW in mind. I will have to say that an initial test shows that running this stuff under a DPMI server like Windows or OS/2 provides better performance then native switching.. It could be my PC, however I’d recommend anyone who uses these EXE’s to try them natively and under Windows 3.1 at a minimum.. Because all of the MS-DOS nature of these programs, no disk files can be over 2 gigabytes. I don’t know if that’ll be an issue but of course you can have multiple files/partitions as I recall MS-DOS 5 having a 2 gigabyte file/partition size limit..

For anyone running this natively I have included only one copy of dos4gw.exe in the root of the zip.

1. Altair
2. Altair Z80
3. The HP2100
4. The Interdata 32b
5. The Nova
6. The PDP-11
7. The PDP-8
8. The MicroVAX II
9. The VAX 11/780

1. Altair 8800

This is the Altair 8800 emulator with both AltairDOS and CP/M 2.2

Both CP/M and Altair DOS are from the file ceoaltair.zip


C:\simh\altair\work>altair.exe altdos.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Altair 8800 simulator V3.8-0


——8<------8<------8<------8<------8<------8< cpm.bat ——8<------8<------8<------8<------8<------8<
C:\simh\altair\work>altair.exe cpm22.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Altair 8800 simulator V3.8-0
62K CP/M VERSION 2.2 (ALTAIR 8800)
Simulation stopped, PC: 172052 (JNC 172047)
sim> q
——8<------8<------8<------8<------8<------8< ============================
2. The Altair 8800 z80 emulator.

This is more full featured then the other Altair emulator, and I’ve found the z80 to have more
software available. I’ve included the CP/M 2.2 that I found cpm2.zip


C:\simh\altairz8\work>altairz8.exe cpm2.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Altair 8800 (Z80) simulator V3.8-0

64K CP/M Version 2.2 (SIMH ALTAIR 8800, BIOS V1.25, 2 HD, 15-Jan-07)

Simulation stopped, PC: 0F3FA (RRA)
sim> q
——8<------8<------8<------8<------8<------8< ============================
3. The HP2100 emulator.

I really don’t know much about this machine, but I included a way to run the basic1 program I
found online. It kind of reminds me of the ROMBASIC back ‘in the day’… It’s basic with line
numbers so I know it’s kind of old.. I really don’t know much otherwise about this machine.


C:\simh\hp2100\work>hp2100.exe basic1.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

HP 2100 simulator V3.8-0


Simulation stopped, P: 17436 (JMP 17435)
sim> q
4. The Interdata 32b emulator


Both of these unix’s were taken from the files iu6swre.zip and iu7swre.zip respectively.

This is research Unix v6 ported to the Interdata. I set the batch file to tell you how to
bootstrap the system, as it doesn’t just ‘turn on’.. Otherwise it should be comparable to Unix v6 on the PDP-11 or any other v6. This should be the first port of Unix outside of Western Electric. There is no halt/reboot/init 0, so I just sync the disk a few times, and then interrupt the emulator and quit.

C:\simh\id32\unix6>id32.exe v6.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Interdata 32b simulator V3.8-0
at the ? prompt type in:
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Interdata 32b simulator V3.8-0
v6.ini> d lfc tps 100
Read only argument
Memory = 182.50 K

login: root
You have mail.
# sync
# sync
# sync
Simulation stopped, PC: 2EB5C (EPSR R1,R0)
sim> q

This pretty much follows in the steps of the Unix v6 above. This is the research version of UNIX v7.

At the : prompt type in
ECHO is off.
Then at the # prompt hit CONTROL+D
the root password is root
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

Interdata 32b simulator V3.8-0

: dsk(1,0)unix
Memory = 248.0 K
# Restricted rights: Use, duplication, or disclosure is subject
to restrictions stated in your contracts with Western Electric
Company, Inc. and the University of Wollongong.
Fri Jan 2 18:15:04 EST 1970

login: root
# sync
# sync
# sync
Simulation stopped, PC: 00D20 (EPSR R1,R0)
sim> q
——8<------8<------8<------8<------8<------8< ============================
5. The Nova emulator


This is RDOS V7.50, which I honestly don’t know anything about… I retrieved this OS from the archive rdosswre.tgz .


C:\simh\nova\work>nova.exe rdos.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

NOVA simulator V3.8-0


NOVA RDOS Rev 7.50
Date (m/d/y) ? 10/31/77
Time (h:m:s) ? 10:10:00

6. The PDP-11 Emulator


This is the Unix v1 restoration project’s latest disk image, that I have retrieved from
Being one of the first versions of Unix it’s super primitive, however I thought it was interesting to include in this SIMH sampler to see just how far UNIX has progressed, and just how much is the same.


C:\simh\pdp11\unixv1>pdp11 simh.cfg
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

PDP-11 simulator V3.8-0
Disabling CR
Disabling XQ
RF: buffering file in memory
TC0: 16b format, buffering file in memory
simh.cfg> att dci 5555
File open error

:login: root
Simulation stopped, PC: 007332 (MOV (SP)+,25244)
sim> q
RF: writing buffer to file
7. The PDP-8 Emulator


This is the PDP-8 emulator with OS8. I really don’t know anything about this other then the
‘list’ command… I retrieved this from the file os8swre.tgz .


C:\simh\pdp8\work>pdp8 os8.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

PDP-8 simulator V3.8-0
RX: buffering file in memory

8. The MicroVAX II Emulator


This is the MicroVAX II emulator with a miniroot of Quasijarus 0c. It’s not exactly fully functional in this state, but it’s enough to exercise the emulator, and boot up from disk.
I’ve configured the NVram so it will just boot up by default. I have left the installation tape image as quas.tap. Please note that this is *NOT* enough for a full install, this is just a demo to check that your system works.


C:\simh\vax\quas>vax.exe quas.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

VAX simulator V3.8-0
NVR: buffering file in memory
Loading boot code from ka655x.bin

KA655-B V5.3, VMB 2.7
Performing normal system tests.
Tests completed.
Loading system software.


loading boot

: /vmunix
326312+104440+130352 start 0x23b8
4.3 BSD Quasijarus UNIX #3: Sat Feb 14 20:31:03 PST 2004
[email protected]:/nbsd/usr/src/sys/GENERIC
real mem = 33521664
SYSPTSIZE limits number of buffers to 80
avail mem = 31697920
using 80 buffers containing 655360 bytes of memory
MicroVAX 3000, ucode rev 6
uda0 at uba0 csr 172150 vec 774, ipl 15
uda0: version 3 model 3
uda0: DMA burst size set to 4
ra0 at uda0 slave 0: ra81, size = 891072 sectors
dz0 at uba0 csr 160100 vec 300, ipl 15
dz1 at uba0 csr 160110 vec 310, ipl 15
dz2 at uba0 csr 160120 vec 320, ipl 15
dz3 at uba0 csr 160130 vec 330, ipl 15
Changing root device to ra0a
Automatic reboot in progress…
Tue Feb 3 17:52:10 PST 2004
Can’t open checklist file: /etc/fstab
Automatic reboot failed… help!
erase ^?, kill ^U, intr ^C
# sync
# sync
# sync
Simulation stopped, PC: 800029AF (BNEQ 800029C6)
NVR: writing buffer to file
9. The VAX 11/780 Emulator


The VAX 11/780 is a bit weird in that it cannot run it’s vmb.exe directly, unlike how the
MicrovaxII can run its ROM. I’ve been using extracted boot code to get the 11/780 to run. Again because I’m more familiar with Unix, I chose to include BSD 4.2’s miniroot to test functionality. This is really only suitable for testing the emulator out. I extracted the file bootra from the source code, and I took the miniroot file from the tape.


C:\simh\vax780\work>vax780.exe bsd42.ini
DOS/4GW Protected Mode Run-time Version 1.97
Copyright (c) Rational Systems, Inc. 1990-1994

VAX780 simulator V3.8-0
loading ra(0,0)boot
: ra(0,0)vmunix
4.2 BSD UNIX #9: Wed Nov 2 16:00:29 PST 1983
real mem = 8384512
avail mem = 7073792
using 102 buffers containing 835584 bytes of memory
mcr0 at tr1
mcr1 at tr2
uba0 at tr3
hk0 at uba0 csr 177440 vec 210, ipl 15
rk0 at hk0 slave 0
rk1 at hk0 slave 1
uda0 at uba0 csr 172150 vec 774, ipl 15
ra0 at uda0 slave 0
ra1 at uda0 slave 1
zs0 at uba0 csr 172520 vec 224, ipl 15
ts0 at zs0 slave 0
dz0 at uba0 csr 160100 vec 300, ipl 15
dz1 at uba0 csr 160110 vec 310, ipl 15
dz2 at uba0 csr 160120 vec 320, ipl 15
dz3 at uba0 csr 160130 vec 330, ipl 15
root on ra0
WARNING: should run interleaved swap with >= 2Mb
erase ^?, kill ^U, intr ^C
# sync
# sync
# sync
Simulation stopped, PC: 8000162E (BRB 80001620)
——8<------8<------8<------8<------8<------8< The entire source is in the ‘source’ directory with projects for all of the SIMH material.
There are a few emulators that *WILL NOT BUILD* for MS-DOS because of a lack of 64bit integers. I suppose if there is any call for the missing emulators with the DJGPP compiler, assuming that it contains 64bit integer support. It’s completely unverified on my part. I’ve also done some preliminary work on networking with packet network drivers, however I am experiencing some weird timeouts. It’s hard to track down at the moment, but I’ll keep plugging away.

I don’t think there is any reason why you would not be able to use OpenWATCOM to build these files.

Fun with Win32s!

Well I planned on doing an update, but I didn’t get around to it. I’ll post my fun thru dec alpha fun later.
In the meantime, I was combing ebay, and I saw a cheap copy of Watcom C++ version 11. Now back in college I had 10.0, and it was AWESOME! It does 16bit & 32bit development of OS/2 MS-DOS and even Windows… For some reason the guy who sold the Watcom 11 included some techsupport thing he had going on, and included a tidbit about their being a ‘Default-windows application [-bw]’ (it’s on page 7 of C compiler settings) and it’s like the old Borland C++ for windows, or QuickC for windows days… It’s too bad I never knew it was there, as it allows for easy text mode stuff to win32 enviroments like … Win32s.
Now Win32s was one of those funny things, in which some smart people noticed that for the most part the ‘core’ of Win32 was a superset of Win16, and all they needed to do was hook the program loader, load the win32 exe into a relocatable space, then thunk all the win32 calls into win16 calls allowing a bunch of win32 applications to run on Windows 3.1! This was somewhat popular as most peoples machines at the time were not powerfull enough to run Windows NT 3.1, or they simply wished not to. And Windows 95 was going to be nearly another 2 years away…
Anyways, I’ve always thought SIMH was cool in that it’s super portable, so spending 20 minutes clearing out the ‘win32 console’ specific stuff from the code, I was able to build up a version that not only runs on Win32s on Windows 3.1, but also supports the TCP/IP remote console.
Here is a screen shot of my Windows 3.1 running under Virtual PC, telnetted to itself running the simh microvax running VMS 4.7

A Win32s VAX!

Anyways it’s too little too late, but I think it’s still cool. The neat thing about this is since it’ll run on Win32s is that it’ll run on dammed near any emulator as it’ll conform to such a subset.. Or so I’m hoping. I imagine it should also run under OS/2 3.0’s win32s emulation as well… And yes I’ve tested it with Win32s 1.25a that’s before Microsoft ‘fixed’ it to break all the OS/2 users out there…