Working with the Microsoft Programmer’s Library

OS/2 Programmers Ref

Well recently I did manage to get some GREAT books on OS/2, going back to the Microsoft days.. And they contain a lot of information, which was actually quite substantial.

Although there is the impression after the fact that Microsoft really wasn’t that dedicated to OS/2 the wealth of information in these books seem to be otherwise..

Anyways there is four volumes in the set, 1-3 going over version 1.1, and volume 4 with the 1.2 release of OS/2.

As luck would have it, someone gave me a lead on an ISO that contained not only these, but all of the programming documentation of the time on a CD.  No doubt this was the predecessor to the excellent MSDN.

There of course, is just one catch.  It uses the .hlp files, but not from Windows 3.00 its something much earlier and the only way to view the files is with an MS-DOS program.

Glorious MS-DOS interface

I even tried it on OS/2 hoping it was a family api program (like so many of the era were) but no luck.  I was then hoping maybe I could just ‘print’ the files to a virtual printer, and spool the whole job.  BUT YOU CANT PRINT.

So I then wondered if I could put together a TSR that would scrape the screen, append it to a file, and just keep hitting page down.   A few hours of cobbling together some example programs, and remembering to compile with the LARGE memory model (FAR pointers! remember those?)  I could then finally unleash the TSR through the program and extract some of the texts.

For those wondering how to do this kind of thing from MS-DOS here is the source.  While I wanted to use Scott’s program, there was the one drawback that almost everything grabs printscreen now so doing a REAL printscreen that hits interrupt 5 seems like it’d actually require a physical PC in MS-DOS.  And my current ‘retro’ PC has no ethernet so I wasn’t going to go that route.

So there is a lot of hacks with this, you can’t even uninstall it, just reboot …. but this hooks the clock, gives you about a minute to go where you want to go, then it saves a portion of the screen to a file, waits a few seconds and hits pagedown, and repeats….

// Written by Scott Hall of the U. of Missouri - Columbia, USA.
// This program will redirect your print screen button so that
// it goes to a file.  The file name is at the beginning of the
// start() function.  It can easily be modified to print screens
// that are larger than 80x25.

#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <dos.h>

#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif

char far *scr=(char far*)0xb0008000L;
#define VIDMEM 0Xb0008000L
#define INTR 0x1c

int busy=0;                                     // mutual exclusion (MUTEX)
void interrupt (*oldhandler)(__CPPARGS);
char far *old_dta;
char fname[9];

void interrupt int_5();
void tsr(unsigned size);                        // standard tsr bios call
void write_char(int x, int y, char ch, int attrib);
void write_string(int x, int y, char *str, int attrib);

void start(void);
void interrupt handler(__CPPARGS);

int main(int argc, char*argv[])
{
   if(argc==2)
   sprintf(fname,argv[1]);
      else
   sprintf(fname,"log.txt");

   printf ("installing\n");
   disable();
   oldhandler=getvect(INTR);
   setvect(INTR,handler);
   setvect(32,oldhandler);
   enable();
   printf("done\n");
   tsr(1000);
return 0;
}

void tsr(unsigned size)                 // standard tsr bios call
{                                       // you can also use keep()
union REGS r;

r.h.ah = 49;                            // function 0x31
r.h.al = 0;
r.x.dx = size;
int86(0x21,&r, &r);                     // last line executed
}                                       // never get to this line

unsigned char j=0;
unsigned int tcount;
unsigned int dcount=0;

//void interrupt int_5()                  // print screen button starts here
void interrupt handler(__CPPARGS)
{

if(dcount>480)
   {
   if(!busy&&tcount>5)
      {
      char far *p;
      union REGS r;
      struct SREGS s;

      p=scr;
      *p+=6;
      *p++=j;
      *p++=0x4f;

      j++;

      busy = !busy;                   // mutex around tsr
      start();

      r.h.ah=0x5;
      r.h.ch=0x51;    //pagedown?
      r.h.cl=0x0;
      int86x(0x16,&r, &r, &s);

      busy = !busy;
      tcount=0;
      }
   tcount++;
   }
else
   dcount++;
}

void write_char(int x, int y, char ch, int attrib)
{                                       // displays 1 character at (x,y)
char far *v;

v = (char far *) VIDMEM;
v += y*160 + x*2;
*v++ = ch;
*v = attrib;
}

void write_string(int x, int y, char *str, int attrib)
{                                       // writes string str at (x,y)
for( ; *str; str++,x++)
   write_char(x, y, *str, attrib);
}

int firsttime=0;        //need to skip 3 lines after the first time we
//page down.

void start(void)
{
int fd,x,y;
char cr=0x0D, lf=0x0A;

old_dta=getdta();
setdta((char far *)MK_FP(_psp,0x80));

//if((fd =_open("c:\\temp\\log.txt",O_WRONLY))<0) // open the file
//        if((fd =_creat("c:\\temp\\log.txt",_A_NORMAL))<0) // try to make new
//                write_string(1,1,"OOPS--write error1",0x8F);

if((fd =_open(fname,O_WRONLY))<0) // open the file
   if((fd =_creat(fname,_A_NORMAL))<0) // try to make new
   write_string(1,1,"OOPS--write error1",0x8F);

lseek (fd,0,SEEK_END);                          // jump to end of file

//for(y=0;y<25;y++)                               // grab lines 0 to 24
for(y=2+firsttime;y<24;y++)
   {
   //for(x=0;x<80;x++)                       // grab rows 0 through 79
   for(x=1;x<79;x++)                       //cut the bars from msl

   if(_write(fd,(char far *)(VIDMEM+160*y+2*x),1)==-1)
      write_string(1,2,"OOPS--write error2",0x8F);

   if(_write (fd,&cr,1)==-1)               // put a cr and lf at end
      write_string(1,3,"OOPS--write error3",0x8F); // of line

   if(_write (fd,&lf,1)==-1)
      write_string(1,4,"OOPS--write error4",0x8F);
   }

_close(fd);                                     // close the file

setdta(old_dta);
if(firsttime==0)
firsttime=1;
}

Hopefully this will help someone in the distant future, maybe it’ll just serve as a warning on how not to build stuff … lol

Oh and I used Borland C++ 3.1, but compiled this as C for the LARGE memory model.

DJGPP 1.03 saved thanks to shovelware + cd.textfiles.com

I can’t stress enough just how awesome cd.textfiles.com is for finding ancient stuff!

I’m not sure why I started on this quest but I was looking for some old finicky DOS extender, and started hunting for Go32, the first DOS extender used by DJGPP.  And for the heck of it, I wanted to find the first version, which I pretty much had assumed was lost to the mists of time.

However the CD-ROM shareware collection called MegaROM-1 actually had a ‘full’ copy of one of the first versions of DJGPP, 1.03.

Installation is pretty straightforward, however you have to use pkunzip for all the various old ‘methods’ of storing data in zip files, I found infozip leaves things out..

Also DJGPP 1.03 uses a LOT of environment space.. which is more so a problem for people running real MS-DOS on real machines.. (there are some!)…

Hello World!

It runs in DOSBox, but there is no doubt some stack corruption as trying to run things like dos edit result in:

Packed file is corrupt

But at least we can run more than one copy, or use a native editor.

GO-32 from this era is *NOT* DPMI compliant, nor is it VCPI compliant.  And its based on GCC 1.39, which was a popular level with things like 386 BSD, although it seems early Linux used GCC 1.40 ..  The tool chain by default outputs the GNU a.out format, but relies on modifying the linker that was separately included in G++.  Later versions of GO32 included VCPI support, and near it’s end of life version 1.10 added support for DPMI which greatly simplified things like hooking IRQ’s and doing DMA.

For those who want to play, without the pkzip fun, I’ve slapped it into a single 7zip file.  It’s not even a megabyte.  But it was 1991, when 4MB of ram seemed like an incredible amount of memory!

Flight simulator 4!

Flight Simulator 4

From a comment made by ampharos, there is all kinds of weird stuff on the old Microsoft FTP server, including all kinds of stuff in the stress test directory.. So wandering around I came across something I never noticed, Flight Simulator 4!

That’s right and for MS-DOS.  I recall running this on OS/2 2.0 was kind of a big deal, but its cooler in dosbox! … Anyways, if you want click here, and download away.  I think this version was intended to more of a demo, but it’s still cool to watch the jet plane going through the motions.

What is amazing to me is just how compact it is… It seems there was a lot ‘more’ with less back then, but maybe we’ve come to expect so much more?

Yet another update for QuakeWorld/Quake for MS-DOS

You can download the source/binaries here.

The big change is that you can not play larger maps, like the dreaded Warp Spasm (which of course relies on QUOTH).

Warp Spasam under OS/2

I’ve also built it for OS/2! You can download Quake, Quake World, and the source code. This all builds with EMX 0.9d and I’m using OS/2 2.0 (patched to x06100).

Also if it matters the newer your MS-DOS the better… 4.01 works, sure but its SLOW…

QuakeWorld for DOS updates..

Remember my old Quake port to MS-DOS that included that WatTcp package so that you could play on the internet under glorious MS-DOS?  Well it’s kind of taken a life onto its own, and thanks to the hard work of Frank Sapone, it picked up all kinds of updates including:

Whew isn’t that great?

I’ll have to check to see how much of this I can backport to OS/2

You can download it, and more here.  And in the meantime I’ve put up my server on 68.68.97.224 … Enjoy!

Quake & QuakeWorld for MS-DOS update

So after a year+ of inactivity I’ve spent some time with Quake (netquake) and QuakeWorld for MS-DOS.  I had modified it to support the WatTCP stack for MS-DOS, allowing you to play over the internet with any MS-DOS PC with a packet driver.

After a good bit of prodding and playing with DJGPP I’ve updated everything to include some new tweaks for a malloc ‘bug’ (Quake assumes the memory is clean, which under DJGPP it isn’t) some limit increases (zone to 1MB, and increases in max edicts, models & sounds), and forcing the sound to 22050Hz.  The source code is now here.  As much as it pained me, I built it with this DJGPP under MS-DOS (On Qemu) and I’m keeping it here, as gcc 3 & 4 are incapable of building a working WatTCP or Quake.

Another big fix for QuakeWorld is that it now can run in 640×480, 800×600, and even 1024×768 if your video card is VESA 2.0 compatible!!!

Basically you can just replace the default exe’s in a Quake1 install and go from there.  If you do not have quake at all, you can always look for the shareware version.  QuakeWorld will require the commercial version for what it is worth. I’ve found it runs best with 32MB of ram.  I don’t know if that is even an issue in this day & age.  Quake1 will run in 16, but I have a feeling QuakeWorld runs in VM (thanks to CWSDPMI) and it does say it is using 32MB … Because I clear the ‘zone’ before Quake runs there may be a 30 second to 1 minute pause.  This is to be expected, just hold tight.

QuakeWorld at 640x480

QuakeWorld at 800x600

QuakeWorld at 1024x768

You can download either Quake.exe or Qw.exe.

Thanks to [hci]maraakate, for the hints on what to update where, and of course the testing on a ‘real pc’!`

It was 30 years ago today…

 

IBM released the PC onto the world.

Wow.

For the occasion here is 86-DOS fished out from 86-dos.org  This is what was sold to Microsoft as the basis for MS-DOS.

You too can behold this ancient gem here.

Maybe I should do something about the various versions and hunt out something capable of running MS-DOS 1.25..  I’m sure Peter has something for the  occasion!

Oh and I have to add this bit from olduse.net

“Out of today’s mail:  Electronics, June 16, 1981:Under the heading (pg. 33) “Xerox to market personal computer…”
with the announcement of the 820 which most of you may have seen already, is “… with IBM to follow suit” Called Chess, it is an 8088-based system priced between $3-4K, and includes two DSDD 5-1/4 Tandon floppy drives, a detachable keyboard.  An OS “similar to CP/M” from Microsoft (IBM Personal Computer DOS), from 64K to 256K RAM, and a “600-by-400-line” B&W display and able to handle eight colors with a resolution of 400×200 pixels or four colors at 800×400.  Look for it to be announced next month and check out Sears, Computerland, and maybe J.C. Penney.”

The first mention of the IBM PC on usenet…

Some follow up on Stacker


From my OS/2 experiments before I roll it out… 
  • It only supports FAT.
  • Maximum of 2GB ‘compressed’ drives
  • Swapping drive letters assumes 1 disk 1 volume
  • You create the compressed disks in DOS

So, since I’m thinking of BBS space, I can leave part of the disk uncompressed for zip’s then the compresses partition for databases & doors.

I guess the thing to keep in mind is that 1991-1994 2GB disks were not in the hands of your average user.. And the idea of using that much storage seemed crazy.  It’s a shame they did that deal with Microsoft and basically got pushed out of the market.  It’s a shame that the OS/2 product doesn’t actually run on OS/2, nor support HPFS.  The idea of bigger disks, and long file names would have been nice.
Oh well I guess that is how the older stuff dies out.

Stac Electronics Stacker for OS/2

Once upon a time hard disks were expensive.  A device that could hold a terrabyte would cost hundreds of thousands in the late 1990’s!  I remember Windows NT 3.51 taking 3 days to format 890GB!!!

Even when I got my first 20MB hard disk, it along with the controller cost several hundred dollars.  I had upgraded to a 286 from a Commodore 64, and even a 720kb floppy felt massive!  I figured it’d take a long while to fill 20MB so I was set.  Well needless to say I was so wrong!  Not to mention there was no way I could afford a 30MB disk, I wasn’t looking for a questionable used 10MB disk, and a 40MB disk was just out of the question!

Until I saw this:

Stacker 2.0

Stacker changed everything for me, now via software compression not only could I fit 40+MB worth of crap on my 20MB disk, but I could even get more data on my floppies!  The best part about stacker, unlike pack/zoo/pkzip and friends is that the compression was transparent.  Meaning you load the driver, and pickup a new driver letter for the compressed volume, and from that point onward everything you do to that disk is compressed.  All MS-DOS programs work with it.  Yes really from Windows 3.0, to dbase, BBS packages, even pkzip (although it’ll get a 1:1 compression)

Stacker for OS/2

So for a long while life was good with Stacker although like everything else, things changed.  I wasn’t going to run MS-DOS forever, and when I switched to OS/2 I was saddened to find out that there was no support for OS/2. Also Linux support was not going to happen either.  Although they did eventually bring out a version for OS/2 it did not support HPFS volumes, only FAT.

And as you can see while Warp was the main target it could function with OS/2 2.0 and 2.1 as long as you had updated them to the latest fixpacks.  And preferably installed the OS onto a FAT partition as the setup process hinges on it being able to modify the config.sys & boot directories from a DR-DOS boot floppy included in the package.

One of those funny things about disk compression is that for very heavy disk access programs that tend to compress pretty good (say databases with lots of text records) is that compression can greatly speed them up.  If you are getting 16:1 compression (ie you have LOTS of spaces…) you only have to read the hard disk 1/16th as you would on an uncompressed volume.  It’s still true to this day, although people tend to think disk compression added a significant amount of overhead to your computer (I never noticed) it can make some things faster.

Another thing that STAC was involved in was selling compression coprocessors.

Stac co-processor ad

While I’m not aware of these cards being that big of a seller, It is interesting to note that these co-processors were also available for other platforms namely the cisco router platform.  Since people were using 56kb or less links, the idea of taking STAC’s LZS compression and applying it to the WAN was incredible!  Imagine if you were printing remotely and suddenly if you got even a 4:1 boost in speed, suddenly things are usable!  The best part is that while there were co-processors cisco also supplied the software engine in the IOS.  Enabling it was incredibly easy too:

interface serial0/0

compress-stac

And you were good to go.  The real shame today is that hardly anyone uses serial interfaces so the compression has basically ‘gone away’.  Cisco did not enable it for Ethernet interfaces as those are ‘high speed’… Clearly they didn’t foresee that people would one day get these infuriating slow “high speed” internet connections being handed off on Ethernet and how compressing them would make things all the better.

I think the general thrust has been to a ‘black box’ approach that can cache files in the data stream, provide compression and QoS all in one.

So until I re-install OS/2 on a FAT disk, let’s run this through the Windows 3.0 Synchronet BBS I was playing with.

Stacker starts up with some ascii art of a growing hard disk.  Maybe one day I’ll figure out how to dump Qemu’s video into something to make animated GIFs with.  Until then… well.

Setup is pretty straight forward, pick a disk to compress, then decide if you’ll do the whole disk and incorporate the drive swapping fun, or just do the free space to create a sub volume, and manually manage it.  I’m not in the mood to reconfigure anything so I’ll do what most people did and compress the whole drive.  What is kind of fun to note, is that in modern implementations of compress & encryption you have to select one or the other you cannot do both.  However using emulators that can support encrypted disks, you *could* then compress from within.  I don’t know why the new stuff doesn’t let you, maybe the layered containers gets too much.  But I do bet there is something out there for Windows that’ll mount a file as a disk image (like Windows 7 can mount VHD’s) on an encrypted volume, then turn on compression…….

Anyways with the target selected, it will then copy the files, then create the volume…

Which took a minute, then it’ll defrag the disk using Norton Speed disk (from that point onward it seems that speed disk disappears..?)

And once that is done, we are basically good to go.  So how did it do on my 80MB ‘test’ disk?

I’d have to say pretty good, 2.5:1 is pretty snazzy!  And my BBS is working, I didn’t have to change a single line, it’s 100% transparent.

Eventually IDE hard disks took over the world, and got larger capacities, faster and cheaper.  Not to mention the world was switching operating systems from MS-DOS to Windows 95, or Windows NT and STAC just got out of the market after the big lawsuit.

But it’s funny looking at old disk ads…  And what a catastrophic thing it was to fill the things up.

But before then, we had stacker…