Who Knew What When

When Microsoft released the unique early beta build of Multitasking DOS 4, I quickly found out that it does not run in VirtualBox:

Erroring out, Hard

This was a bit of a surprise, because the more-or-less released versions of Multitasking DOS 4 from 1986 runs just fine.

As an aside, I originally thought that “Internal Error 4560” had some meaning… but it does not. 4560h is just the offset within the DOS kernel code segment where the failure is detected.

After digging deeper, a further surprise awaited me: The May 1984 beta does not work because it probably really shouldn’t.

It is very lucky that the beta came with partial source code for the BIOS module (IO.SYS). The source code makes it clear why it’s not working, and it’s not difficult to guess how that happened.

The Why

The reason why the beta build doesn’t work in VirtualBox is that it unconditionally programs the floppy controller (FDC) data rate to 250 kbps, but the data rate needs to be 300 kbps for a double-density floppy (360K) to work in a high-density drive (1.2M).

The reason for this is simple. Low density 5.25″ PC floppy drives spin the disks at 300 RPM, and MFM data is read and written using a 250 kbps data rate. However, the high-density 1.2M drives spin the media at 360 RPM, or 20% faster. To account for the change in RPM, the floppy controller also needs to operate 20% faster, at 300 kbps rather than 250 kbps.

The How

The PC and PC/XT floppy controller does not have a programmable data rate; there is only one rate, 250 kbps. The PC/AT FDC does have a programmable rate, and can choose between 250, 300, or 500 kbps.

Now the funny thing is that the IBM PC/AT was announced on August 14, 1984—but the Multitasking DOS 4 beta is several months older, from May 1984.

It is obvious (and unsurprising) that Microsoft had PC/AT prototypes in May 1984. It is also obvious that Multitasking DOS 4 ran on those prototypes. But… for whatever reason, the prototypes Microsoft used to run Multitasking DOS 4 only had low density floppy drives.

Here are the relevant excerpts from IBMDSK.ASM, which includes floppy driver code:

; Constants for floppy disk controller

Rate99= 000H ; Step rate 96tpi disk in 96tpi drive
Rate49= 001H ; Step rate 48tpi disk in 96tpi drive
Rate44= 002H ; Step rate 48tpi disk in 48tpi drive

...

; I/O ports

FD_PSEL= 03F2H ; Controls drive select and motors
FD_PDAT= 03F5H ; Data transfer to/from controller
FD_PSTAT= 03F4H ; Controller status
FD_PCMD= 03F7H ; Controller command register

...

;* Floppy state Start
;
; Do setup calculations to figure out sector, start
; up motor, advance to Calc state.
;
...

FlExStart:
mov si,OFFSET Floppy ; SI = pointer to per-device info.
les bx,FloppyQueue ; ES:BX = pointer to current request
mov al,es:[bx].RqUnit
mov ah,es:[bx].RqMedia
call FDGetBPB ; DI = drive parameters
CALL Setup ; Do setup calculations
MOV DX,FD_PCMD
MOV AL,Rate44
OUT DX,AL ; Set step rate
MOV Floppy.State,Calc ; Advance to next state
flexj1: JMP FloppyExecute ; Now return to do Calc code

The floppy driver built into the BIOS module unconditionally programs the floppy controller to run at a 250 kbps data rate, suitable for low-density drives. The comments in the source code are somewhat misleading, since they mention “step rate”, but it’s really the data rate.

The 0, 1, and 2 data rate selectors correspond to 500, 300, and 250 kbps. The comments in IBMDSK.ASM are correct in that these data rates are suitable for HD floppies in HD drives, DD floppies in HD drives, and DD floppies in DD drives, respectively.

As implied above, the FD_PCMD register (I/O port 3F7h) does not even exist on IBM PC and PC/XT machines; writing to the I/O port has no effect. But on the PC/AT it certainly does do something… and did even several months before the PC/AT was announced.

When booting up, the ROM BIOS necessarily has to program the correct data rate. But as Multitasking DOS switches to its own driver, the IO.SYS module resets the controller and likely loses the correct data rate (after reset, the selected data rate is likely 500 kbps). Someone at Microsoft clearly put in place a quick hack for the machines they had, setting the data rate to 250 kbps. That fixes PC/AT machines with low density 360K drives, but breaks PC/AT systems with high density 1.2M drives, where the correct data rate is 300 kbps.

For reference, the problematic MOV/MOV/OUT instruction sequence is at offset 17F6h in the IBMBIO.COM file. In a running system, the code ends up at address 0070:17F6h.

But… Why?

Readers may be wondering why Multitasking DOS 4 has its own native floppy driver at all, unlike regular DOS. In fact it not only has a floppy driver, but also a hard disk driver. For PC/XT hard disks only, not for PC/AT hard disks.

I can only guess that the motivation was multitasking. The PC and XT BIOS has absolutely no provisions for multitasking. That is especially painful for floppy access, which is quite slow; when using the ROM BIOS, the CPU just does a lot of waiting.

Using a “modern” interrupt-driven disk driver gave Microsoft the ability to run disk operations in the background, and use the CPU for other tasks in the meantime. But that required writing a custom disk driver; the ROM BIOS just couldn’t do it.

Loose Ends

I’ve not been able to ascertain if the same boot failure truly happens on a real PC/AT compatible with high-density 5.25″ drives, but I think it should (note that under emulation, all bets are off!). On 3.5″ drives the behavior is different, because low-density 3.5″ media uses 250 kbps data rate even in high-density drives, same as low-density 5.25″ drives.

This entry was posted in 286, DOS, IBM, Microsoft, PC architecture, PC history, VirtualBox. Bookmark the permalink.

26 Responses to Who Knew What When

  1. zeurkous says:

    ,s/f0r/for/

    (Perhaps time to switch fonts? 🙂

  2. Yuhong Bao says:

    I wonder if it led to improvements in the IBM PC AT BIOS.

  3. Yuhong Bao says:

    It is funny how we went from this to “CP-DOS” in 1986.

  4. Yuhong Bao says:

    What is funny that they were once planning to support Hercules but they ended the support when they moved to 286 protected mode.

  5. MiaM says:

    Interesting!

    Note that there are 5.25″ HD drives that can run at different RPM for HD and DD disks. Maybe IBM considered using one of those for their AT, and later changed their mind?

    Remember that the obvious idea behind HD 5.25″ 96TPI disks was to emulate 8″ drives which is the reason for the different RPM as compared to DD 5.25″ drives. Maybe the first HD 5.25″ drives were intended as a drop-in device for systems that already supported both 5.25″ DD and 8″ drives.

    In other words, it is possible that the AT prototypes Microsoft had access to ran the drives at 300RPM with DD disks. Not super likely, but still. I would think that it’s just as simple as your theory in that they just had DD drives though, but still.

  6. Michal Necasek says:

    The comments in the Multitasking DOS IBMBIO source code are quite clear. “48tpi disk in 96tpi drive” uses 300 kbps, “48tpi disk in 48tpi drive” uses 250 kbps. Same as the released PC/AT.

  7. Yuhong Bao says:

    Interestingly from http://www.easy68k.com/paulrsm/dg/dg29.htm :
    “THE 80286 is actually easier to get hold of than the 80186, especially if you are willing to settle for a 4MHz or 6MHz part. Naturally, Intel is advertising 8 and 10MHz parts. Naturally, you cannot get one.”

  8. Yuhong Bao says:

    Note this was after the “01/10/84” date of the BIOS as well.

  9. Yuhong Bao says:

    Though interestingly the floppy and hard drive was on the same card in the PC/AT.

  10. Octocontrabass says:

    Does multitasking DOS 4 use any of the AT BIOS multitasking features?

  11. Richard Wells says:

    Both Mitsubishi and Olivetti had 5.25″ drives had high density drives that rotated at 300 RPM with an unformatted capacity of 2 MB. I thought TEAC had one as well but I can’t find a suffix for it. Setting the jumpers to do it was possible.

    Until IBM got their new floppy controllers in, there were no controllers with 300 kbps. Other systems with high density drives accepted the unusual smaller formats that 250 kbps at 360 RPM produced. Not much point in producing a driver before the hardware exists.

  12. Yuhong Bao says:

    Does newer versions of multitasking DOS 4.0 still use its own floppy/hard disk driver or did they revert back to INT 13h?

  13. Michal Necasek says:

    Not the April ’84 beta. From what I can tell, and not at all surprisingly, it was primarily meant to run on PC/XT machines, and it was modified just enough to run on PC/AT machines (using INT 13h for hard disk instead of a native XT disk driver).

  14. Yuhong Bao says:

    I am talking about the later builds, not in 1984.

  15. vbdasc says:

    @Yuhong Bao:
    “What is funny that they were once planning to support Hercules but they ended the support when they moved to 286 protected mode.”

    Who planned to support Hercules? Microsoft? They’ve always supported Hercules (graphics card) to a degree. Their BASIC products supported Hercules (SCREEN 3, MSHERC/QBHERC). Windows supported Hercules too, as did DOSSHELL, and these make about the whole list of graphics programs MS cared about.

    What was the main problem with Hercules support? Its non-support by BIOS. When applications started to move to protected mode, they mostly stopped depending on BIOS, so from this point on, Hercules became just as supported as any IBM graphics card.

    “It is funny how we went from this to “CP-DOS” in 1986.”

    What “CP/DOS” existed in 1986, it was basically an alpha/beta of OS/2. And the line of progression is rather clear. The big step forward of “CP/DOS” compared to “Multitasking DOS” is the same as that between Windows 2.x and Windows 3.0 – the move to 286 protected mode.

    “I wonder if it led to improvements in the IBM PC AT BIOS.”

    Most probably not, why should it? And what improvement do you have in mind?

  16. vbdasc says:

    @Richard Wells

    “Not much point in producing a driver before the hardware exists.”

    Unless you’re Microsoft and have insider information about the hardware, and the hardware manufacturer is the 800lb godzilla that is IBM. Then there is much point in producing a driver to support hardware set to release three or four months later.

    Anyway, for some reason (price, ubiquity, reliability, 8inch nostalgia?) IBM chose the 360rpm HD floppies, and the rest is history. Once they did that, it was inevitable that the 300kbps mode would appear, to support legacy diskettes.

  17. vbdasc says:

    @Michal Necasek:

    “In fact it not only has a floppy driver, but also a hard disk driver. For PC/XT hard disks only”

    That’s all good and well, but is there really such a thing as “PC/XT hard disk”? AFAIK, in the XT the HDD subsystem is fully decoupled from the rest of the system – there is a HDD controller with its own ROM BIOS, but the motherboard itself has nothing related to hard disks, and you may well install another, not fully compatible, third-party hard disk controller in the XT. And I believe that such controllers for the XT existed. In this case, software such as this DOS wouldn’t work.

    It’s different with the floppies – the motherboard BIOS contained int13 code for them, so they couldn’t deviate (much) from the IBM baseline, so using a floppy driver to replace the BIOS routines seems reasonable.

    This story made me think – what about other multi-tasking systems for the XT? Various Unices? Xenix? Minix? Did they also come with their own disk drivers, for the aforementioned reasons?

  18. Michal Necasek says:

    Sure, there is such a thing as an IBM PC/XT hard disk (and controller). There were 3rd party controllers compatible with IBM’s, such as the ones from Western Digital. If people bought different, incompatible controllers, then it was up to them to acquire appropriate drivers if they needed them. That’s not really different from the situation with the PC/AT where there was a standard hard disk/controller type (with support in the system BIOS, but that’s not really too relevant), but nothing stopped people from using totally different controllers. Only if they did, and wanted to run some “advanced” OS, then they needed drivers.

    XENIX and MINIX and PC/IX had their own drivers for the XT hard disk subsystem. I don’t think any of these systems offered using INT 13h even as an option, even though technically it would not have been difficult (just slow).

  19. Richard Wells says:

    Minix 2 offers INT 13h for a disk interface. See the file bios_wini.c for details. It is described as being slower than the xt, at, and adaptec specific drivers. It did permit the use of many unusual controllers as long as the controller came with an INT 13h replacement ROM.

  20. Yuhong Bao says:

    I am talking about when IBM designed the BVS in “CP-DOS”.

  21. Fernando says:

    @Michal Necasek
    “XENIX and MINIX and PC/IX had their own drivers for the XT hard disk subsystem”
    Venix used the INT 13h interface. This made it slower for disk access, but had greater compatibility.

  22. Fernando says:

    @Michal Necasek

    “for whatever reason, the prototypes Microsoft used to run Multitasking DOS 4 only had low density floppy drives.”

    Many, many, many moons ago, the first PC compatible computer that I owned was an XT class machine. I installed a 3.5″ 720K Floppy drive in this machine. The drive was not recognized by the BIOS, but if I remember correctly putting in the config.sys the DRIVPARM line with the configuration of the drive I made it to work. Maybe the developers of MT-DOS did something like that. But who knows.

  23. vbdasc says:

    @Fernando
    “Maybe the developers of MT-DOS did something like that. But who knows.”

    This is interesting. According to https://minuszerodegrees.net/5150/floppy_diskette/5150_floppy_drive_support.htm , even the original IBM PC (and IBM PC/XT too) have the necessary hardware and BIOS support to read and write formatted 3.5” 720K diskettes out of the box. The thing is that to the hardware and the BIOS, the 720K drive looks similar enough to the standard 360K XT drive – same interface, same data rate, same controller commands. Yet, 1.2M drives aren’t supported by the XT floppy controller at all.

  24. Michal Necasek says:

    Yes. A 720K 3.5″ DD floppy has exactly twice the capacity of a 360K 5.25″ DD floppy because the only difference is 80 vs 40 tracks. Otherwise the formats are more or less identical. Certainly one floppy controller can handle both. The stepping will be different but that’s a function of the drive itself.

  25. Jacob Thompson says:

    Given the known track width issues of interchanging double density disks between DD and HD drives, is it possible that MS might have deliberately equipped their AT prototypes with DD drives to facilitate moving data back and forth with XTs?

  26. Michal Necasek says:

    Your guess is as good as mine. It’s possible that they wanted DD drives for better compatibility, it’s also possible IBM didn’t give them HD drives for availability reasons or whatever.

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.