Microsoft C KnowledgeBase articles online

PC Mag, January 1989

It’s weird I was discussing putting this online in a more human readable format, and then  Jeff Parsons over at the incredible full system emulation in javascript site, pcjs.org just did it.

As you may or not be aware of, Microsoft hit it big as a computer languages company, before they added operating systems into it’s portfolio.  And for some weird reason after the whole OS/2 divorce thing, someone decided that everything that had been painfully learned in the earlier eras should just be expunged from history.  Which is a real shame to anyone interested in Basic, Fortran, Pascal, C and MASM.  Years ago I had gone through the steps of extracting the text the only way I could figure out easily, by writing a simple TSR that would dump the contents of the text video buffer, and write it to a file, then press the page down key, and keep repeating the process. The end result being that I had then dumped the MSPL aka the Microsoft Programmer’s Library.  I had put the text into an archive, aptly named Microsoft_Programmers_Library.7z, and pretty much used grep whenever I wanted any information, and left it at that..

It’s really cool to see it slowly transitioning to more useful information.  You can read Jeff’s article Corporations Are Crappy Archivists about his quest for seemingly simple information about ancient Microsoft mice, and the archive of KB’s for Microsoft C.

One thing that is annoying is that information on CD from the late 1980’s seems to be darned near impossible to find.  I know that each generation of machines until about 2005 was exponentially larger than the previous one (post 2007 we hit the iThing world, along with most machines being ‘good enough’ for day to day usage).  I know this ad may seem insane, but Microsoft really was trying to push people to CD distributions.  As we all know that internet thing didn’t quite tickle their fancy.    Did they ever put resources like this online?  Like on BIX or Compuserve?  It seems like an ideal resource.  But I was a kid, and didn’t have that kind of money.

Awesome CD-ROM collection and drive, starting at a mere $899!

So in the interest of a bad idea, here is MSPL, aka qemu/curses in action.

Oh my god, what I have I done!?

Well as an addendum I thought it’d be cool to put MSPL online, via shellinabox.  First off I needed a 5MB MS-DOS disk, basically enough MS-DOS too boot up, run smartdrive, idle and the CD-ROM driver, along with the minimal MSPL install.  And to button it up, I added a reboot.com from the autoexec, so when you exit it’ll reboot the VM.  Great.

The reboot command was input via debug, as it’ll let you assemble code directly.  Although it isn’t a MACRO assembler, so you have to know exactly what you are doing.

DEBUG RESET.COM
A
XOR AX, AX
NOT AX
PUSH AX
NOT AX
PUSH AX
RETF
(return on a line by itself)
RCX
9
W
Q

And with that saved, now I have to setup Qemu.  Since I’m taking the shellinabox approach that means I need something text mode, and I was thinking this was light weight. Qemu has a curses output so that’ll work.  I set it up to use qcow2 and a backing store image so that way every forked user doesn’t eat 5MB of disk space, it’s more like 100kb.

#!/bin/sh
set -m
PID=$$
mkdir /tmp/$PID
cd /tmp/$PID
qemu-img create -f qcow2 -b /usr/local/mspl/MSPL.qcow2 MSPL.qcow2
qemu-system-i386 -m 4 -cpu 486 -hda MSPL.qcow2 -cdrom /usr/local/mspl/Microsoft-Programers-Library-v1.3.iso -curses -no-reboot
cd /tmp
rm -rf /tmp/$PID

Then to tie it into shell in a box, it’ll just need the flag:

-s /mspl:nobody:nogroup:/:/usr/local/bin/mspl.sh

and this will run it as nobody, and kick off the above bash script.  Now that’s great and all, but what about stale/abandoned sessions?  I wrote this quick script to clean them up.

#!/bin/bash

FIND=”find /tmp -type d -regextype sed -regex ‘.*/[0-9]*’ -mmin +30 | sed ‘s/\/tmp\///’>/tmp/kill_out.txt”
eval $FIND
while read process; do

KILL=”kill -9 ${process}”
eval $KILL
RMDIR=”rm -rf /tmp/${process}”
eval $RMDIR

done < /tmp/kill_out.txt
rm -rf /tmp/kill_out.txt

So it’ll find numerical directories that are at least 30 minutes old, kill them and remove their directory.  Probably very dangerous to run, but it’s isolated so Im not too worried.  Then just have root add that script to it’s crontab, and run it every minute, and it’ll kill the old stuff hanging around.

I’ll add a video later on how to use MSPL via this setup.  And maybe I’ll rig something to have RDP access as well, depending on how I’m feeling.

17 thoughts on “Microsoft C KnowledgeBase articles online

  1. i just found out that Microsofts C 5.1 & Quick C 2.52 definition of LONG_MIN in limits.h is wrongly set to -2147483647 should be -2147483648, simple 29+ years old bug 🙂

    • Got to love those old rounding errors! I wonder how many people were going insane with trying to eval data in binary and getting one off errors…

      • i’ve compiled an old MS C 5.1 source with DigitalMars C and the result was different – due to the correct defined LONG_MIN in dmc
        its nice to build dos medium model exes based on such old source with an more recent (dmc 8.57 is from Aug 1, 2013) C/C++ compiler 🙂

  2. Out of curiosity, have you found any PC-98 MS developer products amongst old MSDN CDs? I’ve heard rumors here and there that some may be present. All I’ve managed to find is VC++ 1.52 (which is actually compatible with both DOS/V and PC-98), still on the hunt for MASM especially…

    As you’d guess, western MASM 6.x’s installer immediately crashed my PC-9821Xa12.
    I think I also have VB for DOS for them but I couldn’t get it to work…

    • I bought a,PC-98 as well. I was going to target it via DJGPP as there is a go32 port. As far as I can tell, there wasn’t a DJGPP v2 port.

      I’d just had so many issues trying to bootstrap anything but now that I have a known good null version of DooM that compiles with GCC 1.27 I should be able to get something going. Of course I still don’t have any clue regarding the actual hardware.

      The masm installer may crash, but I’d think MASM itself should run… PC-98’s are like DEC rainbows, only dos interrupt compatible.

      Ralph Brown may have information on the BIOS side too…

      • Actually, DJGPP v2 mostly works out of the box. There is a libc patch for 2.03 that I need to get off my ass and integrate into 2.05 that replaces a lot of PC dependent functions, but the compiler itself *will* run with no modifications. You just need to modify cwsdpmi to have the swap file at the right location and make sure the /DPMI switch is on your EMM386 line. At least in DOS 6.2, I suspect 5.0 is different and requires using dpmi.exe.

        Note that Neko Project 21/W seems to have massive problems running protected mode code. Trust me, it works on real hardware.

        Shit, if you want to know anything about hardware or BIOS, ask me. I’ve been up to my eyeballs in Japanese docs on both for the past several months.

        • I have found neko to have major Pmode issues as well.. The official DooM on 98 uses some weird dos extender that Ive never heard of before and gives me nothing but grief even on real hardware.

          I guess as long as there is DPMI, then it’s somewhat straightforward to hook interrupts.

          Is there something like mode 13 on the 98? More so where the pixel mapping is 1:1 one byte to one pixel? 8bit depth as well?

          How about the clock, or hooking the keyboard? Is there any open source doom or quake on the pc-98? As those tend to have nice keyboard/mice grabs along with putting machines into a 320×200 or so 8bit depth, and that code can be re-adapted to other stuff.

          Thanks for any/all info!

  3. The closest equivalent to mode 13h is the 640×400 and 640×480 256 color chunky modes, found on all 486 and up 9821 machines.

    I believe I have found some sample code for DJGPP v2 for said mode, will look around later today. If not, I can hack something up, I’ve got enough references to pull it off.

    By clock, do you mean the RTC or an interval timer? RTC is an oddball NEC chip (uPD1990/4990, yes, the same as a Neo Geo), interval timer is a typical 8253 PIT, just hooked up differently. I believe 9821s also have an extra high-res interval timer, but I have not extensively studied it.

    Keyboard: there’s no KBC, the keyboard just connects over TTL serial at 19200 baud to an 8251 USART. I believe there’s also a relevant BIOS call under INT 18, but I’d have to look. Let me dig through all the Japanese sample code I’ve managed to find…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.