Something rather unexpected happened over the weekend: disk images of the near-mythical multitasking DOS 4 suddenly popped up.
This is “MS-DOS Version 4.00”—from 1985. It looks almost exactly like MS-DOS 3.0, with COMMAND.COM, FORMAT, SYS, FDISK, JOIN, SUBST, ATTRIB, and so on.
The big difference is that this version of DOS includes an optional “session manager” (SM.EXE) which allows starting additional programs and switching between them:
The files are from late November 1985; it is unknown if and how different this version is from the actual multitasking DOS 4.0 release shipped to OEMs. The package contains both classic MZ-format executables as well as segmented NE-format modules more similar to Windows and OS/2. The session manager and hard-error pop-up are rather reminiscent of OS/2, while the .PIF files resemble Windows. The NE format was of course shared by all three.
A deeper dive into multitasking DOS 4.0 will follow sometime soon…
Is it the extended .PIF format used in Windows or the original .PIF format created for Topview?
Good question. How do I quickly tell? File size? Something else?
The PIF files are 369 bytes in size. I’m guessing that’s the same format as Windows 1.0?
Is this based upon DOS 3.0 or DOS 3.1 ? The inclusion of JOIN and SUBST would suggest DOS 3.1 as that the version those commands first appeared. One way to check internally would be to look at the SYSVARS table which has differences between DOS 3.0 and DOS 3.1+.
What INT 21h functions are present ? It should have standard functions 00h-63h and new functions for multitasking starting at 80h. Also it should support INT 21h function 4B04h (load and execute program in background) and INT 21h function 59h, BX=1 (get hard error info).
Does it have the INT 2Ah networking and critical section support ?
Does it have the INT 2Fh redirector support ?
Apparently DOS was forked at this point with nothing of this code appearing in retail DOS 3.2 or later but several concepts (and possibly even adapted code) appeared in OS/2 1.0 – the NE executable format, device helper services, shared memory (using \SHAREMEM\), pipes and signal handlers.
According to what I know of multitasking DOS 4, it’s not based on DOS 3.x at all but rather is a parallel development. The work on multitasking DOS started in Jan ’83 according to Gordon Letwin (Inside OS/2).
I have not had time to analyze DOS 4 in depth but yes, it does support more INT 21h sub-functions with a few above 80h. There is some INT 2Fh support (not yet sure how much) and INT 2Ah.
Yes, none of this made it into DOS 3.x (or 4.x), but many of the concepts appeared in OS/2. Multitasking DOS 4 was initially supposed to have threads and named pipes, but that apparently never happened. I suspect Microsoft found out that with the 640K limit and without hardware memory management, the OS was simply too big, IBMBIO.COM+IBMDOS.COM were ~35K in DOS 3.1 vs. ~84K in DOS 4, COMMAND.COM was ~15K bigger; that was a lot of RAM back then. And by 1986 it made little sense to develop a purely 8086-based advanced OS.
I’ve not found any sign of device helpers or pipes in DOS 4 yet, but there was definitely named shared memory and semaphores (\SHAREMEM\xxx and \SEM\xxx). There’s also an optional swapper daemon. OS/2 uses many of the same concepts, though a very different API and probably not a lot of common code.
Where did you find the disk images?
Get hold of the old Ralf Brown Interrupt List, it lists some of the APIs in what it terms “European MS-DOS 4.0”. It says that on a device driver init call, the request header at offset 0Eh contains a pointer to the DOS device helper function, this dword is unused in retail DOS until DOS 5.
This blog says it was a version of MS-DOS 2 – http://blogs.msdn.com/b/larryosterman/archive/2004/03/22/94209.aspx
I worked on PC DOS in the 90s and there was absolutely no trace of any of this stuff in the code so it was definitely a separate development. (note: MS-DOS and PC DOS were the same code with build defines to build one or the other until after DOS 5)
They landed in my inbox… but check http://jsmachines.net/videos/pcjs/
Yes, I checked the RBIL. It does not quite apply to the DOS 4 build I have, as in it documents functions that don’t exist in the late-1985 build. But then I have no idea what the information in RBIL is based on.
Larry O didn’t really say that DOS 4 was a version of DOS 2… rather that it was a parallel development with DOS 3. I’ve had time to look at the code some more and I can say that a) it strongly resembles DOS 3, but b) it is not DOS 3. There are quite a few additions and the internals are not the same, even though at least in the file management area the overall structure is more or less identical. Memory management, error handling, and process management (to name a few) are noticeably different.
DOS 4 definitely shared some code with DOS 2/3 (some parts of the IBMDOS.COM code are byte for byte identical) but it is also noticeably different. I don’t know if the code sharing went in both directions or not. If any of it landed in DOS, it would have been most likely DOS 3.0 or 3.1. Some of the code likely ended up in OS/2, but probably only in the very early stages of OS/2 development.
Larry makes a brief mention of it here as well – http://blogs.msdn.com/b/larryosterman/archive/2009/08/26/24-years-ago-today-1985.aspx
So based upon what Larry says MS-DOS 4.0 was forked from DOS 2.0 and picked up most of the stuff from DOS 3.0 (which was done in parallel) while MS-DOS 4.1 picked up stuff from DOS 3.1. It was at least licensed by a European company named ICL though RBIL says that Siemens in Germany licensed it as well.
I would love for this to land in my inbox though I’m guessing I could only disassemble it since I have a >32MB DOS partition and no 5¼” floppy drive.
Yes, and Larry O should know what he’s talking about since he actually worked on DOS 4 🙂
ICL in the UK was (the only?) one of the OEMs who licensed DOS 4.1 (see http://web.archive.org/web/20070220193954/http://www.16bitos.com/410ms.htm ). Goupil in France and presumably Siemens in Germany licensed DOS 4.0; the stuff on RBIL about DOS 4 being developed for Siemens is a bit misleading, Siemens was just one of the OEMs.
There is some chance that DOS 4 supported 720K disks and might be therefore runnable on machines of more recent vintage. I’ll see if I can find out…
I wonder if function 51h returns the same result as function 62h under this version of DOS or not. On 3.x they are pretty much the same.
Yes, the two are identical–calling into the same worker routine which returns the value of the CurrentPDB variable (stored in the DOS data area) in BX. The CurrentPDB variable can be set by function 50h.
720K floppy disk support was added in DOS 3.2 (1986) for the PC Convertible so I wouldn’t expect it to be in Multitasking MS-DOS 4.x but who knows ? Perhaps it got the support first. If DRIVER.SYS is present and/or CONFIG.SYS supports DRIVPARM (both from DOS 3.2) then 720K support is probably there. Interestingly, the archived 16bitos.com link shows a MS-DOS 4.1 file list which includes REPLACE and XCOPY which didn’t appear until DOS 3.2 and APPEND which didn’t appear until DOS 3.3.
What does SYSVARS (INT 21h/52h) look like ? There were differences between DOS 3.0 and 3.1 starting at offset 10h
In DOS 3.1+
-02h memory chain anchor
+00h pointer to disk parameter blocks
+04h pointer to system file tables
+08h pointer to CLOCK$ device header
+0Ch pointer to CON device header
+10h disk buffer size
+12h pointer to disk buffer chain (3.x)
pointer to disk buffer control block (4.0+)
+16h pointer to current directory structures
+1Ah pointer to FCB system file tables
+1Eh maximum number of protected FCBs
+20h number of actual drives
+21h number of logical drives
+22h NUL device header
AFAIK, I think OEMs was adding 720k support to 2.11 since 1984 or so.
I suppose that is possible since that was in the days of the DOS OEM Adapation Kit (OAK) but doesn’t seem likely since 3½” floppy drives weren’t common on PCs until around 1986 or 1987. Consider 1.2M 5¼” floppy drives didn’t appear until DOS 3.0 which shipped with the IBM PC AT plus XT BIOSes didn’t have the necessary functions (INT 13h functions 15h-18h). Certainly INT 13h functions 17h and 18h would be necessary for 3½” floppy drive support unless a PC had proprietary non-standard support.
How does one call the “session manager?” Is there a hotkey? I was able to do it once, but I don’t know what I did.
alt key brings up the session manager… this is too cool btw!
Left Alt key. And I don’t know if there’s a way to switch to the next session directly (Alt-Esc in other Microsoft products); so far I haven’t found it.
Thanks! I think I tried plus every other key. Never thought to try just plain old . I’ve tested this one and it works quite well in VirtualBox, VMWare and the old Microsoft Virtual PC. Pretty well behaved for software of this age. Great find!
The emulator version is very interesting.
720KB drives were common in 1984 and 1985 as the “Quad Density” 5.25″ drives which were popular with a lot of OEMs because they were cheaper than 360KB and especially 1.2MB 5.25″ drives.
Regarding my earlier comment on PIFs, it seems to be using its own extended PIF format which differs from both Topview and Windows. I could be wrong since I don’t know what the vec* Booleans translate to in English.
On Siemens, one of the versions of the story of DOS4-MT was that Siemens had requested multi-tasking DOS for a system and both MS and DRI built modified variants of their respective OSes to meet Siemens requirements which were offered to others as well.
I haven’t looked at it in detail, but the PIFEDIT.EXE tool may shed some light on the PIF file format. As an interesting aside, the multitasking DOS 4 kernel (IBMDOS.COM) looks for the .PIF extension in the EXEC system call.
When would the Siemens requirement have been submitted to the software companies? 1982?
DOSCALLS exported function names which NE format executables can use:
01 ALLOCSEG
02 REALLOCSEG
03 FREESEG
04 LOCKSEG
05 UNLOCKSEG
06 GETSEGSIZE
07 GETDSHANDLE
08 CRITENTER
09 CRITLEAVE
0A FCRITENTER
0B FCRITLEAVE
0C PBLOCK
0D PRUN
0E SUBSCREEN
0F GETPIDS
10 DOSDISCARDCODE
11 DOSGETHANDLE
12 DOSHANDLEJUMP
Several of the executables are NE format and EXEHDR from MASM 6.00B recognizes them.
I built and ran a simple ‘hello world’ DOS4GW exe and it worked! .. doom fails as it cannot allocated 256KB of real memory.. and making pifs for either doom or dos4gw.exe just confuses the whole thing..
By default each session has 127KB allocated to it. This can be changed with the MEMSET command:
MEMSET [DEFAULT size] [OVERRIDE size|UNSET]
MEMSET with no parameters displays the current setting for the session
For a 256KB session:
MEMSET DEFAULT 256
Not sure what OVERRIDE does yet.
heh I just found the memset command, and yeah doom 1.1 runs! .. for a bit. hitting alt brings the whole thing crashing down.
I’m surprised DOOM even runs at all! This DOS is quite strange in that it (presumably) implements the DOS API quite well but the internal structures are significantly different.
yeah it doesn’t run very long… but I’m more so amazed it booted up..
Ironically it runs pretty well under DOSBOX! .. although it crashes out on exit, but it is still amzing that it’d run. I suspect the crashes are probably more so from Doom v1.1 using an old version of DOS/4GW
One major DOS API difference I noticed: INT 21h functions 1Fh and 32h copy the DPB to DS:BX instead of returning a pointer in DS:BX. Low level disk utilities like Norton Utilities and PC Tools probably won’t work too well here.
If a program references SYSVARS (INT 21h function 52h) then it likely won’t work at all since SYSVARS here is quite different from that of regular DOS.
Also I wonder how well the session manager would get along with a TSR like Borland’s Sidekick ?
“(note: MS-DOS and PC DOS were the same code with build defines to build one or the other until after DOS 5)”
Yea, MSVER, IBMVER, and IBMCOPYRIGHT:
http://www.os2museum.com/wp/wp-content/uploads/2012/05/readme.txt
Also: http://lists.nongnu.org/archive/html/lynx-dev/1998-04/msg00147.html
“If a program references SYSVARS (INT 21h function 52h) then it likely won’t work at all since SYSVARS here is quite different from that of regular DOS.”
Indeed, there is this blog article, which is probably referencing this function: http://blogs.msdn.com/b/larryosterman/archive/2004/08/12/213681.aspx
It turns out that while SYSVARS is different, it isn’t as different as I originally thought. DPB and SFT structures are different from other versions of DOS, CON is split into two separate devices (KEYBD$ and SCREEN$) each with its own pointer and there doesn’t seem to be a CDS pointer though there is an unused pointer where it should be. Also there is an additional pointer to some code in the kernel which dispatches to a jump table based on a function code in DL (functions 00h-1Ch)
Multitasking MS-DOS 4.0 SYSVARS table:
00 DPB pointer (DPB length = 18h)
04 SFT pointer (SFT length = 37h)
08 CLOCK$ device pointer
0C KEYBD$ device pointer
10 SCREEN$ device pointer
14 disk buffer size
16 disk buffer chain pointer
1A ? (always 0)
1E FCB SFT pointer
22 protected FCB count
24 drive count
25 switch character
26 ? (code pointer)
2A NUL device header
Also there is no MCB anchor at SYSVARS-2 so utilities like MEM won’t work here. Additionally the INT 12h (40h:13h) value is altered to limit session memory. The MEMSET command affects this.
Please, not that nonsense.
I have it for years didn’t know that is was so rare, so I did not published it.
I have a 360kb to 720kb converted disk witch is from olivetti as far as I can remember
darn, nearly a decade later but I never took the chance to mess with LINK4, which with Microsoft C 3.0 is able to generate SOME NE’s that’ll run on DOS 4.00M
Hmm, time to port aclock?
I did a very poor one, based on the vt100.. I suppose I should learn how to use VIO.
Pingback: Who Knew What When | OS/2 Museum