IBM PC/AT 8042 Keyboard Controller Commands

Anyone trying to use the classic 8042-style keyboard controller (KBC) found in the IBM PC/AT and nearly all later PCs typically runs into a problem with lack of accurate documentation. The 8042 (or 8742, or any number of compatible parts built into later Super I/O chips) is actually quite well documented. The catch is that the 8042 is a programmable micro-controller with its own control software in (usually) ROM. Until recently, no one outside a few companies (IBM, AMI, Phoenix) knew exactly what the control software did.

IBM documented a number of commands the host can send to the KBC. It should be understood that all those commands are a pure software construct, with nothing about the 8042 hardware dictating that the commands need to follow any specific format, function, or that they even need to be there at all. Therefore understanding the 8042 ROM code is the only way towards understanding exactly what the commands are and what they do, with the caveat that different controllers may and do have somewhat different code in their ROM. Continue reading

Posted in PC architecture | 22 Comments

Detecting floppy drive presence and type

Detecting floppy drives is surprisingly tricky and poorly understood. The difficulty lies mainly in the interface between the floppy disk controller (FDC) and the actual drive(s). The interface isn’t particularly complex, but it isn’t straightforward, and it does not follow the intended design of the original NEC µPD765A FDC.

Many if not most operating systems do not even attempt to detect floppy drives and use the value configured by the user in the non-volatile CMOS memory. Even the excellent Undocumented PC (van Gilluwe) cops out and uses the BIOS to detect floppy drives. Yet a simple and reliable method for drive presence detection has been published in the mid-1980s, in the classic IBM PC/AT Technical Reference. Continue reading

Posted in BIOS, PC architecture | 1 Comment

DOS boot sector, BPB, and the media descriptor byte

All DOS programmers know that DOS storage media (floppies, fixed disks, even RAM drives) have a BPB (BIOS Parameter Block) which describes the basic layout of the storage medium. All DOS programmers also know that every DOS disk contains a boot sector with a 0x55, 0xAA signature in the last two bytes and the BPB stored at offset 3 and starting with an 8-byte OEM identifier. Sadly, it’s not true. There are DOS disks with no signature in the boot sector and no BPB stored in the boot sector. Even when there is a BPB, it’s not necessarily correct.

The basic problem with BPBs is that they were only introduced in DOS 2.0; previous versions of DOS did not use the concept at all. It’s easy to see why: DOS 1.0 only supported a single storage medium format (a single-sided 5¼” floppy with 40 tracks and 8 sector per track, 160KB total capacity). There was no real need to distinguish between various formats, although there was a way to do so through the media descriptor byte in the FAT. Continue reading

Posted in DOS | 1 Comment

Windows/386 2.01

The OS/2 museum recently obtained a boxed copy of the original Microsoft Windows/386. That is, version 2.01 of Windows/386 from September 1987.

Windows/386 was Microsoft’s first product utilizing the 386 hardware in the DOS world. Microsoft was involved in the port of XENIX to the 386, but that was an entirely different product with a tiny market share. Continue reading

Posted in PC history, Windows | 48 Comments

DOS Memory, Managers & Extenders, Part I

To understand why the maddeningly complex world of DOS memory managers and extenders came to be, it’s necessary to understand the evolution of the PC platform. Even though memory managers and DOS extenders reached their peak on 32-bit 386 and later systems, the foundation for their existence was laid with the original IBM PC.

To recap, the IBM PC, released in 1981, was built around the Intel 8088 chip. The PC was designed as a short-lived stopgap product and was meant to be simple and cheap, rather than extensible and future-proof. Of course it was exactly the low price and relative simplicity that made the PC into a major force, taking everyone–including IBM–by surprise.

Continue reading
Posted in DOS, PC architecture, PC history, x86 | 27 Comments

The IHC Damage

Trying to sort through a heap of floppy images recently, I found many of them to contain a suspicious ‘IHC’ signature in their boot sector in the location where an OEM identifier (such as ‘IBM  3.3’ or ‘MSDOS5.0’ would normally be. I first suspected a virus, but it turned out to be something worse — a testament to the ubiquity of Windows 9x and the idiocy of its developers.

The ‘IHC’ signature is most likely the first three letters of ‘CHICAGO’ (codename of Windows 95) in reverse order. Windows 9x by default rewrites the OEM identifier in the boot sector of every floppy disk that it accesses, even if the access is something as simple as listing directory contents. Continue reading

Posted in DOS, Windows, Windows 95 | 5 Comments

Interrupt 68h and EMM386

While working with a modified BIOS image in a virtual machine, I ran into mysterious hangs when trying to load an old version of EMM386.SYS from MS-DOS 4.01. A newer version of EMM386 did not exhibit the problem.

A quick debugging session showed that the culprit was an uninitialized interrupt vector 68h. The BIOS POST left the vector as zeros; newer EMM386 versions verify that the vector is non-zero before calling through it. That explains why only the old EMM386 locked up, but it doesn’t explain what EMM386 was trying to do in the first place. Continue reading

Posted in BIOS, DOS, Virtualization | Leave a comment

Researching the history of PC computing

Finding out what happened in the world of PC computing 20 or 25 years ago isn’t always easy. The 1980s were over before the Internet took off, which means that most of the information was never publicly available in electronic form. Old print magazines ended up being pulped many years ago. People often forget what happened 20 years ago, and their recollections cannot be always entirely trusted.

However, there are other trends working against amnesia. Some old print media are being digitized and indexed. Sifting through the back issues of InfoWorld with the help of Google Books is infinitely more efficient than the methods which were actually available around 1990. Old floppies and CDs are likewise being archived in digital form. Developer releases of Windows from 1984 are now available on the Net, as well as early previews of Windows NT from 1991. At the time of their release, those materials were only available to a select few, often under strict non-disclosure agreements. Continue reading

Posted in PC history | 2 Comments

OS/2 2.0 Comdex Fall ’91

In October 1991, IBM brought an OS/2 2.0 pre-release (build 6.167) to the Fall Comdex in Las Vegas. This was a semi-official release of 32-bit OS/2, effectively a beta version, although it wasn’t called a beta. At the same Comdex, IBM also announced that the planned release date of OS/2 2.0 was the first quarter of 1992, a few months later than the previously expected 1991 release.

It is useful to note that October 1991 also was when Microsoft made available the first limited developer release of Windows NT, but the final public release of Windows NT 3.1 was still about 20 months away. At the Fall Comdex, Microsoft talked about releasing NT in the second half of 1992, but that turned out to be wildly unrealistic.

Continue reading
Posted in NT, OS/2 | 16 Comments

The floppy controller evolution

The floppy subsystem in PCs hadn’t mutated over time quite as much as, say, the hard disk subsystem, but prior to its extinction in the early 21st century, the floppy disk controller (FDC) did evolve noticeably.

In the original IBM PC (1981) and PC/XT (1983), the FDC was physically located on a separate diskette adapter card. The FDC itself was a NEC µPD765A or a compatible part, such as the Intel 8272A. It’s worth mentioning that nearly all floppy controllers supported up to four drives, but systems with more than two drives were extremely rare. The reason was that only two drives were supported per cable, while 99.99% of all systems only provided a single floppy cable connector.

The original FDC only supported two I/O ports: the read-only Main Status Register (MSR) and the Data Register, used for both reading and writing. The adapter card added another port, the Digital Output Register (DOR), used primarily for drive selection and controlling drive motors. Continue reading

Posted in PC architecture | 14 Comments