Notebook: Compiling SIMH 39-0 PDP-11 
and VAX under MSVCPP 4.0 for ALPHA
Windows NT 4.0 SP6 AXP is actually usable: at least I've been doing so for the past 6 hours. 

0) Introduction
This project was born after my desire to repurpose my Digital PWS 500a as a fully-functional computer. Now, the problem with Windows for ALPHA is that software is rather scarce, and while it's technically astounding, the FX!32 x86-to-AXP binary translation system does not allow for full performance. After realizing that some SIMH simulators, like PDP11 and VAX would fail miserably, I thought the only way would be to compile them myself. 
First problem: the only fully working compiler available seems to be MSVCPP 4.0, as the only build on the network of MSVCPP 6.0 is pretty crippled, even if I was able to take advantage of it.
First of all, I'd love to say that this procedure is a trial-and-error 5-hour experiment, and it led me (without prior experience with compilers and unable to write C code) to a better understanding of what it takes to compile a program. This procedure is likely not what the awesome and skilled guys behind SIMH would have pulled out, but it somewhat works. Assuming you are using the directory structure I made up, this is it: feel free to roast me if I made major mistakes.

1) Setting up the build environment
First, open up MSVCPP 4.0 and do File > New > Project Workspace > Console Application, then make up a name for your workspace. This will tell the IDE to set up a suitable environment to build our simulators. 
The second step will be configuring the environment: do Build > Settings... to open the Project Settings form. This step is crucial, as it's like the makefile for the Microsoft compiler and linker. Now make sure both entries in the left panel are highlighted: these are the Debug and Release build options. While Debug is faster and more verbose, Release actually uses some optimization, so the final executable will be faster. Hopefully.
After that, we will need to change some options: go to the C/C++ tab and select Preprocessor from the drop-down menu. Here we will need to add "VM_PDP11" (without brackets) to the Preprocessor definitions form: this value will be passed down to the headers (the .h files), which parse Preprocessor Definitions through the ifdef construct. This way, the files will know we are building the PDP11 simulator. This step is crucial: if you don't do this, you will have to manually crawl through finely-crafted .h files to trim out all of the ifdefs, like I did, rendering headers barely functional and wasting your time.
There is one more thing to do in this tab: adding include folders. To tell MSVCPP where he can potentially find the headers needed to compile our stuff, we'll need to write a list of directories containing our headers (the .h files containing ifdefs) into the Additional include directories form. Each folder is separated from the other with a comma, and I laid them out as following (you'll need to make adjustments if you use another path and/or folder structure):
"D:\simh-win32\simhv39-0, D:\simh-win32\simhv39-0\PDP11, D:\simh-win32\simhv39-0\PDP10, D:\simh-win32\simhv39-0\VAX, D:\simh-win32\windows-build\VC98\INCLUDE" (without brackets)
The first entry is the main SIMH folder, which contains headers for the "common" part of all simulators. The PDP11, PDP10 and VAX folders contain specific files for the PDP11 simulator (PDP11, PDP10 and VAX peripheral code is shared) and the VC98\INCLUDE folder contains fresh new headers straight off the 6.0 CD, including winsock2.h, a networking-related header file needed by SIMH.
Least but not last, we need to add some Static Libraries to the Linker. Go to the Link tab and add " wsock32.lib winmm.lib" (without brackets) to the [Object/library modules] form, as explained in the SIMH v39-0 user manual.
Say [OK] to the little window and move on to the next part.

2) Importing files
Without the source files, we are not going any farther. To import the sources, let's Import > Files into Project... From the drop-down menu choose Source files (*.c, *.cpp, *.cxx) and select all from the PDP11 directory, but leave txt2cbn.c. Repeat the same process for the main SIMH directory. Johnny will calculate dependencies automatically, but we can do this again manually by doing Build > Update all Dependencies. Johnny will complain about some headers, but we can safely ignore the specific messages reported here (your paths may vary), as they are likely related to the disabled USE_NETWORK build option. If you get different entries, like some files from the PDP11 directory, you need to recheck your Additional include directories paths.

D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_console.c(549): Could not find the file descrip.h
D:\simh-win32\simhv39-0\sim_console.c(550): Could not find the file ttdef.h
D:\simh-win32\simhv39-0\sim_console.c(551): Could not find the file tt2def.h
D:\simh-win32\simhv39-0\sim_console.c(552): Could not find the file iodef.h
D:\simh-win32\simhv39-0\sim_console.c(553): Could not find the file ssdef.h
D:\simh-win32\simhv39-0\sim_console.c(554): Could not find the file starlet.h
D:\simh-win32\simhv39-0\sim_console.c(555): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_console.c(859): Could not find the file console.h
D:\simh-win32\simhv39-0\sim_console.c(860): Could not find the file Mactypes.h
D:\simh-win32\simhv39-0\sim_console.c(862): Could not find the file sioux.h
D:\simh-win32\simhv39-0\sim_console.c(863): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_console.c(864): Could not find the file siouxglobals.h
D:\simh-win32\simhv39-0\sim_console.c(865): Could not find the file Traps.h
D:\simh-win32\simhv39-0\sim_console.c(866): Could not find the file LowMem.h
D:\simh-win32\simhv39-0\sim_console.c(1034): Could not find the file sgtty.h
D:\simh-win32\simhv39-0\sim_console.c(1036): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_console.c(1127): Could not find the file termios.h
D:\simh-win32\simhv39-0\sim_console.c(1128): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_ether.c(797): Could not find the file sys/ioctl.h
D:\simh-win32\simhv39-0\sim_ether.c(798): Could not find the file net/bpf.h
D:\simh-win32\simhv39-0\sim_ether.c(801): Could not find the file pcap.h
D:\simh-win32\simhv39-0\sim_ether.c(806): Could not find the file sys/ioctl.h
D:\simh-win32\simhv39-0\sim_ether.c(807): Could not find the file net/if.h
D:\simh-win32\simhv39-0\sim_ether.c(808): Could not find the file linux/if_tun.h
D:\simh-win32\simhv39-0\sim_ether.c(811): Could not find the file net/if_types.h
D:\simh-win32\simhv39-0\sim_ether.c(812): Could not find the file net/if.h
D:\simh-win32\simhv39-0\sim_ether.c(819): Could not find the file libvdeplug.h
D:\simh-win32\simhv39-0\sim_ether.c(828): Could not find the file dlfcn.h
D:\simh-win32\simhv39-0\sim_ether.c(1223): Could not find the file descrip.h
D:\simh-win32\simhv39-0\sim_ether.c(1224): Could not find the file iodef.h
D:\simh-win32\simhv39-0\sim_ether.c(1225): Could not find the file ssdef.h
D:\simh-win32\simhv39-0\sim_ether.c(1226): Could not find the file starlet.h
D:\simh-win32\simhv39-0\sim_ether.c(1228): Could not find the file stsdef.h
D:\simh-win32\simhv39-0\sim_ether.c(1229): Could not find the file nmadef.h
D:\simh-win32\simhv39-0\sim_ether.c(1379): Could not find the file pthread.h
D:\simh-win32\simhv39-0\sim_ether.h(130): Could not find the file pthread.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_timer.c(87): Could not find the file starlet.h
D:\simh-win32\simhv39-0\sim_timer.c(88): Could not find the file lib$routines.h
D:\simh-win32\simhv39-0\sim_timer.c(89): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_timer.c(231): Could not find the file Timer.h
D:\simh-win32\simhv39-0\sim_timer.c(232): Could not find the file Mactypes.h
D:\simh-win32\simhv39-0\sim_timer.c(233): Could not find the file sioux.h
D:\simh-win32\simhv39-0\sim_timer.c(234): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_timer.c(235): Could not find the file siouxglobals.h
D:\simh-win32\simhv39-0\sim_timer.c(280): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_timer.c(281): Could not find the file unistd.h
D:\simh-win32\simhv39-0\scp.c(194): Could not find the file dlfcn.h
D:\simh-win32\simhv39-0\sim_ether.h(130): Could not find the file pthread.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_sock.h(58): Could not find the file sys/socket.h
D:\simh-win32\simhv39-0\sim_sock.h(60): Could not find the file unistd.h
D:\simh-win32\simhv39-0\sim_sock.h(61): Could not find the file netinet/in.h
D:\simh-win32\simhv39-0\sim_sock.h(62): Could not find the file netdb.h
D:\simh-win32\simhv39-0\sim_sock.h(63): Could not find the file sys/time.h
D:\simh-win32\simhv39-0\sim_sock.h(67): Could not find the file ioctl.h
D:\simh-win32\simhv39-0\sim_ether.h(130): Could not find the file pthread.h  

3) Compiling SIMH/PDP-11
If you safely got to this point, congratulations! It took forever for me to get a working environment, hope everything is clear. Hit the Build > Build %app_name_here%.exe, where %app_name_here% is the name you gave Johnny at the beginning of Step 1. Wait patiently and ignore warnings about type conversion and potential loss of data: I trust the folks who made SIMH. Test your Debug executable and if that works, go on and build the release one by changing the drop-down menu option from %app_name_here% - Win32 (ALPHA) Debug to %app_name_here% - Win32 (ALPHA) Release, and enjoy your simulator.

4) Additional steps: compiling SIMH/VAX
First, backup your workspace, which will be in the folder you specified at the beginning of Step 1. If the folder reports Access Violation, close the project and try again. Then start by removing some files we are not going to need anymore from the workspace: in the left toolbar click on the little piece of paper: this will bring you from Class View tab to File View tab. Click on the little [+] button left of %app_name_here% files, and remove all PDP11 files (hit the DEL button!) but the following (it might be faster to remove them all and re-import these), leaving the core SIMH files be:
pdp11_cr.c
pdp11_dz.c
pdp11_io_lib.c
pdp11_lp.c
pdp11_pt.c
pdp11_rl.c
pdp11_rq.c
pdp11_ry.c
pdp11_tq.c
pdp11_ts.c
pdp11_vh.c
pdp11_xq.c
Now do Insert > Files into project... and select all vax_*.c files from VAX directory (do not import ones named vax780_*.c, as the VAX780 is another simulator entirely), and rebuild dependencies.
Now go on and try to build your VAX simulator! If all went good, there should be no problems.

4) Epilogue
Hopefully, by now you have a working SIMH build and some knowledge that will help you building other simulators, and maybe other software too. I hope to be able to create a small website on which we can share software and knowledge. In the meantime, if you found this guide good, bad, terrible, usable or not, please contact me.
Special thanks to: Gianni BBK, WinWorldPC, the VCFED forums, vpsland.superglobalmegacorp.com

Jacopo Maltagliati - mltjpc64@gmail.com - Friday, 28 July, 2017