Porting Sarien to OS/2 Presentation Manager

Originally with all the buildup of compilers & GCC ports to OS/2, I had a small goal of getting Sarien running on OS/2. I did have it running on both a 286 & 386 DOS Extender, so the code should work fine, right?

To recap, years ago I had done a QuakeWorld port to OS/2 using the full screen VIO mode, a legacy hangover from 16bit OS/2. It works GREAT on the released 2.00 GA version. I went through the motion of getting the thunking from 32bit mode to 16bit mode, to find out that it doesn’t exist in the betas!

No VIO for you!
No VIO access from 32bit

So that meant I was going to have to break down and do something with Presentation Manager.

So the first thing I needed was a program I could basically uplift into what I needed, and I found it through FastGPI.

Donald Graft’s FastGPI

While it was originally built with GCC, I had rebuilt it using Visual C++ 2003 for the math, and the Windows NT 1991 compiler for the front-end. As you can see it works just fine. While I’m not a graphical programmer by any stretch, the source did have some promise in that it creates a bitmap in memory, alters it a runtime, and blits (fast binary copy) it to the Display window. Just what I need!

  for (y = 0; y < NUM_MASSES_Y; y++)
    for (x = 0; x < NUM_MASSES_X; x++)
      disp_val = ((int) current[x][y] + 16);
      if (disp_val > 32) disp_val = 32;
      else if (disp_val < 0) disp_val = 0;
      Bitmap[y*NUM_MASSES_X+x] = RGBmap[disp_val];

It goes through the X/Y coordinate plane of the calculated values, and stores them as an RGB mapping into the bitmap. Seems simple enough right?

  DosRequestMutexSem(hmtxLock, SEM_INDEFINITE_WAIT);

  /* This is the key to the speed. Instead of doing a GPI call to set the
     color and a GPI call to set the pixel for EACH pixel, we get by
     with only two GPI calls. */
  GpiSetBitmapBits(hpsMemory, 0L, (LONG) (NUM_MASSES_Y-2), &Bitmap[0], pbmi);
  GpiBitBlt(hps, hpsMemory, 3L, aptl, ROP_SRCCOPY, BBO_AND);


It then locks the screen memory, and then sets up the copy & uses the magical GpiBitBlt to copy it to the video memory, then releases the lock. This all looks like something I can totally use!

I then have it call the old ‘main’ procedure form Sarien as a thread, and have it source the image from the Sarien temporary screen buffer

disp_val = ((int) screen_buffer[y*NUM_MASSES_X+x] );

Which all looks simple enough!

Y/X instead of X/Y!

And WOW it did something! I of course, have no keyboard, so can’t hit enter, and I screwed up the coordinates. I turned off the keyboard read, flipped the X/Y and was greeted with this!

Welcome to OS/2 where the memory is the total opposite of what you expect.

And it’s backwards. And upside down. But it clearly is rendering into FastGPI’s gray palette! I have to admit I was really shocked it was running! At this point there is no timer, so it runs at full speed (I’m using Qemu 0.80 which is very fast) and even if there was keyboard input it’d be totally unplayable in this reversed/reversed state.

The first thing to do is to flip the display. I tried messing with how the bitmap was stored, but it had no effect. Instead, I had to think about how to draw it backwards in RAM.

    for (x = 0; x < NUM_MASSES_X; x++)
      disp_val = ((int) screen_buffer[y*NUM_MASSES_X+x] );	//+ 16);
      if (disp_val > 32) disp_val = 32;
      else if (disp_val < 0) disp_val = 0;
      Bitmap[((NUM_MASSES_Y-y)*(NUM_MASSES_X))-(NUM_MASSES_X-x)] = RGBmap[disp_val];
Running in the correct orientation

Now comes the next fun part, colour.

I had made the decision that since I want to target as many of the OS/2 2.0 betas as possible they will be running at best in 16 colour mode, so I’ll stick to the CGA 4 colour modes. So the first thing I need is to find out what the RGB values CGA can display.

This handy image is from the The 8-Bit Guy’s video “CGA Graphics – Not as bad as you thought!” but here are the four possible sets:

All the possible CGA choices

And of course I got super lucky with finding this image:

So now I could just manually populate the OS/2 palette with the appropriate CGA mapping, just like how it worked in MS-DOS:

First define the colours:

#define CGA_00 0x000000
#define CGA_01 0x0000AA
#define CGA_02 0x00AA00
#define CGA_03 0x00AAAA
#define CGA_04 0xAA0000
#define CGA_05 0xAA00AA
#define CGA_06 0xAA5500
#define CGA_07 0xAAAAAA
#define CGA_08 0x555555
#define CGA_09 0x5555FF
#define CGA_10 0x55FF55
#define CGA_11 0x55FFFF
#define CGA_12 0xFF5555
#define CGA_13 0xFF55FF
#define CGA_14 0xFFFF55
#define CGA_15 0xFFFFFF

Then map the 16 colours onto the CGA 4 colours:

CGA on PM!

So now it’s looking right but there is no timer so on modern machines via emulation it runs at warp speed. And that’s where OS/2 shows its origins is that it’s timer ticks about every 32ms, so having a high resolution timer is basically out of the question. There may have been options later one, but those most definitively will not be an option for early betas. I thought I could do a simple thread that counts and sleeps, as hooking events and alarms again suffer from the 32ms tick resolution problem so maybe a sleeping thread is good enough.

static void Timer(){

And it crashed. Turns out that I wasn’t doing the threads correctly and was blowing their stack. And somehow the linker definition file from FastGPI kept sneaking back in, lowering the stack as well.

Eventually I got it sorted out.

The next big challenge came of course from the keyboard. And I really struggled here as finding solid documentation on how to do this is not easy to come by. Both Bing/google want to suggest articles about OS/2 and why it failed (hint it’s the PS/2 model 60), but nothing much on actually being useful about it.

Eventually through a lot of trial and error, well a lot of errors I had worked uppon this:

    case WM_CHAR:
      if (SHORT1FROMMP(parm1) & KC_KEYUP)
      switch (SHORT1FROMMP(parm1))
      	case VK_LEFT:
	case VK_RIGHT:
	case VK_UP:
	case VK_DOWN:


I had cheated and just introduced 2 new variables, key_from, pm_keypress to signal a key had been pressed and which key it was. I had issues mapping certain keys so it was easier to just manually map the VK_ mapping from OS/2 into the KEY_ for Sarien. So it triggers only on single key down events, and handles only one at a time. So for fast typers this sucks, but I didn’t want to introduce more mutexes, more locking and queues or DIY circular buffers. I’m at the KISS stage still.

I’m not sure why it was dropping letters, I would hit ‘d’ all I wanted and it never showed up. I then recompiled the entire thing and with the arrow keys now mapped I could actually move!

Roger walks for the first time!

And just like that, Roger Wilco now walks.

From there I added the savegame fixes I did for the 286/386 versions, along with trying to not paint every frame with a simple frame skip and…

Sarien for OS/2 running at 16Mhz

And it’s basically unplayable on my PS/2 model 80. Even with the 32bit XGA-2 video card.

I had to give it a shot under 86Box, to try the CGA/EGA versions:


It’s weird how the image distorts! Although the black and white mapping seems to work fine.

Sarien on EGA

I should also point out that the CGA/EGA versions are running on OS/2 2.0 Beta 6.123, which currently is the oldest beta I can get a-hold of. So at the least I did reach my goal of having a 32bit version for early OS/2.

I would imagine it running okay on any type of Pentium system, however. So, what would the advantage of this, vs just running the original game in a dos box? Well, it is a native 32bit app. This is the future that was being sold to us back in 1990. I’m sure the native assembly that Sierra used was far more efficient and would have made more sense to just be a full screened 16bit VIO application.

So how long did it take to get from there to here? Shockingly not that much time, 02/20/2024 6:02 PM for running FastGPI, to 02/20/2024 10:56 PM For the first image being displayed in Presentation Manager, and finally 02/21/2024 10:39 PM to when I was first able to walk. As you can see, that is NOT a lot of time. Granted I have a substantially faster machine today than what I’d have in 1990 (I didn’t get a 286 until late 91? early 92?), compiling Sarien on the PS/2 takes 30-40 minutes and that’s with the ultra-fast BlueSCSI, compared to even using MS-DOS Player I can get a build in about a minute without even compiling in parallel.

I’ve put the source over on github: neozeed/sarienPM: Sarien for OS/2 (github.com)

I think the best way to distribute this is in object form, so I’ve created both a zip & disk image containing the source & objects, so you can link natively on your machine, just copy the contents of the floppy somewhere and just run ‘build.cmd’ which will invoke the system linker, LINK386 to do it’s job. I have put both the libc & os2386 libraries on the disk so it should just work about everywhere. Or it did for me!

So that’s my quick story over the last few days working on & off on this simple port of Sarien to OS/2 Presentation Manager. As always, I want to give thanks to my Patrons!


I really can’t add anything to this excellent resource for preserving the LVDC!


Note that this is NOT the Apollo guidance, rather this is the IBM provided ballistic launch programs. As told, it’d be a terrible ICBM program as it’s geared towards getting payloads into orbit, such as Skylab & Apollo.

And I really cannot add anything as I’m not an american citizen:

We’re currently treating LVDC code as if it is restricted for export from the U.S. by the International Traffic in Arms Regulations (ITAR).  If you legally qualify as a “U.S. person” and can provide evidence of that status, contact us directly to arrange to receive a copy of the code.
From the ibibilo page

Well at least it’s not completely lost as the last time I checked on this, all the LVDC’s were at the bottom of the ocean, and no printouts survived. At least some printouts have been found.

All I can do is call attention to it.

Zork for the PDP-11 / RT-11 recreated

I know this is a weird one, but I’ve always wanted to run Infocom games from ever since I found out it was a thing.

The cover of the RT-11 Zork that sold on ebay for $2,348.31

I know you maybe thinking of the FORTRAN port of the full Zork game, which does run on the same system. But this is NOT the FORTRAN reverse engineered game, rather it’s a port of the Z-Machine to the RT-11 / PDP-11.

Also this is NOT a 3rd party reverse engineering effort, it is the official Infocom Z-Machine source.

;       Proprietary documentation of:
;               Infocom, Inc.
;               55 Wheeler St.
;               Cambridge, MA 02138
;       Copyright (C) 1982, 1983 Infocom, Inc.  All rights reserved.

Yes it’s the real deal!

Ok so what or where to do this?! First you need SIMH or any other good PDP-11 emulator, a copy of RT-11, and of course the source to the interpreter oddly enough named PDP11.ZIP. Just keep in mind that this is NOT a pk-zip file, it’s a text file. It’s Macro-11 assembler source.

First you need a very simple config/type in to the SIMH PDP-11 emulator:

attach rk0 rtv4_rk.dsk
attach ptr pdp11.zip
boot rk

All being well you should boot into RT-11.

Now we copy the source into the machine through the paper tape reader. Just type in ‘COPY PC: ZIP.MAC’

 Files copied:
PC:            to DK:ZIP.MAC


This will create a .mac or macro assembler source file. The extension matters as it will tell the compiler what file it is and what to do. But luckily this is a single file, and assembles quite easily. As a tip to Unix folk, I found that making the assembly source in MS-DOS CR/LF made life easier.

Compiling & linking is very straightforward




Now we need to import a game file. I usually test with Planetfall, so I grabbed the data file, and placed it into the working directory and then attached it to the emulator

Simulation stopped, PC: 152644 (BR 152622)
sim> att ptr planetfa
sim> c

 Files copied:
PC:            to DK:PLANET.IML


Notice the filenames are short, very 8.3 for some strange coincidence! Also I named it planet.iml, as that is what the interpreter is expecting. Now we can just run the zip and point it to the game data file!

Line width (default is 80, end with LF for status line):
File name (current default is DK:$GAME$.IML) *dk:planet.iml
Infocom interactive fiction - a science fiction story
Copyright (c) 1983 by Infocom, Inc. All rights reserved.
PLANETFALL is a trademark of Infocom, Inc.
Release 37 / Serial number 851003

And there we go! We are now running Planetfall on our simulated PDP-11!

There is quite a few great 80’s systems in the github repository, I have no doubt the rest can be built, but I thought I’d tackle a system that was another bigfoot, a thing of pure legend!

Building MS-DOS 2.11

I thought I’d slap together some github thing with MS-DOS 2.11 that’s been made buildable thanks to a whole host of other smart people. The default stuff out there expects you to build it under MS-DOS using the long obsoleted ‘append’ utility which can add directories to a search path. Instead I created a bunch of makefiles that take advantage of MS-DOS Player, and let you build from Windows.

dos211: just the MS-DOS 2.11 sources, I re-aranged stuff and made it (slightly) easier to rebuild on Windows. (github.com)

building should be somewhat straightforward, assuming you have the ms-dos player in your path. JUST MAKE SURE YOU UNZIP as TEXT mode. If you are getting a million errors you probably have them in github’s favourite unix mode.

msdos ..\tools\masm ibmbio.asm ibmbio.obj NUL NUL
The Microsoft MACRO Assembler , Version 1.25
 Copyright (C) Microsoft Corp 1981,82,83

Warning Severe
Errors  Errors
0       0
msdos ..\tools\masm sysimes.asm sysimes.obj NUL NUL
The Microsoft MACRO Assembler , Version 1.25
 Copyright (C) Microsoft Corp 1981,82,83

Warning Severe
Errors  Errors
0       0
msdos ..\tools\masm sysinit.asm sysinit.obj NUL NUL
The Microsoft MACRO Assembler , Version 1.25
 Copyright (C) Microsoft Corp 1981,82,83

DOSSYM in Pass 2

Warning Severe
Errors  Errors
0       0

   Microsoft Object Linker V2.00
(C) Copyright 1982 by Microsoft Inc.

Warning: No STACK segment

There was 1 error detected.
msdos ..\tools\exe2bin.exe IBMBIO IBMBIO.COM < 70.TXT
Fix-ups needed - base segment (hex): 70
del -f ibmbio.obj    sysimes.obj   sysinit.obj ibmbio.exe


As an example building the bios by running make. For the impatiend you can download dos211.zip, which includes a bootable 360kb disk image, and a 32Mb vmdk!

FOSBIC1 compiler

Or Basic compiler/system in Fortran IV

I came across fosbic1 on github by accident, so intrigued by the description:

This is the FOSBIC1 compiler developed at the University of Gießen, Germany
in the late 70s for the CDC 3300 batch system.

It is a BASIC compiler and runtime system which is written in FORTRAN IV.

The text book from which the source code was copied implies that it is
a modified version of a BASIC compiler named UWBIC from the University of Washington, developed by William Sharp in 1967, for their IBM 7094.

So, without going into it much further I went ahead and made a few minor changes to get it running on Microsoft Fortran


Instead of some boring example, I thought I’d try some Mandelbrot, so going through this collection on rosettacode, I thought the OS/8 version looked simple enough to work with.

Sadly it doesn’t seem to be very ASCII so it doesn’t understand numerical characters. Maybe I’m doing it wrong I didn’t see anything. Just as my attempt to set a string variable to itself + a new letter then print that string strangely failed. Also it does weird stuff with strings, again it maybe me, but I’m impatient. This is terrible, and yeah I know.

                                        TESTCOMPILER -- BASIC BWL 5 GIESSEN -- VERSION 6/76-04

                   10 X1=59
                   11 Y1=21
                   20 I1=-1.0
                   21 I2=1.0
                   22 R1=-2.0
                   23 R2=1.0
                   30 S1=(R2-R1)/X1
                   31 S2=(I2-I1)/Y1
                   40 FOR Y=0 TO Y1
                   50 I3=I1+S2*Y
                   60 FOR X=0 TO X1
                   70 R3=R1+S1*X
                   71 Z1=R3
                   72 Z2=I3
                   80 FOR N=0 TO 30
                   90 A=Z1*Z1
                   91 B=Z2*Z2
                   100 IF A+B>4.0 GOTO 130
                   110 Z2=2*Z1*Z2+I3
                   111 Z1=A-B+R3
                   120 NEXT N
                   130 REM PRINT CHR$(0062-N);
                   131 IF N=0  THEN 200
                   132 IF N=1  THEN 202
                   133 IF N=10 THEN 204
                   134 IF N=11 THEN 206
                   135 IF N=12 THEN 208
                   136 IF N=14 THEN 210
                   137 IF N=15 THEN 212
                   138 IF N=16 THEN 214
                   139 IF N=17 THEN 216
                   140 IF N=19 THEN 218
                   141 IF N=2  THEN 230
                   142 IF N=20 THEN 232
                   143 IF N=22 THEN 234
                   144 IF N=23 THEN 236
                   145 IF N=24 THEN 238
                   146 IF N=25 THEN 240
                   147 IF N=3  THEN 242
                   148 IF N=30 THEN 244
                   149 IF N=31 THEN 246
                   150 IF N=4  THEN 248
                   151 IF N=5  THEN 250
                   152 IF N=6  THEN 252
                   153 IF N=7  THEN 254
                   154 IF N=8  THEN 256
                   155 IF N=9  THEN 258
                   200 PRINT 'A';
                   201 GOTO 439
                   202 PRINT 'B';
                   203 GOTO 439
                   204 PRINT 'C';
                   205 GOTO 439
                   206 PRINT 'D';
                   207 GOTO 439
                   208 PRINT 'E';
                   209 GOTO 439
                   210 PRINT 'F';
                   211 GOTO 439
                   212 PRINT 'G';
                   213 GOTO 439
                   214 PRINT 'H';
                   215 GOTO 439
                   216 PRINT 'I';
                   217 GOTO 439
                   218 PRINT 'J';
                   219 GOTO 439
                   230 PRINT 'K';
                   231 GOTO 439
                   232 PRINT 'L';
                   233 GOTO 439
                   234 PRINT 'M';
                   235 GOTO 439
                   236 PRINT 'N';
                   237 GOTO 439
                   238 PRINT 'O';
                   239 GOTO 439
                   240 PRINT 'P';
                   241 GOTO 439
                   242 PRINT 'Q';
                   243 GOTO 439
                   244 PRINT 'R';
                   245 GOTO 439
                   246 PRINT '-';
                   247 GOTO 439
                   248 PRINT 'T';
                   249 GOTO 439
                   250 PRINT 'U';
                   251 GOTO 439
                   252 PRINT 'V';
                   253 GOTO 439
                   254 PRINT 'W';
                   255 GOTO 439
                   256 PRINT 'X';
                   257 GOTO 439
                   258 PRINT 'Y';
                   259 GOTO 439
                   439 REM
                   440 NEXT X
                   450 PRINT '-EOL'
                   460 NEXT Y
                   461 PRINT 'END'
                   470 END

It runs in batches, so it’s not interactive. Very mainframe/1960’s minicomputer like. I guess it’s fitting again being in FORTRAN.

******************* EVERYTHING SEEMS OK -- LET'S GO AHEAD

                    PERCENT OF AVAILABLE STORAGE USED               31.081
                    PERCENT OF AVAILABLE DATA STORAGE USED            .000

AA    A    A    A    A    B    B    B    B    B    K    K    K    K    K
K    K    K    K    K    K    K    K    K    K    Q    Q    Q    Q    Q
Q    T    T    T    U    X    F    D    E    T    Q    Q    Q    Q    K
K    K    K    B    B    B    B    B    B    B    B    B    B    B    -EOL

I’m not sure what is up with the AA and after that, it’s all tabulated. I ended up running it through sed to remove the spaces, and using notepad to stitch the lines together. I guess I could have bash’d it some more but.. I’m impatient.

So yeah, it looks like it worked! Very amazing. And of course it’s crazy fast but that should be expected I suppose. I don’t like the hard coded table, but I just wanted to get it to generate an image.

Sadly, the author of the compiler, Weber seems to have disappeared, and the publisher Paul Haupt died in 1978, a year after this being published.

Missing Neko98

Neko on ARM

With the collapse of my vpsland archive, Neko has become lost once more again. Thankfully I had some fragment backups so I have been able to bring Neko back from the grave. again.

First I dumped everything I had over on sourceforge. With a bit more digging I found the old RISC versions as well. I even found the Itanium version, although I lost the ARM version. Im not sure I have an 8gb pi4 anymore, but I’d like to get one when/if prices stop being insane. Anyways I also uploaded the source to github, since it’s more hip and acceptable for zoomers. I do have to say the git mirror command was everything I’d hoped it’d be.

git push --mirror https://github.com/neozeed/neko98.git

It literally was that easy.

I put a binary built with Visual C++ 2010 SP1 over there too. Although if you need Visual C++ 2010 runtimes, I put them on sourceforge.

Also I should add in the settings make sure you click “Always On Top”, otherwise Neko will be hidden to the desktop surface and you won’t see him.

I hope you enjoy!

Missing link for Basilisk I found

Actually I held onto this, as I wanted to do something crazy for that Marchintosh thing but life got in the way it fell by the wayside, and well now it’s September, and I already have a Qemu instance running A/UX so my ‘at best’ hope of Basilisk II with MMU emulation is all but moot.

Captain, oh Captain!

While it may look like 2 very old emulators, which they are, the interesting thing here is that this old version of Basilisk that only has Macintosh Classic emulation is using the 68000 emulation core from UAE 0.6.8. It took a lot of downloading stuff, a lot of other nonsense, but I eventually found it, and was able to diff around to find the changes made were rather inconsequential, there by letting me rebuild UAE back on top of Basilisk.

My plan had been to either use far newer UAE cpu core, say from Previous as it has working MMU support, or Musashi.

I was building hard coded for TDM GCC 5.1.0 on MinGW. It doesn’t matter anymore but I threw it up on github since that is where all the cool kids are.


It’s absolutely pointless I guess, but maybe someone will find it interesting.

Netscape 3.02 aka hiding in plain site

Much to my surprise, along with a few other people the partial source code to Netscape 3 has been found. But it’s been there since 2011.

Normally I look for ‘source code’ although that terrible movie overlaps the name making it hard to find. So the phrase for the last decade turns out to be ‘source tree’

Netscape Communicator 3.0.2 Source Tree

So who knew!?

The SDK stuff is missing, and it looks like the Windows stuff is intermixed with the Unix.

There is some CVS tags, but not the history. Lots of the crypto has been deleted, and the SDK stuff is missing. Also no cooltalk. SUN Java is there oddly enough.

I have no idea if it’s buildable as it looks like its expecting a magical config regarding paths and tools, and a quick glance looks like it’ll need some time to massage.

Could this be the dawn of the ‘will it run NetScape 3’?

Sandboxie went GPL3!

I’ve been using Sandboxie for a long while to run all those questionable downloads on Windows. It’s a great light weight sandbox (as the name implies) for running random downloads, or even going to questionable websites as Sandboxie does a great job of isolating processes, and their filesystem access.

It’s not been all that cheap, but I felt it was worth it. I went to check to see how much it is as the conversation had come up on discord, and it turns out that Sophos had bought Sandboxie, and opened up the source code!

The downside is that there will be no further official development of the product. So I guess at some point I’ll have to break down and get a signing cert and re-build it if I want to keep using it.

Last version is locally mirrored here, as I understand it’ll be deleted soon enough.