Building the Original Commodore 64 KERNAL Source

I just found this post over @pagetable.com, the source code to a bunch of old Commodore 8 bit products have been located and recovered, and place online over on github.  Even better there is detailed instructions on cross assembling from a suitable PET machine for building your own KERNAL ROM.

Other sources include:

  • BASIC_C64 reindented BASIC_C64, KERNAL_C64 and DOS_1540 to approximate the LST
  • BASIC_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • BASIC_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • BASIC_PET2001 added BASIC_PET2001
  • DOS_1540 reindented BASIC_C64, KERNAL_C64 and DOS_1540 to approximate the LST
  • DOS_1571 added DOS_1571
  • DOS_1581 added DOS_1581
  • DOS_4040 reindented DOS_4040 to approximate the LST output of the assembler
  • DOS_8070 reindented DOS_8070 to approximate the LST output of the assembler
  • DOS_8250 reindented DOS_8250 to approximate the LST output of the assembler
  • DOS_D9065 reindented DOS_D9065 to approximate the LST output of the assembler
  • EDITOR_CBM2 reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • KERNAL_C64_01 added KERNAL_C64_03 and renamed the existing KERNAL_C64 to KERNAL_C64_01
  • KERNAL_C64_03 fix disclaimer of C64 KERNAL -03 to reflect the LST printout
  • KERNAL_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • KERNAL_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro

Super late, but pretty cool too!

Of interest is the PET2001 Basic sources.  While there have been reversed efforts dating back for years, this is the actual source code.  Namely the header.


TITLE BASIC M6502 8K VER 1.1 BY MICRO-SOFT
SEARCH M6502
SALL
RADIX 10 ;THROUGHOUT ALL BUT MATH-PAK.

$Z:: ;STARTING POINT FOR M6502 SIMULATOR
ORG 0 ;START OFF AT LOCATION ZERO.
SUBTTL SWITCHES,MACROS.

REALIO=4 ;5=STM
;4=APPLE.
;3=COMMODORE.
;2=OSI
;1=MOS TECH,KIM
;0=PDP-10 SIMULATING 6502

Which is pretty damned interesting. The infamous “WAIT6502,1” feature is also included!

SimCity under Windows 3.0

In this case, I’m looking at the ultra popular Sim series, and their Windows releases.  While I was a big fan of SimCity, especially having played it on an Amiga, when I found out that there was a Commodore 64 version I had bought it immediately as I wanted to play it at home.  And let me tell you, it was a severely underwhelming experience.

SimCIty C64

From the logo it’s all down hill.  I know that SimCity is actually from 1985, and as the first version, the Commodore 64 version is basically the prototype.

SimCity C64

Which was just graphically underwhelming, but I still played the hell out of it.  And then I saw the Spectrum 48k version.  Yes the blocks are ‘buildings’ as the units fill up they will turn into black with only the letter remaining.  Despite the ultra minimal graphics, the game play is there.  And once you get used to the bizarre combination keyboard+joystick controls it is addictive.  I mean it is SimCity!

SimCity Spectrum 48k

But going to the PC, I kind of grew out of SimCity.  DooM was the hot game, and the whole immersive 3d thing.  And of course during that era being on the PC I only knew of the MS-DOS version.  While there was a version for OS/2 Warp released much much later, and by then if I felt the urge there was SimCity 2000 for Windows.

But after getting the kick for SimEarth, and finding the Windows 3.0 version, I was much surprised to find out that there was a version of SimCity of Windows 3.0 as well!

And I can see why I never had seen this for retail, or knew anyone who had it.

Maxis Order Form

That’s right in the included form, the price was $59.95.  And SimEarth was $69.95!  To put that in perspective that would be now $107.17, and $125.04  respectively.  And people think $60 for a game today is expensive!

To get the full experience I went ahead and loaded up PCem, with a 386 and EGA graphics to get that original feel.

Since this requires Windows 3.0, with either EGA or VGA graphics, and 2MB of RAM, I figured I would go with a ‘top of the line’ souped up 386DX.  I tried to load it up with the Wyse700 driver, and the game fails to load resources.  I don’t know if its even possible to make black and white or four colour resources, as I live in the future, and I have millions of colours!

That said, I tested and it has no issues with 8bit depths either.

Installation is pretty smooth, the game is shipped on either two 360k 5 1/4″ diskettes, or a single 720kb diskette. While modern games have so much more, there is many things this game is lacking.  But Maxine isn’t one of them.

Maxine the cow

No really, she is listed as a feature.

The music is through the PC speaker.  Just like the sound effects.  Multimedia integration with Windows that we take for granted today just wasn’t a thing back then.  The version I have is 1.0, Although a pirated version 1.1 that was sent in actually includes WAV sound effects, and a single midi track. However it doesn’t run on Windows 3.0.  So lucky me!

Unrecoverable Application Error

Ah the UAE, the bane of Windows 3.0.  They were so unpopular that Microsoft had to rename the dialog.

SimCity on EGA

Living in the constraints of EGA feel absolutely claustrophobic in today’s world.  640×350 just isn’t enough screen rel estate.  Even 640×480 is far far too small.  And that lead to one issue I found

SimCity SVGA

While using a SVGA driver so I can get that impossible to afford experience of 1280×1024 in 256 colours, but the application was never meant to run in something that wide.  You can easily put child windows ‘behind’ the dead space, and you can never recover them.  You have to save and re-launch. bummer.

Which leads me to perhaps the most famous reputation of SimCity for Windows.  As mentioned on Joe’s site, there was a massive struggle to get games like SimCity running on Windows 95. As Raymond Chen says:

If any application failed to run on Windows 95, I took it as a personal failure. I spent many sleepless nights fixing bugs in third-party programs just so they could keep running on Windows 95. (Games were the worst. Often the game vendor didn’t even care that their program didn’t run on Windows 95!)

Yes, they basically knew it had problems.  In the box they even had this cute flyer:

I sure hope Raymond got something for his efforts!

And yes, rest assured it actually does work.  It even works on Windows 3.00a under Citrix MULTIUSER 2.0.  Pointless as there is no way to have remote graphical displays but nice to see it work.

So what went wrong?  Where was all the follow up games for Windows?  Obviously the hardware needed was incredibly expensive.  A 386 or even a 286 with a few megabytes of RAM was expensive.  VGA or EGA monitors were also very expensive.  Even mice were expensive!  Putting together a low end PC basically barred you from this high end premier experience.  I can’t imagine that Maxis sold many copies of this.  As mentioned above I’m pretty sure there is a reason why I never saw this in the wild.

Awesome Windows 386/486 machine prices February 1992

Spending $3000 in early 1992, which is $5197.95 in today’s money. I can’t even begin to imagine spending over $5,000 to play a game.  It’s no wonder when older machines show up on eBay people want far too much for them.

In a strange way I like to watch SimCity animate in the background.  It’s like a fish tank, or staring out into a busy street.  With the advantage that I can summon a giant lizard to destroy it at my whim.

Microsoft Game Shop

This one showed up on eBay of all places.  The original MSRP was $49.95 USD.

Microsoft Game Shop

Well it seems that back in the early 90’s Microsoft was transitioning their Basic offering from the QuickBASIC to Qbasic.  And one of the launch products was the Microsoft Game Shop, back from 1990.  This was a specialized version apparently without any compiler, but included a tutorial based around games to teach basic.

Microsoft Game Shop (back)

Which back in the day it looks like it would have been a good way to inspire kids, although I have never heard of it.  There is even a glowing review in Compute, issue 130.

 

From the packing list it contains:

QuickBasic went on to become the cut down QBasic that was later included in MS-DOS 5.0, Windows NT 3.1, and of course OS/2 2.00.

UPDATE:

There may be updates later in the year as these are waiting for me on the other side of the planet.  So I have to urge patience.

Microsoft Game Shop disks

Who knows, maybe they will even read!  The Windows/386 v2.03 I had recently ordered circa early 1988 read fine, so let’s hope these will too.

Citrix Multiuser 2.0

Back before selling auto insurance

Citrix Multuser 2.0

Nothing like a little vintage advertising to try to re-capture the feel.  But don’t let the colorful lizard fool you, this certainly was a dark time for Citrix.  Firs they had tooled a product around the future of the PC market, OS/2 to only have Microsoft pull out of active development just as they were launching Multiuser 1.0.  And to be fair it wasn’t just Citrix, the whole industry including Microsoft was in turmoil as people were pulling away from IBM and selecting Windows on MS-DOS of all things!

Citrix, like a lot of vars were caught in this lurch between OS/2 and the forthcoming NT OS/2 3.0, which of course ended up becoming Windows NT.  During this time even Microsoft had to keep selling it’s SQL server on OS/2, along with it’s LanManager file & print server.  Although they had a solution for the end user in the form of Windows they didn’t have any server platform.  That left Citrix chasing the tail end of the application wave again as although they could now finally use OS/2 2.0, with it’s 32bit/16bit hybrid kernel, there remote user solution was still terminal based.

IBM OS/2 ad

As IBM & Microsoft had split up the direction of the OS/2 project, IBM was running with version 2 as a platform for running DOS & Windows applications.  Which ultimately lead to the major problem that OS/2 ran Windows apps better than native Windows thanks to it’s ability to run isolated Windows VM’s using paravirutalized graphic drivers.  It wasn’t until Windows NT 3.5 could Microsoft meet this feat with it’s new platform.  Suddenly Citrix had access to tonnes of MS-DOS based applications, much to my surprise there is even a DPMI driver on the disks I have, meaning that Windows 3.0 standard mode can run, along with DooM!  But for Citrix this would be another one of those ‘not good enough’ moments where PC Servers were just high end workstations that could easily be maxed by one user, commodity multiprocessor machines were years off, and of course everyone was jumping to Windows 3.0.

But this did at least you run MS-DOS applications remotely, over dialup.

Citrix multiuser 2.0 boot

Installing Citrix Multiuser 2.00 starts looking very much like one of the 1.x versions of OS/2 with a far more busier screen featuring the Citrix tree.  However from this point onward it feels a LOT more like IBM OS/2 2.00.  Citrix interestingly enough has two disk 1’s, one that features newer LADDR drivers, and another with the older 1.x drivers.  Although under bochs, the older driver disk crashes out.  The entire OS fits on 8 high density 5 1/4″ diskettes.  As teased before this post, I saw this on eBay, ordered it immediately to only discover that I don’t have the needed drive, and had to order one from pc-rath_de, and I wanted to give a shout out, as he made sure that I had the proper floppy ribbon cable, so I could go ahead with this fun project.

Although I had been expecting this to be inline with the never released Microsoft OS/2 2.00, it clearly has a lot of IBM vestige, even though the OS/2 source code license agreement was between Citrix and Microsoft.

Indeed, even checking the OS level:

IBM OS/2 Base Operating System
Standard Edition 2.00     Component ID 560109001
Current CSD level: XR00000
Prior   CSD level: XR00000

Compare this to the OS/2 2.00 GA:

IBM OS/2 Base Operating System
Version 2.00 Component ID 562107701
Type 0
Current CSD level: XR02000
Prior CSD level: XR00000

So clearly this is not in sync with the General availability of OS/2.  What this is closer to sync with is the OS/2 LA – Limited Availability release.

IBM OS/2 Base Operating System
Standard Edition 2.00 Component ID 560109001
Current CSD level: XR00000
Prior CSD level: XR00000

Well isn’t that interesting?

Having had the misfortune of crashing all three we can look at the internal revisions:

Citrix Internal revision 2.053 6.177H base

LA Internal revision 6.167 91-10-08

GA Internal revision 6.307 92-03-01

So this make the BOS (Base Operating System in IBM speak) newer than the OS/2 LA (Limited Availability) kernel, however quite a few revisions behind the GA (General Availability).  This of course means that Citrix Multiuser 2.0 is basically incompatible with any 32bit OS/2 software.  I was unable to run anything EMX based, nor could I run the vast majority of the 32bit TCP/IP stack for OS/2 2.00.  The best I could do was have it load the drivers, to where I could setup and ping the loopback, but the route command crashes the system, and any of the commands simply refuse to run.  Not being able to run 32bit OS/2 applications greatly reduces the usability of the system, and falls further to the OS/2 trap that it really just excels at running MS-DOS apps.

It was a bit of a surprise to find out that even though Citrix had their source license through Microsoft, the 2.0 components turned out to be the upstream components from IBM.  Just as the included Qbasic is the IBM version, along with the other components.  The terminal support is naturally more robust than version 1, although I think the larger problem I had trying to run OS/2 programs it that many terminals are hard coded for 24 lines, and I don’t think you can change that in Citrix.  And it does mention that if you do try to run on a 24 line terminal that DOS won’t run.

Much like 1.0, all the administration is done via text tools.  It feels weird at first as even on the console there doesn’t seem to be any mouse integration, although the installer does ask if you do have a mouse on the system.

And like 1.0 there is no Presentation Manager, so no graphics on the console.  HOWEVER you can run MS-DOS graphical stuff on the console. Although today I have no real need for it, but I went ahead and setup the included Windows support.

Windows for OS/2

What is interesting is that you are expected to supply your own retail version of Windows 3.00, and Citrix has some updated drivers, along with OS2K286.EXE, and updated program manager, control panel, and print manager.  While IBM included a full copy of Windows 3.00 at this point, this feels like the beginning of OS/2 for Windows – AKA the Borg.

Going Multiuser

First I just setup a COM port on Bochs to Listen on port 8880.  Unfortunately this isn’t resilient, as Bochs will wait for a connect before actually starting, and if you drop off, it won’t let you connect back in.

com1: enabled=1, mode=socket-server, dev=localhost:8880

And then it’s a matter of running CFGTERM, and adding in the Async module.

Citrix add in Async

With the module added you then just have to assign a port.

ICA profile

I didnt’ do anything special other than telling Citrix that there is no modem, it’s a direct connect, and to use the ICA terminal profile.

Using the Citrix MultiLink program, and DOSBox I was able to add an ICA terminal.  On DOSBox I had to specify a modem with an IRQ in the config like this:

serial2=modem irq3 listenport:5001

CML modem settings

In the modem settings I had to set this to Forced connect, otherwise it’ll never see the server.

CML dialup profile

And here is how I ‘called’ the Bochs VM.  And then after ‘dialing’ in Bochs will start up the Citrix VM, and then you’ll get the simple Login prompt.  Login and you’ll get pselect.

Logging in to Pselect

Pselect the the text based UI tool to get around your OS/2 sessions.  It’s a little cumbersome at first, but once you get used to it, it’s just like OS/2 1.0 … Or Multiuser 1.0 for that matter, nothing really changed, except you can start MS-DOS Sessions now.

MS-DOS over the serial port

And yes, you can run Qbasic.  But you can’t do anything graphical. Not even DooM.  Although after loading the VDPMI device driver, DooM v1.1 will run, but then it’ll give you this fun error:

No graphics over the serial line

And that is where I’m going to have to leave this adventure for now.  If you are so inclined, you can pick it up on archive.org.

AT&T 3B2 400 emulated

This is super awesome!

AT&T 3B2 SYSTEM CONFIGURATION:

Memory size: 4 Megabytes
System Peripherals:

        Device Name        Subdevices           Extended Subdevices

        SBD
                        Floppy Disk
                        72 Megabyte Disk

        Welcome!
This machine has to be set up by you.  When you see the "login" message type
                                setup
followed by the RETURN key.  This will start a procedure that leads you through
those things that should be done the "first time" the machine is used.

The system is ready.

Console Login:

Back in the 1980’s AT&T shifted UNIX from being an internal research project that got somewhat popular in college spaces (and larger companies, General Motors was an early UNIX adapter, along with companies like Industrial Light and Magic).  Quickly after the divestiture of 1984, AT&T entered the commercial space with it’s own custom machines & their home made UNIX operating system.  Below is one of the ads they ran in 1984, touting their so called ‘super microcomputers’, featuring the 3B2, the 3B5, and the AT&T Personal Computer.

Thew new computers from AT&T

And indeed for many a government institute bewildered by the dozens of UNIX vendors, standards, and chaos of different platforms and processors many were all to happy to buy AT&T UNIX on AT&T machines.

And indeed this was my first experience with genuine SYSV Unix.

And I hated it.

Initially I had been thrown at an English computer lab because I knew how logon and do my work in style & diction, they decided I could help.  The system was aging and had major problems, as some prior students had figured out enough of the link kit that they would put their own attempts at re-writing portions of the kernel into the system, and it’d break.  Naturally the original installation diskettes were lost, and the best that could be done was basically shut it down throughout the day and run the disk repair utilities.  It was not a fun job.

Later on the 3B2’s were thrown into the ‘common garbage’ aka free kit for other departments, and the 3B2’s re-appeared at the next place I was volunteering at on campus.  However in addition to the two machines, there was a few other boxes of manuals, and oddly enough the installation diskettes.  And also about a dozen of these AT&T ISA Starlan adapters.  These weren’t the ones that were basically Ethernet (Starlan10) but rather the original ones.

Through some incredible luck we did find an NDIS 3 MS-DOS driver for the Starlan car, and we were able to cobble together a Starlan1 LAN consisting of a 3B2 that we cannibalized the RAM and disks from one of them to make a ‘super’ 3B2, with added TCP/IP software and a massively cut down port I did of samba to turn it into a tiny file & print server (72MB MFM disks were it’s biggest if I recall), along with Windows 95 clients.  And of course with a TCP/IP lan we could easily load a proxy server (WinGate?) on one machine with the 56kb modem, and now we all had internet access.  I know it’s sad today, but trust me back then it was “a big deal” that we had a fully functional LAN.

Over on loomcom.com there is an incredible amount of information about the reverse engineered WE32100, along with the 3B2 hardware, and of course information about the newest SIMH simulator the 3B2/400!

Instructions and disk images on the site made it incredibly easy to grab the latest SIMH Windows Development binaries, and get my own virtual 3B2 up and running in minutes! So naturally I pasted in dhrystone.c to see if it’d work.  And that was the first weird issue is that the backspace is the pound # key.  So all the C macro definitions lost their # sign.  I added them in vi without full terminal support because I’m crazy and:

# uname -a
unix unix 3.2 2 3B2
# ./dhrystone
Dhrystone(1.0) time for 500000 passes = 40
This machine benchmarks at 12500 dhrystones/second

Obviously this is 100% bogus, as the real machine should get around 735, and I didn’t even bother with the -O flag.

The current emulator doesn’t do any additional serial ports, nor any Ethernet adapters.  So you only get a console.  But with the pre-installed C compiler image, I was able to build a trivial file just fine.  Although pasting on the console really leaves a lot to be desired.

SDF AT&T 3B2/500 UNIX System

I know for some of us old people the 3B2 hid in the corners of our call centres, running our AT&T Definity switches, our voicemail, and even some of our early ISPs.  After funneling money into SUN to get them to work on SYSVr4 which was the grand unification of BSD + SYSV AT&T’s interest if UNIX quickly waned, and they divested themselves of UNIX, and eventually all PC hardware, although they did re-enter the PC space a few times before exiting yet again.

As time would tell, proprietary hardware + a previously ‘open’ operating system were not the winning combination.  And so far the only UNIX vendor to weather the Linux storm so far is IBM with it’s A/IX.

IRC necromancy

I’m xorhash, a guest poster, here to talk about my tale going down a trip on the memory lane with QuakeNet’s service bot Q. If you’re not interested in IRC, you can probably skip this one.

On the Trails of Q

As far as I know, QuakeNet’s service bot Q went through these three major codebases:

a. the old Perl Q,
b. the first version written in C, and
c. Q as part of newserv.

There’s a reason I didn’t have anything to link for (a). That’s because to the best of my knowledge and research, no version has survived these past decades.

As for (b), it seems only the linked version 3.99 from the year 2003 was saved.
The CVS repository and thus commit history has been lost.

If anyone has either actual code for the old Perl Q or the CVS repo for the old
Q written in C, please reach out to me via `xorhash ++at++ protonmail.com’.
I’m most interested in looking through it.

However, not all hope was lost with the old Perl Q. As it turns out, most likely, the old Perl Q was actually based on an off-the-shelf product called “CServe”. What makes me think so?

Let’s take a look at [the QuakeNet Q command listing from 1998.

I picked the command “WHOIS” and googled its use “Will calculate a nick!user@host mask for you from the whois information of this nick.” This lead me to a help file for StarLink IRC. At the top, it reads:

CStar3.x User Command Help File **** 09/10/99
Information extracted from CServe Channel Service
Version 2.0 and up Copyright (c)1997 by Michael Dabrowski
Help Text (c)1997 (c)1997 StarLink-IRC (with permission)

Wait a second, “CServe Channel Service”? I know that from somewhere.

[email protected]

So the commands between that help file and the QuakeNet Q command listing match up and so does Q’s host today. Most likely, I’m on the right track with this. What’s left is to track down a copy of CServe.

Note: I’ve been on the old Perl Q for a while and this strategy didn’t use to work. It seems Google newly indexed these pages. For once I can sincerely say: Thank you, Google.

I found that CServe was hosted on these websites:

a. Version 3.0 on http://www.cs.cuc.edu/~mdabrows/cserve/,
b. Version 3.1 on http://www.wam.umd.edu/~devy/cserve/,
c. Version 4.0 on http://www.othernet.org/devon/cserve/, and
d. Version 5.0 and above on http://www.ircore.com/.

The only surviving versions are 3.0 and 5.1. CServe got renamed to “CS” starting with 5.0 and was rewritten in C by someone other than the original CServe author, going by the comments in the file header of CS5.1 `src/show_access.c’. CS was actually sold as a commercial product. I wonder how many people bought it.

QuakeNet most likely took a version between 2.0 and 4.0, inclusive, as the basis for the old Perl Q. Which one in particular it was, we may never know. If you have any details, please reach out to me at the e-mail address above.

I can’t make any clever guesses anyway since the only versions that the web archive has are 3.0 and 5.1. The latter is written in C, so it quite obviously can’t be the old Perl Q.

Making It Run

So now that I have CServe 3.0, I wanted to actually see it running.

There are three ways to reasonably accomplish this:

a. port CServe to a modern IRCd’s server-to-server protocol,
b. port an old IRCd to a modern platform,
c. emulate an old platform and run both IRCd and CServe there.

I chose option (b).
Once upon a time, I did option (a) for the old UnderNet X bot. It was a very painful exercise to port a bot that predates the concept of UIDs (or numeric nicks/numnicks as ircu’s P10 server-to-server protocol calls them). There’s nothing too exciting about doing (c) by just emulating a 486 or so and FreeBSD, just sounds like a boring roundtrip of emulation and network bridging.

Fortunately, the author was a nice person and wrote on the CServe website that version 3.0 requires “ircu2.9.32 and above”.

It seems the ircu2.10 series followed right after ircu2.9.32. While I’m sure there’s some linking backwards compatibility, determining which ircu in the ircu2.10 series still spoke enough P09 to link with CServe sounded like an exercise in boring excruciating pain. Modern-day ircu most certainly no longer speaks P09. Besides, what’s the fun in just doing the manual equivalent of `git bisect’?

So after grabbing ircu2.9.32, I tried to just straightforward compile and run it.

There’s a `Config’ script that’s supposed to be kind of like autoconf `configure’, but I’ve found it extremely non-deterministic. It generates `include/setup.h’. I’ve made a diff for your convenience. It targets Debian stable, and should work with any reasonably modern Linux. There are special `#ifdef’ branches for  FreeBSD/NetBSD in the code. This patchset may break for BSDs in general.

Do not touch `Config’, meddle with `include/setup.h’ manually. Remember this is an ancient IRCd, there are actual tunables in `include/config.h’.

The included example configuration file is correct for the most part, but the documentation on U:lines is wrong. U:lines do what modern-day U:lines do, i.e., designate services servers with uber privileges.

U:cserve.mynetwork.example:*:*

Excuse Me, But What The Fuck?

Of course, I’m dealing with old code. It wouldn’t be old code if I didn’t have some things that just make me go “Excuse me, but what the fuck?”

Looping at the speed of light

aClient *find_match_server(mask)
char *mask;
{
  aClient *acptr;
  if (BadPtr(mask))
    return NULL;
  for (acptr = client, (void)collapse(mask); acptr; acptr = acptr->next) 
  {
  if (!IsServer(acptr) && !IsMe(acptr))
    continue;
    if (!match(mask, acptr->name))
      break;                                                                                                    continue;
  }
  return acptr;
}

See that `continue’ way on the left? What is it doing there? Telling the compiler to loop faster?

Carol of the Old Varargs

So apparently some of this code predates C89. Which means it uses old-style declarations, but that’s okay. It also uses old-style varargs, which is adorable.

The hacks around not even that being there are adorable, too:

#ifndefUSE_VARARGS
/*VARARGS*/
voidsendto_realops(pattern, p1, p2, p3, p4, p5, p6, p7)
char*pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7;
{
#else
voidsendto_realops(pattern, va_alist)
char*pattern;
va_dcl
{
  va_list vl;
#endif
  Reg1 aClient *cptr;
  Reg2 int i;
  char fmt[1024];
  Reg3 char *fmt_target;

#ifdef USE_VARARGS
  va_start(vl);
#endif

  (void)sprintf(fmt, ":%s NOTICE ", me.name);
  fmt_target = &fmt[strlen(fmt)];

  for (i = 0; i <= highest_fd; i++)
if ((cptr = local[i]) && IsOper(cptr))
  {
  strcpy(fmt_target, cptr->name);
  strcat(fmt_target, " :*** Notice -- ");
  strcat(fmt_target, pattern);
  #ifdef USE_VARARGS
  vsendto_one(cptr, fmt, vl);
  #else
  sendto_one(cptr, fmt, p1, p2, p3, p4, p5, p6, p7);
  #endif
  }
#ifdef USE_VARARGS
va_end(vl);
#endif
return;
}

These functions were declared like this (the example chosen above actually has
no declaration because why not):

/*VARARGS1*/
extern    void    sendto_ops();

Whatcmp

There are `mycmp’ and `myncmp’ for doing RFC1459 casemapping string comparisons. `strcasecmp’ got `#define’d to `mycmp’, but in one case `mycmp’ got `#define’d back to `strcasecmp’. It seemed easier to just remove `mycmp’, replacing it with `strcasecmp’ and forgo RFC1459 casemapping. This is doubly useful because CServe doesn’t actually honor RFC1459 casemapping.

Waiting for the Cookie

ircu uses PING cookies. I was rather confused when I didn’t get one immediately after sending `NICK’ and `USER’. In fact, it took so long that I thought the IRCd got stuck in a deadloop somewhere. That would’ve been a disaster since the last thing I wanted to do is get up close and personal with the networking stack.

As it turns out, it can’t send the cookie:

/*
 * Nasty.  Cant allow any other reads from client fd while we're
 * waiting on the authfd to return a full valid string.  Use the
 * client's input buffer to buffer the authd reply.
 * Oh. this is needed because an authd reply may come back in more
 * than 1 read! -avalon
 */

Nasty indeed.

I lowered `CONNECTTIMEOUT’ to 10 in the diff linked above. This makes the wait noticeably shorter when you aren’t running an identd.

CServe Isn’t Much Better

Not that CServe is much better. I have to hand it to Perl, I only needed to undo the triple-`undef’ on line 450 of `cserve.pl’ and it worked with no modifications. God bless the backwards compatibility of Perl 5.

That said, it has its own interesting ideas of code. This is the main command execution:

foreach $i (keys %commands)
{
    if($com eq $i)
    { $found = 1; break; }
}
if($found == 1)
{
    open(COMMAND, "<./include/$com");
    @evalstring = ; close(COMMAND);
    foreach $i (@evalstring) { $evals .= $i; }
    eval($evals);
}
else
{
    ¬ice("2No such command 1[4$com1]. /msg $unick SHOWCOMMANDS\n");
}

Yep, it opens, reads into an array, closes and then evals. For every command it recognizes. Of course, this means code hot swapping, but it also means terrible performance with any non-trivial amount of users.

Oh, and all passwords are hashed. But they’re hashed with `crypt()’. And a never-changing salt of ZZ.

End Result

up & running

Was it worth it?
No, not really.
Would I do it again?
Absolutely.

You probably do not want to expose this to the outside world.
The IRCd code is scary in all the wrong ways.

Further Links

Some other things if you’re into ancient IRC stuff:

Installing and using Citrix Multiuser v1.0 on BOCHS

Print Ad

Back in the late 80’s when OS/2 was starting to get some traction Ed Iacobucci took a team and split off from the mainline Microsoft / IBM alliance, and with Microsoft’s blessing (and source code) took OS/2 and took up the challenge that both IBM & Microsoft dropped that was the ultimate challenge to UNIX, the ability to host multiple users on the same machine.  Citrix had it’s start some time in 1989 (Don’t forget that NT OS/2 had it’s start in 1988), and back then LANs were still seen as super expensive, just as TCP/IP was a university / military protocol that even enterprise to small businesses were hooked on either NetBEUI or IPX/SPX, if they had any LAN at all.

Sneakernet was king in this era, just as the BBS was our connected world.

As this ancient promotional video shows, the product they were chasing was low end Unix market, oddly enough their larger competition being SCO Xenix, which itself was separated out from Microsoft.

While I’m waiting for a 5 1/4″ disk, I thought I’d take a crack at installing Citrix Multiuser version 1.0 that had surfaced a while back.

I’m using this as a template for a config.  Naturally to boot floppy image it’ll need a change.

megs: 16
romimage: file=bios/BIOS-bochs-latest
vgaromimage: file=bios/VGABIOS-elpin-2.40
floppya: type=1_2
floppyb: type=1_44
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path=”citrix500.img”, cylinders=1023, heads=16, spt=63
ata1: enabled=0
ata2: enabled=0
ata3: enabled=0
boot: c
log: bochsout.txt
mouse: enabled=0
debug: action=ignore
mouse: enabled=0
private_colormap: enabled=0
floppy_bootsig_check: disabled=0
com1: enabled=1, mode=socket-server, dev=localhost:8880
com2: enabled=0, mode=socket-server, dev=localhost:8881
com3: enabled=0, mode=socket-server, dev=localhost:8882
com4: enabled=0, mode=socket-server, dev=localhost:8883
parport1: enabled=1 , file=”print.txt”
parport2: enabled=0
ne2k: ioaddr=0x320,irq=10, mac=fe:fd:00:00:00:01, ethmod=null
sb16: enabled=0
usb_uhci: enabled=0
port_e9_hack: enabled=0
clock: sync=none,time0=691148400

But that’ll do it.

Citrix has many 386 hooks in place.  After applying the CSD MU01091 I saw this in the readme:

MULTIUSER is designed to take advantage of the 386/486 instruction set where possible. Because of this Citrix MULTIUSER runs only on 386 compatible processors. You can take advantage of this fact to boost performance of your application while running on MULTIUSER.

The compilers available for MS OS/2 generally supply library functions which will execute on both 286 and 386 processors because MS OS/2 will run on these. Unfortunately, this prevents natural optimization for the 386 32-bit environment. However, we have found that it is a simple matter to boost performance by replacing some of your compiler runtime library routines. For example, if your application makes heavy use of long arithmetic, you can modify the multiply and divide runtime functions to use the explicit 32-bit multiply and divide instructions available on the 386 and 486 processors, thereby avoiding the 32-bit arithmetic emulation.

Many compilers such as Microsoft C 6.0 make available the source to the runtime library. Microsoft C 6.0, as an example, also provides instructions and make-files for rebuilding the libraries.

The Citrix Support Bulletin Board has further information on these techniques, along with specific code examples that you can tailor to your specific needs.

I’ll have to ask people smarter than me about finding any of this information.

Anyways Citrix requires that you install it onto a HPFS partition.  Citrix uses the Microsoft OS/2 1.21 kernel + base level for the OS.  After installing and running syslevel on both they report the same level.

MS OS/2 Base Operating System
Standard Edition 1.21 Component ID
Current CSD level: XR04072
Prior CSD level: XR00000

However the kernel naturally is different as this does support multiple users.  By default Citrix is setup for async terminals, and as far as I can find there was no actual LAN connection product available.  This is just simply the most common setup of the era, where UNIX was typically deployed with async terminals, and with remote users on dialup.  The Citrix media I have is dated from January 25th, 1991.  Although according to the ‘official timeline (pdf)‘  version 1.0 was released in 1990.  This was just after the protected mode version of Windows was demo’d to Bill Gates & Steve Balmer, which incentivized  Microsoft to dump OS/2 for Windows.  This put Citrix in a bad position as they had setup their product strategy around the next generation OS from Microsoft which had for all intents and purposes had been made obsolete overnight.  And as the Windows 3.0 juggernaut picked up steam selling over 4 million copies, while all previous versions of Windows combined were only in the neighborhood of 2 million copies.  As far as I’m aware, none of the OS/2 1.x sales numbers were ever released.

Citrix 1.0 is limited to OS/2 1.2 character mode executables.  And there simply isn’t that many.  And with the industry moving to the aforementioned graphical Windows 3.0 applications Citrix hit the market with a thud.  Citrix provides support for the following applications:

  • Borland Paradox 2.0
  • California Software Products BABY/4XX
  • DataEase SQL
  • Data Access DataFlex
  • IBM DisplayWrite 4/2
  • IBM Platinum Series 2.0
  • Irwin EzTape OS/2 Tape Backup Software
  • Lotus 1-2-3 Release 3.0
  • Maynard MaynStream OS/2 Tape Backup Software
  • Micro Focus Cobol/2 Workbench
  • Microrim R:Base 3.1
  • Microsoft BASIC Version 7.0
  • Microsoft C Version 6.0
  • Microsoft LAN Manager 2.0
  • Microsoft Word 5.0
  • Microsoft SQL Server
  • Novell NetWare Requester for OS/2 V1.3
  • Oracle 6.0
  • Word Perfect 5.0

As you can see, this isn’t a very large list.

Citrix multiuser 1.0 config program

There is a text panel/menu driven config program.  This greatly simplifies tasks.  I setup a simple system with a single com port, although Bochs doesn’t do anything sophisticated like modem emulation but rather you can connect ONCE to the VM, and that is is.  But it’s enough to launch HyperTerminal to get a serial connection.

Serial Terminal

The serial support on Citrix is pretty good as long as you have updated to CSD MU01091 which adds support for VT100/VT220 terminals.  With a tiny cheat sheet it’s not too hard to get used to the multitasking capabilities of Citrix/MS-OS/2

Hotkeys:
Login switch . . . . . . . . [{ctrl}{u} ]
Session switch . . . . . . . [{ctrl}{n} ]
Session direct . . . . . . . [{ctrl}{f} ]
Session create . . . . . . . [{ctrl}{o} ]
Reset terminal . . . . . . . [{ctrl}{y} ]
Print screen . . . . . . . . [{ctrl}{]} ]
Print screen toggle . . . . [{ctrl}{\} ]
Ctrl+Break . . . . . . . . . [{ctrl}{c} ]
Ctrl+C . . . . . . . . . . . [{ctrl}{c} ]

I can really see the value at the time of Citrix, although again it really arrived just too late to the market.  I’ll have to track down more of these ‘approved’ programs, and give them a shot.

It’s funny how the market can pivot where something that was seen as a defining feature of midrange OS’s in this case being multiuser became irrelevant as CPU prices dropped to the point where not only can individual users cheaply obtain their own processor, let alone own multiple which is typical today.  While Citrix was chasing the ‘killer feature’ of UNIX being able to host multiple users on a single ‘larger’ machine, the industry rather prefered to host server applications on cheaper ‘large’ PC’s, ala MS SQL Server, SNA Server, and Exchange Server.  With absolutely no data to back anything up, I suspect that SQL Server 4.21a may have moved more copies than Citrix 1.0.  If not I can gaurentee that SQL Server 6.0 sure did.

That said once, Citrix re-tooled their ICA offering onto Windows NT 3.51 they could reach their niche market of hosted applications in a data center.  And obviously taking over Xen, and jumping onto the virtualization market was a good move to keep relevant, especially how Microsoft had twisted their arm during the Windows NT 4.0 transition.

Everyone is going nuts over the CompuServe forum shutdown.

Honestly it looks like most of it was long since destroyed.

What’s left on the Compuserve forums

As you can see, not a heck of a lot there.  I didn’t even know they were kept around, but rather I had a feeling that they were part of those big ‘wise’ investments where companies pay an insane amount of money for old tech companies, and promptly shut them down.

Compuserve is owned by AOL, who in turn along with Yahoo! was bought by Oath: a division of Verizon.  And what is interesting there?

Yep, they are indeed moving everything they have bought to OpenStack, and killing everything else that can’t easily make the jump.  From someone who works in the field I know that the people who sign checques always are more interested in new and exciting than anything old, associated with older companies, and older executives that have either moved on or out of the way creating that power vacuum that jr’s crave.  And in that bussle it’s time to kill the old.

Too bad it’s never preserved, nor do they honestly ever care about the brands they spend so much money on removing from the market to remove any chance of resurgence in competition.

Personally I’d just see it as a waste of time and effort, all this buying and shutting down. All it tells me is that Verizon knows that it fundamentally can’t create a messenger that could rival AOL instant messenger, nor could they run a communications forum longer than Compuserve so their only way to clear the space and remove any doubt is to spend billions to shut down zombie corporations who have been doing their best to destroy themselves for the past 20 years.

Look no further than AOL’s own acquisition of broadcast.com, and how within the space of 3 years AOL took it from a company to simply paying 5.7 Billion USD for a $9.95 domain name.