I Thought I Found a Bug…

So I was working on improving a DOS emulator, when I found that something seemingly trivial wasn’t working right when COMMAND.COM was asked to do the following:

echo AB> foo.txt
echo CD>> foo.txt

Instead of ABCD, foo.txt contained ABBC.

I verified that yes, the right data was being passed to fwrite(), with the big caveat that what COMMAND.COM was doing wasn’t quite as straightforward as one might think:

  • Open foo.txt
  • Write ‘AB’
  • Close foo.txt
  • Open foo.txt
  • Seek one byte backward from the end of the file
  • Read one byte
  • Write ‘CD’
  • Close foo.txt

The reason for the complexity is that COMMAND.COM tries to deal with a case that the file ends with a Ctrl-Z character (which wasn’t the case for me), and if so, the Ctrl-Z needs to be deleted. Somehow the seek/read/write sequence was confusing things. But why?

Continue reading
Posted in Bugs, C, Development, Watcom | 14 Comments

DOS APPEND

For a long time, I couldn’t quite grasp what the DOS APPEND command could possibly be good for. Until I came across a situation which APPEND was made for.

When I worked on organizing and building the DOS 2.11 source code, I tried to place the source files in a tree structure similar to that used by DOS 3.x (this is known from DOS 3.x OAKs):

C:.
└───src
├───bios
├───cmd
│ ├───chkdsk
│ ├───command
│ ├───debug
│ ├───diskcopy
│ ├───edlin
│ ├───exe2bin
│ ├───fc
│ ├───find
│ ├───format
│ ├───more
│ ├───print
│ ├───recover
│ ├───sort
│ └───sys
├───dos
├───inc
└───msdos

The inc subdirectory unsurprisingly contains shared include files such as DOSSYM.ASM, which are included just about from everywhere. No problem, right?

Except… to get output that most closely matches existing DOS 2.x binaries, it is necessary to use an old version of MASM (version 1.25 seems to do the trick). But MASM 1.25 is designed to run on top of DOS 1.x, and knows nothing whatsoever about directories.

It is possible that back in the day, DOS 2.x was built from a single huge directory on a hard disk. In fact it is known that DOS 2.0 could not be built on PCs at all, and was built on DEC mainframes. Yet DOS 2.11 was also clearly modified such that it could be build on PCs using Microsoft’s development tools.

However it was done back in 1983, lumping 150+ assembler source files into a single directory, and then adding hundreds of object and executable files, did not sound at all appealing. Cloning DOSSYM.ASM to every directory where it was needed seemed even worse.

That’s when I somehow remembered that APPEND exists, and realized that it’s the perfect solution to the problem. Before building, one can run

APPEND ..\..\INC;..\INC

and the inc directory becomes accessible from all of its sibling subdirectories and from subdirectories one level deeper. It would have been possible to use an absolute path as well, but this way the build batch file does not need to know where it lives.

With APPEND in place, the old MASM 1.25 which uses FCB I/O will find the centrally located include files, and the source code can be organized into a neat hierarchical structure that’s far easier to work with than one giant blob.

Continue reading
Posted in DOS, IBM | 34 Comments

Stack Checking on OS/2

A while ago I was involved in debugging a seemingly simple yet mysterious problem:

That error message should not have been there

A piece of code (a fairly simple interface DLL) built with the Open Watcom compiler was failing with a bogus stack overflow error. The mystery was that this failure only happened on OS/2 Warp Connect. It didn’t happen on OS/2 2.0 or Warp Server for e-Business (WSeB) or MCP2. And it also didn’t happen on Warp Connect updated to FixPack 40.

That’s weird, right? And getting to the bottom of the faulty stack check was a bit of a journey…

Continue reading
Posted in Debugging, Development, OS/2, Watcom | Leave a comment

Programming NetBIOS on OS/2

Recently I spent some time trying to understand a piece of networking code, and it turned out to be far more difficult than it should have been. The code in question is the NetBIOS interface of C-Kermit and was originally written in the early 1990s.

The module uses two very similar but not identical code paths. The comments suggest that one alternative, using ACSNETB.DLL, is the “Traditional NetBios interface” used by IBM’s LAN Adapter and Protocol Support (aka LAPS), OS/2 Extended Services, and Communications Manager/2. The other code path uses NETAPI.DLL and it’s called “Newer Netbeui Interface”, used by the Microsoft LAN Manager Requester, IBM LAN Server Requester, and Novell Netware Requester. The comments are wrong, but more about that below.

The API used by NETAPI.DLL is documented in the Microsoft LAN Manager programming reference. It consists of four functions: NetBiosEnum, NetBiosOpen, NetBiosSubmit, and NetBiosClose. The NetBiosSubmit function takes an NCB (Network Control Block) as input, except the NCB usage is left more or less completely undocumented by Microsoft.

The LAN Manager document points programmers curious about NCBs to the “IBM PC-NET Technical Reference”, “IBM PC LAN Technical Reference”, and “IBM PC-LAN Technical Reference”, all in the same Microsoft manual. (Which is exactly why IBMers considered Microsoft sloppy and undisciplined.)

My initial search for programming the ACSNETB.DLL interface turned up nothing. I could not find anything in the Communications Manager manuals, or in the MPTS documentation, or really anywhere one would normally find OS/2 programming information. Because it’s not there.

Continue reading
Posted in Development, Documentation, IBM, Microsoft, Novell, OS/2 | 12 Comments

OS/2 TCPBEUI Name Resolution

Sometimes I have the following problem to deal with: An OS/2 system uses NetBIOS over TCP/IP (aka TCPBEUI) and should communicate with a SMB server (likewise using TCPBEUI) on a different subnet. This does not work on OS/2 out of the box without a little bit of help.

History and Technology

NETBIOS (originally literally the ROM BIOS on the 1984 IBM PC Network adapter) was designed to work on a LAN, specifically a single LAN segment. There is no need for centralized infrastructure, workstations can come and go. This makes using ad hoc networks very easy and does not require additional dedicated infrastructure and administration.

When NETBIOS (or NetBIOS) moved to Ethernet, there were initially many different ways of implementing it. Eventually the world settled on NetBIOS Frames aka NBF.

But in the 1980s, there was also a parallel effort to move NetBIOS on top of TCP/IP, eventually standardized as RFC 1001 and RFC 1002 (both dated March 1987). This effort was originally driven by non-PC platforms, but soon enough DOS-based (e.g. HP ARPA Services circa 1990, PC/FTP likely earlier) and OS/2-based (MS LAN Manager 2.1 in 1991) implementations of NetBIOS over TCP/IP became available.

As mentioned above, classic NETBEUI (whether using the original IBM PC Network Adapter, Token Ring NETBEUI, the NBF protocol, or some other variant of NetBIOS over Ethernet) always resolves names using broadcasts. When a workstation (i.e. a NetBIOS application running on that workstation) looks for a NetBIOS “name”, it uses a broadcast to find out the network address of the machine which owns that name; this is not unlike ARP.

Continue reading
Posted in IBM, Networking, OS/2, TCP/IP | 49 Comments

IBM PC 5150 Model Numbers

Recently I came across a minor mystery—the model numbers of the original IBM PC. For such a pivotal product, there is remarkably little detailed original information from the early days.

When IBM started selling the PC, it used two methods to identify various items. The vast majority of peripherals and accessories used a seven-digit part number; for example the original CGA was part number 1504910.

The system unit itself was Type 5150 (the PC; 5160 was the XT), and the type designation was extended with a three-digit model number, such as 5150-013. The same scheme was used for “big ticket” peripherals that were not necessarily tied to the PC. For example the original monochrome monitor was designated as 5151-001 and the printer as 5152-001 (the color monitor was Type 5153 and so on).

For monitors and printers, the three-digit model number wasn’t all that meaningful as there often was only one model. But for the 5150 system unit, there were lots of different models.

Now, the problem is that there appears to be no official documentation whatsoever from the old PC days that would list the model numbers with clear specifications.

Continue reading
Posted in IBM, PC hardware, PC history | 25 Comments

OS/2 2.0 Commitments

Last week the OS/2 Museum received a rather interesting donation: a thick spiral bound document titled Third party commitment to IBM’s OS/2 Version 2.0, and labeled IBM COMDEX/SPRING ’92.

The binder is a collection of about 250 press releases that coincided with the release of OS/2 2.0 and also with the COMDEX trade show in early April 1992 (the press releases are dated April 6, 1992). The interesting thing is that each press release is printed on the respective company’s letterhead paper, using a wide range of paper weights and types; it is apparent that each company printed their own press release, mailed it to IBM, and then someone at IBM bound them into an official looking document. It is unclear how many copies of this document were made. There could conceivably be the only one copy in existence.

The document is a veritable who’s who of early 1990s PC world, predominantly software (Adobe, Attachmate, Borland, Citrix, Corel, Ingres, Lotus, Novell, SAP, Symantec, Watcom, WordPerfect, ZSoft) but also hardware (Accton, ATi, Cirrus Logic, Digital, Fujitsu, Intel, Logitech, Matrox, NCR, Racal-Datacom, Tseng). The companies range from one person operations (Hamilton Laboratories) to huge corporations. Only Microsoft was mysteriously missing.

For details, please refer to the scanned OS/2 2.0 third party commitment document.

Continue reading
Posted in IBM, Marketing, OS/2, PC history | 8 Comments

OS/2 2.11 SMP Woes

IBM OS/2 V2.11 for Symmetric Multiprocessing (OS/2 2.11 SMP) was released in mid-1994 in response to Windows NT and its SMP support. The package was nothing more (and nothing less) than OS/2 V2.11 with support for SMP hardware. It was intended primarily for server machines, not least because non-server SMP systems were nearly nonexistent in 1994.

OS/2 2.11 SMP was often shipped with high end servers, for example on IBM’s ServerGuide or Compaq’s SmartStart CD-ROMs (alongside Novell NetWare, SCO OpenServer, etc.). But a generic OS/2 2.11 SMP package had not been seen in the wild… until it appeared relatively recently (2020).

The included photos suggest that there was some kind of shrinkwrapped OS/2 2.11 SMP package, although in the absence of an actual box it’s hard to be sure. It is still unclear how exactly generic OS/2 2.11 SMP was sold and supported—although fixes for OS/2 2.11 SMP did exist, they do not appear to have been distributed through the usual public channels.

Knowing that OS/2 Warp Server Advanced SMP and Warp Server for e-Business work well enough, I thought I’d try OS/2 2.11 SMP in VirtualBox. Only that turned out to be much less than straightforward.

Continue reading
Posted in IBM, OS/2, PC history, SMP | 31 Comments

Digging Into OS/2 2.0

The other day I had a “pressing” need to obtain the list of modules loaded in an OS/2 VM by examining the VM’s memory and CPU state. I was able to use existing code that worked on OS/2 V3.0 (Warp) and later. But the logic failed on OS/2 V2.11 and earlier.

I pulled out the trusty old OS/2 Debugging Handbook, Volume IV, which provides an excellent reference of internal OS/2 structures. I quickly established that although the overall architecture is the same, OS/2 V2.11 used a slightly different format of the MTE (Module Table Entry) structure in memory. Adjusting for the difference made the module discovery code work in OS/2 V2.1 and V2.11.

But not in OS/2 V2.0. I could tell that the layout of the SAS (System Anchor Segment) must be different between OS/2 V2.0 and V2.1. Only the OS/2 Debugging Handbook has nothing to say about OS/2 V2.0 at all—it talks only about V2.1 and later.

I tried to find the SAS definition in header files, since SAS.H/SAS.INC was shipped with the OS/2 DDK. But I have no OS/2 V2.0 DDK, and the oldest DDK (1993) I could find clearly defines the SAS layout used in OS/2 V2.1 and later.

Continue reading
Posted in Debugging, Documentation, IBM, OS/2 | 21 Comments

Finally in Xsight

For a long time, I have tried to find a GUI environment running on SCO XENIX (because, honestly, what could be more useless?). Back in the day, meaning late 1980s and early 1990s, SCO sold Xsight, which was an adaptation of (at least initially) X11R3 to SCO’s XENIX and UNIX SVR3.2 operating systems. But Xsight has proven remarkably elusive.

SCO Xsight running on 386 XENIX 2.3.4

Various XENIX software like MS Word, SCO’s Lyrix, FoxBase+, random Microsoft compilers and SCO development kits, even TCP/IP, has been floating around for years.

The recent warez megadump turned out to include something probably even rarer, a Xsight development kit… but not Xsight itself!

Just recently I found an old set of warez CDs from ancient China, which in fact did contain Xsight… but wouldn’t you know it, the one CD that had Xsight on it is missing from the set! That’s just not fair.

Continue reading
Posted in SCO, X11, Xenix | 21 Comments