Zork on the Mainframe?

Ok, I know this title 99% of the time is a ‘oh whatever’ as most people seem to have confused mini’s with mainframes… PDP-10’s, PDP-11’s, VAX’s (even the massive 11/780), were all minicomputers…

But I came across this post, which just mentions in passing that there was a port of dungeon (zork) to the IBM Mainframe…

And rescued via the internet archive, is Melinda Varian’s home page, which includes…. Dungeon in VMARC format…

The sad thing is that I can barely remember logging on to TSO, using ISPF, and getting out… I was so bad with the system that I’d use an empty file as a template, as copying files was easy, but creating a file on the host took me a whole day.

I vaguely recall using this IND$ thing to transfer files, but I don’t know what you need exactly to facilitate it…

So I’ve downloaded hercules/380 along with the VM370 SixPack and… remembered that I don’t… remember much, let alone enough to actually operate VM/370.

I tried passing VMARC files through PC ARC, and got.. nothing, I even manually byteswapped the files to get nothing.

Oh well I’m at an impass, but maybe some mainframe dude will see this one day, and take a peek.

Oh it’s the end of 2010, welcome to 2011.

—-edit
I got it to run on VM/370 CMS.

Line is not an emulator

I don’t know how I didn’t find this earlier, and how it’s been overlooked for so long….

But this incredible program, LINE, will run statically linked Linux ELF binaries on Windows.

Yes, you read that right, this user mode program will load an ELF exe, and run it under a software debugger with no need for device drivers, and intercept all the sycalls (ie int 0x80’s) through the cygwin1.dll, giving you a POSX/Command line linux experience.

It does come bundled with various hello programs, and a few things on testing forks… But the real magic for me was being able to grab a static version of dungeon, and running it on both Windows 7 x64, and emulated NT 4.0.

And it works!

Line running Dungeon

I’ve put my copy of dungeon, along with a copy of cygwin1.dll that works with the LINE package here for anyone interested.

I’m just amazed at the size, and simplicity of the whole thing…..

In the documentation there is even mentions of NSO (Native shared objects?), and dynamic linking…

Clearly this project should have had more of a future to it!

Quake1 & MS-DOS

And because I had a request for it, here is a 7zip containing a makefile, and source suitable for building quake under MS-DOS.

I sourced it from the Doom makefile, and cross built it under OS X… It builds in under 5 seconds using all 4 cpu’s on my OS X box with my OS X to MSDOS DJGPP cross compiler…. I had forgotten that the gpl’d source included MS-DOS support.. I had taken the video part from Chi Hoang’s DOS port of DOOM and gotten it to run until I remembered.. Oh well a few hours wasted.

So there it is, Quake1 built on a mac, and running on DOSBox on a PC.....

And speaking of Quake, it’s on sale too!

But just for today, on steam…..

Cross compiling for MS-DOS (DJGPP) from OS X

So building on DOOM, I thought I’d try to build a djgpp cross compiler from my main OS X box, as compiling under DOSBox is… just too slow. Luckily Delorie has a page on building a cross compiler.

I started out with binutils-2.9.1, just as he does, with a few things thrown in…

First I had to run configure like this, as OS X didn’t exist back then, let alone x64 cpu’s..
./configure --target=i586-pc-msdosdjgpp --host=i386-netbsd --prefix=/usr/local/djgpp
Next the following error is thrown…

strerror.c:463: error: conflicting type qualifiers for ‘sys_nerr’

So I just edited libiberty/strerror.c, and commented out the following line.

Next up was a strange error in gas/targ-cpu.h

targ-cpu.h:374: error: array type has incomplete element type
targ-cpu.h:378: error: previous declaration of ‘flag_16bit_code’ was here

I simply commented out the lines.

Then later while compiling gas/write.c it bombs out because of an undefined type.. One of which was commented out in targ-cpu.h . The easiest fix is to go to the start of the relax_align procedure and just add in the definition:

extern const struct relax_type md_relax_table[];

Next up was gcc. I couldn’t get 2.8.1 to build, instead I built gcc-2.95.3.

I had to configure gcc like this:
./configure --target=i586-pc-msdosdjgpp --host=i386-netbsd --prefix=/usr/local/djgpp
And it threw the same error as binutils… with the same fix (commenting out the line in libiberty/strerror.c).

strerror.c:465: error: conflicting type qualifiers for ‘sys_nerr’

I also had an error pop up like this:

./config/i386/i386.c:142:22: error: macro “strcat” requires 2 arguments

And again I just commented it out.

Under OSX the makeinfo parts crashed, so I simply removed them from the makefile. With a little more tweaking the cross compiler was ready!

REMEMBER TO FOLLOW DJ’s steps too!

The cool thing is that now I can run make with the -j4 flags allowing gcc to run on each of the cpu cores letting me build doom in under 3 seconds!

i586-pc-msdosdjgpp-gcc -O2 -DNORMALUNIX dos/doomdef.o dos/doomstat.o dos/dstrings.o dos/i_system.o dos/i_sound.o dos/i_video.o dos/i_net.o dos/tables.o dos/f_finale.o dos/f_wipe.o dos/d_main.o dos/d_net.o dos/d_items.o dos/g_game.o dos/m_menu.o dos/m_misc.o dos/m_argv.o dos/m_bbox.o dos/m_fixed.o dos/m_swap.o dos/m_cheat.o dos/m_random.o dos/am_map.o dos/p_ceilng.o dos/p_doors.o dos/p_enemy.o dos/p_floor.o dos/p_inter.o dos/p_lights.o dos/p_map.o dos/p_maputl.o dos/p_plats.o dos/p_pspr.o dos/p_setup.o dos/p_sight.o dos/p_spec.o dos/p_switch.o dos/p_mobj.o dos/p_telept.o dos/p_tick.o dos/p_saveg.o dos/p_user.o dos/r_bsp.o dos/r_data.o dos/r_draw.o dos/r_main.o dos/r_plane.o dos/r_segs.o dos/r_sky.o dos/r_things.o dos/w_wad.o dos/wi_stuff.o dos/v_video.o dos/st_lib.o dos/st_stuff.o dos/hu_stuff.o dos/hu_lib.o dos/s_sound.o dos/z_zone.o dos/info.o dos/sounds.o dos/i_main.o \
-o dos/dosdoom

real 0m1.174s
user 0m2.626s
sys 0m0.679s

How’s that for fast?

For any curious OS X 64bit users out there you can download my binary toolchain here.

I would imagine that if you stuck with versions of binutils & gcc that build on your platform you too should be able to build a MS-DOS DJGPP cross compiler. And there is nothing like native 64bit tools for building for DOSBox… Oh and DOOM runs just fine, although I guess screen shots of the cross compiled exe is… redundant.

Doom for MS-DOS

Today while checking out eets on steam ( yeah I know… ) I came across this sale… It’s Doom, Doom II, and Doom III all together, with all the expansion sets for $8.74 USD!

Well needless to say I couldn’t resist the offer, so I bought it. While playing around with Doom, I was wondering what was the first port of the Linux X11 doom back to MS-DOS. A bit of googling brought me to the doom wiki, and from there it seems that “DOSDoom” version is the first source port returning DOOM back to MS-DOS.

As mentioned in Chi Hoang’s notes, it took him 4-5 hours to do the initial port. So I figured it’d be worth re-creating the 0.1 version of his work, under DOSBOX with DJGPP.

I did find out the hard way that there is a single assembly clause that breaks under newer versions of DJGPP, and there is a small issue with the HOME environment variable that if it’s not set it’ll crash DOOM. So I ‘fixed’ that to use the current directory.

To install this legacy version of DJGPP, I found the needed files..

*bnu27b.zip
*csdpmi7b.zip
*djdev201.zip
*gcc2721b.zip
*gdb418b.zip
*mak3791b.zip
*pat253b.zip

Simply unzip all of this into a directory that your DOSBox mounts, and alter your dosbox.conf something like this:

[autoexec]
# Lines in this section will be run at startup.

mount c c:\dos
c:
set PATH=C:\DJGPP\BIN;z:\
set DJGPP=C:\DJGPP\DJGPP.ENV

Then you should be able to extract the doom source that I’ve patched up, and run make to re-build the exe. I’ve included a shareware wad file that won’t explode on missing demos…

So the end result is the following:

DOSDoom 0.1

DOSDoom 0.1

Which… has no networking support, no audio, but it does work! This port is overall minimally invasive to the code, and I’d suspect it’d make it a very easy starting point for yet even more ports of doom… I think there is over 40 out there.

That’s the one great thing about making the source available, is that the product lives on and on!

Installing mediawiki on WAMP

Building on our WAMP installation, we are now going to install mediawiki.

The first thing I’d recommend to do is to move the contents of c:\wamp\www into another directory… I just shoved the terminal thing into c:\wamp\terminal .

Now mediawiki is the software that powers wikipedia. It’s a great collaboration platform, it has built in revision control, and best of all it’s free.

It’s also VERY simple to setup, well compared to other web content platforms.

The current version is 1.16, which can be downloaded here. As things change, you may be best served by just visiting the main download site.

Since most ‘AMP’ servers are Linux based, we’ll have to get gzip & tar to extract mediawiki. It’s very easy though.

Simply type this in to extract mediawiki

C:\temp>dir
Volume in drive C has no label.
Volume Serial Number is FC55-C2F4

Directory of C:\temp

12/28/2010 08:15 PM DIR .
12/28/2010 08:15 PM DIR ..
12/28/2010 08:13 PM 49,152 gzip.exe
112/28/2010 08:15 PM 12,647,934 mediawiki-1.16.0.tar.gz
12/28/2010 08:13 PM 114,688 tar.exe
3 File(s) 12,811,774 bytes
2 Dir(s) 7,073,234,944 bytes free

C:\temp>gzip -dc mediawiki-1.16.0.tar.gz| tar -xf –

C:\temp>

Ok, now with mediawiki extracted we just move the contents of c:\temp\mediawiki-1.16.0 into c:\wamp\www

Now before we go on, we are going to set a password for the MySQL process. In the off chance someone is following this on a server to deploy on the internet, it’d be crazy to leave it with no password.

So left click on the WAMP system tray icon, go to MySQL, and bring up the MySQL Console.

media1

Just hit enter for the password as there isn’t one.

Next follow this SQL statement to set the password for the root user to password. Or select your own better password.

mysql> use mysql;
Database changed
mysql> update user set password=PASSWORD(“password”) where User=’root’;
Query OK, 3 rows affected (0.05 sec)
Rows matched: 3 Changed: 3 Warnings: 0

Now restart the mysql service, by clicking on the system tray icon, then mysql, service then ‘restart service’. If you don’t do this the password change will not take effect!

With that out of the way, it’s time to configure mediawiki. Simply open up a web browser to the following location:

http://localhost

And you should see something like this:

media2

Click the setup link, and let’s walk through the options…

First is the wikiname. I’m just going to call mine ‘test wiki’. Put in your own contact email, so that mediawiki will email YOU if anything is going on… I left the language in English, and left the license alone. The next important thing to do is to select a Admin username, and password. This is all up to you. Just remember that the Username is CaSe SeNsItIvE!!!

Leave the caching off.

The next section is for the email notifications, I just left those as default.

The final thing to configure is the database.

Since we are going to keep this simple, just set the DB username to root, and put in the password you configured earlier in the MySQL Console. Next check the ‘superuser account’ box, and specify root and the password again.

You can now click the Install MediaWiki button!

You’ll see some information printed on the page, and if everything goes according to plan, you’ll get the message:

Installation successful! Move the config/LocalSettings.php file to the parent directory, then follow this link to your wiki.

You should change file permissions for LocalSettings.php as required to prevent other users on the server reading passwords and altering configuration data

So simply copy the file c:\wamp\www\config\LocalSettings.php to c:\wamp\www\

then simply click the following link to be taken to your personal wiki:

http://localhost/index.php

media4

And that should take care of it!

installing flashterm on WAMP

Now with WAMP installed Let’s go on to flashterm.

Download the latest version of flashterm, which will include the flashsocket.php file.

Now the first thing I’d recommend is to extract the flashsocket.php file into it’s own directory, I’ve put mine in the d:\policyserver directory. Next I create a flashsocketpolicyserver.bat file in that directory that contains the following:

c:\wamp\bin\php\php5.3.3\php.exe -c php.ini flashsocket.php

Save it, and then we need to provide a php.ini for this server. Just copy the php.ini from c:\wamp\bin\php\php5.3.3\php.ini and copy it to your policyserver directory. You will need to edit the ini file to enable php sockets, so un comment this line:

extension=php_sockets.dll

Finally, we need to edit the flashsocket.php file.

alter the following at the top as needed:

$host = “192.168.X.X”; // CHANGE TO HOST IP
$port = 843;

I keep the port the same, as it makes the rest of this.. uncomplicated. I don’t think this binds well to 127.0.0.1 so use the primary IP address on the host that you want to use…

the next thing to look for is the string:

to-ports=\”23\”

This controls which port the flashterm will connect people on. You can also have multiple ports specified like this:

to-ports=\”42315,42323,42424,42525,42626,12323,42222,23333,42332\”

which would allow all of these ports to be accessible to Flashterm… This is the big advantage of the php server version, as it can have multiple ports.

For now though, I’m just going to use the default which will allow connections on the standard telnet port of 23.

Run your batchfile, and you should see something like this:

D:\policyserver>c:\wamp\bin\php\php5.3.3\php.exe -c php.ini flashsocket.php
[2010-12-28 18:03:40] Server started at 72.245.45.108:843

Now copy the following files into your c:\wamp\www directory, from the flashterm zip file:

expressInstall.swf
flashterm.swf
settings.xml
swfobject.js
index.html

Now we just need to edit the settings.xml to point to the correct location.

name=”386BSD 0.1pl24″
address=”72.245.45.108″
port=”23″
socket_server_port=”843″
info_graphic=””
default_font=””
columns=”80″
lines=”25″

In my example, I have a 386BSD 0.1 machine sitting on port 23

Then we load it up in a browser, hit the connect button, and there we go!!

flashterm

flashterm

 

And that’s it!

You can always play around with the info_graphic, by overlaying a picture, but I’ll leave that up to you.

WAMP server 2.1

Due to a request, I figured I’d document out the joys of installing WAMP, flashterm & the flash policy server, mediawiki in a multipart article. So to start, we’ll build the foundation which is the WAMP package which the other two will rely on.

So what is WAMP, well it’s Windows Apache Mysql & PHP. If you’ve ever heard of LAMP, this is the Windows version. And I’m happy to say that PHP applications seem to be pretty portable, allowing you to freely move data & applications to & from Linux/BSD/Solaris/Windows. Or that’s been my experience.

The first thing you’ll need to do is install the WAMP package. Luckily for us, the WampServer project has packaged the whole thing up into a nice windows installer. And the new version (2.1c) even includes x64 bulids!

So for the 32bit crowd you can download WAMP here.

And for the x64 64bit crowd, download WAMP here.

I’m currently using an aging HP machine as my server so I’m using Windows Server 2003 along with the 32bit version. WAMP works best when it’s just installed with the defaults.

The first thing I do is I install the SMTP service that comes with Windows. I leave IIS off as it’s kind of silly to have two web servers, unless you are doing it for some planned reason (say Virtual Server which needs IIS and uses port 1024). If you do have IIS make sure the ‘default’ website is turned off.

All that has to be done with the SMTP server is configure it to allow 127.0.0.1 to relay emails.. As it’s nice to get notifications that could be built in with whatever PHP application you go with.

SMTP1

Now run the installer, and I’ll try to walk through the steps.

wamp1

Hit next

wamp2

Accept the GPL License.

wamp3

Let it install in the default directory, it makes things easier.

wamp4

I like both set, you may not, but it’s easier to launch.

wamp5

Verify the install settings.

wamp6

Now WAMP will copy files and install.

wamp7

Then WAMP will want to know the default browser, honestly IE is just fine.

wamp8

Next WAMP will want to know what SMTP server to use… This is kind of important, and why I installed the default MS SMTP server as a lot of things that do registration, or email alerts, well work better with an email server…

wamp9

With the install completed let it launch WAMP.

wamp10

Once the WAMP server is installed it’ll be stopped and offline.

wamp11

Left click on the WAMP tray tool, and have it start all the services.

wamp12

Then left click again on the WAMP tray tool, and now you can start it up and take it online…

wamp13

If everything has gone right your WAMP tray tool will look like this!

Now open up a web browser, and go to http://localhost/

If everything has gone right, you should see this:

wamp14

Congratulations! You’ve successfully installed the WAMP server!