
Sometimes there are such artifacts of nature that you begin to unwittingly think about different conspiracy theories and alternative history. Today I would like to talk about various little-known and not so aspects of the MS-DOS operating system. There were a lot of stories about dos on Habré: brief essays, detailed chronology, nostalgic memoirs, but no one has ever mentioned MS-DOS 4.0 from 1985. I consider this a very important link in the development of operating systems for the IBM PC, but surprisingly little information about such an important transitional stage. This is literally a lost branch of the dos and it is a big problem to find information about it. What would you think if you heard about DOS support for preemptive multitasking, virtual memory, swap, semaphores and IPC. Fantasy?
Actually, the story began one idle day, when I decided to read the Internet instead of work in a fit of procrastination. I once had a Sharp PC 6200 laptop, based on a new-fashioned 80286 processor and equipped with two drives, one HDD for 10 megabytes, and a second ROM for 4 megabytes. On the ROM drive were utilities from the manufacturer and installer DOS. According to the developers, if a person purchased a new hard drive, then he could break it up, format it, and install dos directly with built-in tools. Probably, this decision was dictated by the lack of a drive in a laptop, but for me it was very original and fresh. I confidently remembered that there was DOS 4.0 and I wanted to learn more about it, especially since fame was going about it as an unsuccessful system, but I did not know the specifics.
Literally from the first request I received a lot of contradictions in the issue. Literally everything went from the list of problems to the release date. Separately, it should be noted that in those wild times, it is not necessary to talk about the release of dos. Up to the fifth version, MS DOS was not sold freely, Microsoft worked exclusively for equipment manufacturers and the corporate segment, so the versions of those times are known either by purchased equipment samples with a pre-installed system, or by leaked versions from enterprises. In addition, the dos of those times was practically naked, only a few very important system utilities, and from very much applied software, only the DEBUG assembler / disassembler / debugger, EDLIN and BASIC linear text editor in some versions can be noted. Having received a naked system, there was practically nothing to do in it, but this is more the spirit of those days. But the computer was usually bought with a well-defined goal and rather the OS was chosen for software, and not vice versa. Particularly interesting on this background is the CP / M 86, which at the time included a visual text editor, an assembler compiler, and BASIC. However, back to our DOS. On some sites I found evidence that DOS 4.0 was a fundamentally new operating system and there were huge changes to its core, to the minimum: a new FAT16 file system that allowed the use of a hard drive of more than 32 megabytes, for which the VFS appeared to work successfully simultaneously with two different file systems, up to multitasking, semaphores and shared memory. According to eyewitnesses in version 4.01, the system was brushed, multitasking was blocked and a working system was released.
Here, to put it mildly, I was very surprised. I clearly remember that there was no multitasking and shared memory on the laptop and the version was strictly equal to 4.00. But I felt that the topic is clearly interesting and little studied. Then the truth gradually began to emerge. It turns out that there are two versions 4.00, one of them, known to all, was released in 1988 and is based on 3.30, the other was released in late 1985, based on 2.1 with parts from 3.1 and has all these magical properties. To distinguish them, the 1985 version is popularly called 4.00M.
')
At this moment, I was completely no longer interested in the usual fourth version of the bugs, and I began to hunt for images of the multitasking version. I collected about ten different versions of MS DOS 4.0 for different vendors, among which was even Nokia (that's where their collaboration grows), along the way finding the source code of MS DOS 3.3, but that 4.00M was not there. And the images were found, and not just, but right in the
on-line x86 emulator.
The system consisted of two floppy disks, where there was, in fact, the kernel of the operating system and a very minimal set of utilities. No documents were contained. No help. Moreover, even the key /? not present in all teams! But the main functionality is visible and so. On the right alto, a task list appeared in which you could create a new process or switch between the existing ones. Which, in general, was not particularly impressive. I was not even sure that this is an authentic version from Microsoft, and not a hoax on the rumors on the network. Actually, this is what we will prove. Moreover, the fact that multitasking is implemented by some SM.EXE over the top speaks in favor of this version. Here is the content of CONFIG.SYS:
BUFFERS=20 FILES=40 SHELL=c:\dos\sm.exe c:\command.com
Further research revealed several oddities. Firstly, these are .PIF files that were on floppy disks, which made this DOS with Windows. On the second diskette, PIFEDIT.EXE and the first long-awaited document were found: swapper.doc.
swapper.doc ; Swapper.doc
;
; SCCSID = @ (#) swapper.doc 6.1 85/10/09
Using the dos 4.00 partition swapper.
1. You must add the swapper, swapper.exe, to the autoexec.bat file. Add
the following lines:
memset default = 5
detach swapper
memset default = 127
This allows you to run in a minimum amount of space.
Note the swapper MUST run in backround.
2. The above configuration will cause the default to
root directory of c: drive for locating its swap files. You may
tell the swapper where to place the swap files by specifying
the drive and also the directory. You must always specify the
drive directory of the drive
drive. Example:
detach swapper d:
or
detach swapper c: \ tmp
3. The swapper will manage the cleanup of its swap files. If the
swap directory is changed after a system crash, there is the
chance that swap files will be left around. These can be removed
by executing the following on the "old" swap directory:
del * .swp
Currently ANY task can be swapped, so use with caution until this is
resolved. Remove "detach
swapper "from the autoexec.bat file.
This is already starting to be really interesting. Firstly, the date is visible: October 9, 1985, secondly, the scope of activity is visible. We should also note that this is only October 1985, and the first version of Windows was released only in November. That is, PIF technology has not yet gone beyond the walls of Microsoft. MEMSET memory management utility, true background processes, not TSR trimmed, intercepting interrupt vectors. Virtual memory and the ability to upload segments to disk. I immediately tried to start something with the detach command and got the answer in the form of the PID of the running process. It is interesting that if you try to launch an interactive command in the background, its output overlaps with the current console, and it immediately receives the symbol of the end of the file ^ Z and closes. If you run FDISK, then the terminal settings deteriorate. They are not restored even if you terminate the session of this terminal and reopen it. That is, the terminals are statically allocated. Interestingly, CLS does not work as expected, but simply outputs the ESC sequence. That is, the terminals are heavily out of direct memory access and must be managed via ANSI. ANSI driver was, but I did not load it. Here I have already strongly begun to doubt the mystification on such a scale. So leave the emulator and go directly to the showdown.
After downloading the images, I extracted all the contents into a separate directory. I checked the images on deleted files but everything turned out to be clean. The ghostly hope of finding something else has disappeared. So let's get started. To begin with, we note that the file structure has seriously changed. For example popup.exe: MS-DOS executable, NE (unknown OS) (driver) or queuer.exe: MS-DOS executable, NE for MS-DOS, and even attrib.exe: MS-DOS executable, NE for MS Windows 3 .x. Although the file runs fine. So this is most likely the file utility glitch, or just the file format is not yet fully standardized.
The files contain a header that is more similar to PE than it is used to work with in dos. You can see the original file name and the list of imported exported characters called here DOSCALLS, that is, apparently there was an attempt to implement something like shared libraries or IPC.
The version is defined in this way.
MS-DOS version 4.00
Copyright 1981,82,83,84,85 Microsoft Corp.
$ nternal revision 6.7, 85/11/26
It is interesting to note that the $ symbol means the end of the line in the DoS, that is, the message about the internal revision was roughly cut from the output, but remained in the file. Below is a list of interesting anachronisms and amazing things.
- List of DOSCALLS: ALLOCSEG, REALLOCSEG, FREESEG, LOCKSEG, UNLOCKSEG, GETSEGSIZE, GETDSHANDLE, CRITENTER, CRITLEAVE, CRRITENTER, FCRITLEAVE, PBLOCK, PRUN, SUBSCREEN, GETPIDS, DETCC, CEP, CEPL, SUBSCREEN, CETSEGS, CRETENEG, CETSEGSIZE, FREETSEG, LOCKSEG Memory allocation operations are visible, as well as synchronization mechanisms, critical sections and GETPIDS for getting a list of processes. What is interesting, I have not found a way to get a list of processes for the user. Only, so to speak, a list of applications.
- Interesting paths are visible in the core, for example \ SHAREMEM \, \ SEM \, and in other files \ SHAREMEM \ SMPGNAME, \ SHAREMEM \ SMDATA1, \ SHAREMEM \ PRINTQUE, \ SEM \ PRINT.INS, \ SEM \ PRINT.GO which show how shared memory and semaphores work
- Using PIFEDIT, you can create a binary .PIF file with a description of the necessary flags (for example, running in the background and using 8087) and memory limits. In addition, these settings can be saved directly to the NE EXE.

- COMMAND.COM can load not only BAT, COM and EXE, but also PIF.
- Link4.exe contained is a linker of executable files which can NE format. Interestingly, MS-DOS 4.0 from 1988 uses the third version of the linker, and here the fourth. It is also interesting to note that the linker is a basic component of the system, but there is not a single compiler that allows you to get .org. This can be explained by the fact that the old compilers could be used for the new version, but because of the new format - the new linker.
- The drivers of even standard devices are separate, have small versions and lines at startup, which were not there before, for example - Installing Com Device Driver V1.02 ---. Surely this is due to a change in the internal representation of devices.
- The files contain a lot of extraneous lines about the name of the source file, which are not in the release. They are occasionally found in modified OEM versions, but not in basic ones. Immediately there are a lot of them, which gives some idea of the structure of the source code tree and dates.
versionsdos / append.exe: @ (#) append.c 1.1 85/10/09
dos / assign.exe: @ (#) assign.c 6.1 85/10/23
dos / attrib.exe: @ (#) attrib.c 6.1 85/10/24
dos / fdisk.exe: @ (#) fdisk.c 1.1 85/10/09
dos / fdisk.exe: @ (#) fddata.c 1.1 85/10/09
dos / fdisk.exe: @ (#) fdlow.c 1.1 85/10/09
dos / fdisk.exe: @ (#) fdsub.c 1.1 85/10/09
dos / join.exe: @ (#) joinsbst.c 6.3 85/11/08
dos / join.exe: @ (#) sysvar.c 6.2 85/11/08
dos / join.exe: @ (#) cds.c 6.2 85/11/08
dos / join.exe: @ (#) dpb.c 6.1 85/11/08
dos / label.exe: @ (#) label.c 6.1 85/10/24
dos / link4.exe: @ (#) newdef.y 6.2 85/10/14
dos / link4.exe: @ (#) ms4bnr.c 1.1 85/10/15
dos / mode.exe: @ (#) mode.c 6.2 85/10/24
dos / pifedit.exe: @ (#) getkey.c 6.1 85/10/25
dos / pifedit.exe: @ (#) pifmes.c 6.1 85/10/25
dos / pifedit.exe: @ (#) advpscrn.c 6.1 85/10/25
dos / pifedit.exe: @ (#) advescrn.c 6.1 85/10/25
dos / pifedit.exe: @ (#) usrscrn.c 6.1 85/10/25
dos / pifedit.exe: @ (#) rangers.c 6.1 85/10/25
dos / subst.exe: @ (#) joinsbst.c 6.3 85/11/08
dos / subst.exe: @ (#) sysvar.c 6.2 85/11/08
dos / subst.exe: @ (#) cds.c 6.2 85/11/08
dos / subst.exe: @ (#) dpb.c 6.1 85/11/08
dos / swapper.doc: @ (#) swapper.doc 6.1 85/10/09
ega.sys: @ (#) BIOSMSYN6.1
ega.sys: @ (#) scrinit.asm 6.3 85/11/14
ibmbio.com:@(#)BIOSMSYN6.1
ibmbio.com:@(#)ibmbio.asm 6.4 85/11/25
ibmbio.com:@(#)scrinit.asm 6.3 85/11/14
ibmbio.com:@(#)ibmprint.asm 6.3 85/11/14
ibmbio.com:@(#)ibmatdsk.asm 6.3 85/11/14
ibmbio.com:@(#)ibmdsk.asm 6.3 85/11/14
ibmbio.com:@(#)sysini.asm 6.4 85/11/14
ibmdos.com:@(#)msinit.asm 6.7 85/11/26
- From the previous paragraph you can see the general use of C in this version of dos. Most of the utilities for DOS 3.30 were encoded in assembly language.
- Some of the utilities are taken without changes from other versions, for example CHKDSK from 3.0, DISKCOPY from 2.0, and this is sufficient in the old file format.
- Even in such an internal version there is practically no humor and a minimum of debugging information, all I could find is Abort .Retry .Ignore .Fail .Huh? .. and Terrible error, unknown control packet
- There were no names of living people or anything like a nickname. Moreover, even the standard phrase © which is available in all release files is not contained in any of the files! © Copyright 1988 Microsoft CorpLicensed Material!
- The very stub lines of the type \ DEV \ NUL and Can't open \ dev \ con, and the directory with executable files is called BIN. I have read many times that many Microsoft employees at that time were fans of Unix.
Now let's check this miracle for compatibility with programs from MS DOS. For this, we have vc.com, rkega.com, sdrv.com, zork and captain comic. Here we get the first disappointment. Neither wolves, nor Russian driver, nor speech synthesizer can be installed. Zork plays great, tasks switch. it is possible to play CC, but after switching the schedule it breaks down. qbasic starts, but if it switches from it, and then into it, the system hangs. In general, there is compatibility only with programs that behave very quietly, use the standard API and never, never climb into DOS structures directly. TSR is missing as a class. Apparently direct access to the video memory is also not welcome. Actually, it is precisely because of this point that the project did not receive a future.
Of course, you can still get the disassembler and continue with a deeper analysis, but I think that for the time being with the technical side you can finish. But the political and historical side is also interesting. As a result, we find a
collection of different information about dos from PC DOS Lead-developer from IBM, among which is a
page about 4.0M :
MOSCOW: DOS 4.0 is supported by MS-DOS 4.0. It was released in 1988. DOS 4.0 supported preemptive multitasking , shared memory, semaphores, advanced memory management, session manager, imports, exports and a new executable format. There are a lot of ideas for OS / 2. Unfortunately DOS 4.0 was limited by the real-mode 8086 environment and the 640KB address space. Programs that were not well-behaved or relied upon undocumented DOS functions, especially TSR programs.
And a link to the
developer’s blog of this version Larry Osterman, where we can find absolutely amazing things:
MS-DOS 4.0: MS-DOS 4.0; But it didn’t have a PC / AT. So that it eventually turned into OS / 2. I worked up the MS-DOS 4.0 for the OEM partners who had licensed MS-DOS 4.0.
It turns out that this version is not in vain, it is not only the ancestor of OS / 2, but literally its larva, many technologies that were used here are shared with Windows of the time and went straight to OS / 2. However, on all historical sites, the history of OS / 2 begins in 1987 and the release of the OS / 2 SDK, and this is a transition link that has been forgotten by everyone and is not even mentioned.
PS: $ file append.exe
append.exe: MS-DOS executable, NE for OS / 2 1.x