Microsoft Releases Crown Jewels — From 1982!

If you look back 30 or so years ago, it wasn’t clear what was going to happen with personal computers. One thing most people would have bet on, though, was that CP/M — the operating system from Digital Research — would keep growing and power whatever new machines were available. Except it didn’t. MS-DOS took over the word and led — eventually — to the huge number of Windows computers we know today. Microsoft has released the source code to MS-DOS 1.25 and 2.0 on GitHub.

Microsoft — then another fledgling computer company — had written some BASIC interpreters and wanted in on the operating system space. They paid the princely sum of $75,000 to Seattle Computer Products for something called QDOS written by [Tim Paterson]. Rebranded as MS-DOS, the first version appeared in late 1981 and version 1.25 was out about a year later.

While you might not think having MS-DOS source code is a big deal, there’s still a lot of life left in DOS and it is also interesting from an educational and historical perspective. If you don’t want to read x86 assembly language, there’s also the BASIC source for the samples (paradoxically, in the bin subdirectory) along with compiled COM files for old friends like EDLIN and DEBUG.

Of particular interest is the very small assembler source code. There’s also the source for something that would convert Z80 code to x86 which could be fun to pick apart. Be warned, though. There are not many comments in the file’s 1,200 lines.

The source code for version 2.0 has a lot more files including the source for things like EDLIN and DEBUG. We wonder if the version 1.25 files were lost, too ugly to show, or if the COM files were hand-coded?

If you had told us in 1990 that Microsoft would open source MS-DOS we’d have had you committed. They did show their sense of humor with this little bit in the README file:

The source files in this repo are for historical reference and will be kept static, so please don’t send Pull Requests suggesting any modifications to the source files,…

If this gets you wanting to write some new DOS programs, you can actually use GCC now. Or if you want to play the DONKEY.BAS file, QB64 would probably work.

43 thoughts on “Microsoft Releases Crown Jewels — From 1982!

  1. I guess you could always “fork” it

    EdLin, now THATS a text editor. I was most taken back at a it job interview way back when and they looked at me blankly when I mentioned I was comfortable using EdLin – knowing what I know nowabout about managent and interview panels for government jobs I don’t think they had any idea what I was talking about ….

    1. At my first job, the powers that be insisted we all use EDLIN to edit our COBOL source code “because that’s the only editor that is always available if you have to do on-site support”. Which we never did.

    2. I spent about a year writing 6805 code for a cross assembler on CP/M using the old CP/M editor which was similar. I got really good at it, but I was tired of it. I told my boss: if you won’t buy us a better editor, I’m going to buy one out of my own pocket. He said, “I’m not buying another editor. We bought a copy of WordStar two years ago and no one could figure out how to install it.” I said, “We have a copy of WordStar?” About 30 minutes later I was in editing heaven. Took me a long time to give up WordStar and WordStar-like editors.

      1. Having come up in the CP/M space and being very stubborn, I have those WordStar sequences burned into my very soul. I used VDE, then ZDE on my CP/M boxes, and VDE for DOS on PCs. Nowadays, first thing I do on any linux machine I have any reason to access is install JOE (Joe’s Own Editor, because recursive acronyms are fun).

        1. I picked Joe when I first installed Linux in 2001 because it could emulate the keystrokes, maybe more, of a number of editors, depending on how you invoked it. That sounded versatile.

          And other than try the possibilities the first week, I’ve never used it as anything but straight “Joe”.

          Michael

    1. Excuse me, Bil did make some original DOS commands, but the majority was simply copied from IBM DOS, some of them even with the exact command file name. It is like claiming that Google invented Android.

        1. It might be My memory, but tIt came in a box with a cartoon parrot, and it was more primitive than MS DOS. Just found the wiki… You are absolutely right! I’m an arse.

        2. In some versions, PC DOS had some commands which were not originally created by Microsoft. Microsoft then created versions of these for MS DOS. (My first computer job was writing some of those commands for Microsoft.)

        1. IBM went to Microsoft for a version of their Basic, but at the meeting, Microsoft also won the contract for PC-DOS by telling IBM they were working on one, which wasn’t true. They did, however, already know about QDOS from SCP (who didn’t know IBM were looking to contract a company to write the PC’s operating system). They subsequently either bought outright or obtained the rights to QDOS, which was then modified for IBM’s hardware; retained ownership of MS-DOS, which was licensed to IBM.

          1. That big lie and the lie about already working on BASIC for the MITS Altair are the foundations of Microsoft’s success. Had Gates and Allen told the truth those times, the landscape of computer software would have been far different. Same for if Gary Kildall hadn’t been so standoffish with IBM that they went to their second choice, Microsoft.

      1. I think you mean that DOS was copied from Digital Research’s CP/M-80.

        CP/M was the most popular OS at the time, but written for the 8080. Digital Research was working on an x86 version. Tim Patterson couldn’t wait, and so fed CP/M-80 source into XLT86 (a DRI program that converted 8080 source into x86 source) to get what he called QDOS.

        Microsoft bought QDOS, renamed it MS-DOS, made some tweaks and improvements, and sold copies to IBM. And made history.

        1. I didn’t know that aspect. I thought they developed it from scratch to be a work-alike of CP/M. Surely even SCP had to modify its behaviour so that it could use 8086 segmentation. Also, CP/M interfaces via CALL 5 instructions whereas MS-DOS uses int 13 for the bios and int 21 (mainly) for the higher-level calls.

          1. MS-DOS implements CALL 5. This code was handed down from the SCP code where it was designed as part of the automated conversion process for CP/M-80 programs. The behind the scenes set of jumps and reorganizing the stack so that CALL 5 ends up in the INT 21h code is suitably baroque and broke in several versions of MS-DOS.

            Digital Research did not implement CALL 5 in CP/M-86 requiring code to be rewritten.

  2. The holy grail would be one of the early versions of Windows after they started to go somewhere with it. I’d love to see Windows 3.1 source at some point, including the programs for it like solitare. Winfile source was released so I can still dream right?
    Anyways, maybe they’ll at least release the source for a newer version of DOS, like 5.22 sometime. That would also be neat to see. I spent a majority of my time in DOS back in the day. Either playing games, or messing around in QBasic or writing terrible fanfiction in EDIT and/or some other text editor I can’t remember. I think it was one with a black background and yellow text?

    1. If you can get a-hold of older SDKs and older copies of VC and Visual Studio they usually had bits and pieces of it in the sample code. One fun one was the old ‘pipes’ screensaver and changing all the corners to be teapots.

  3. From the FIND Assembly comments.

    ; 4) The maximum line size is determined by ;
    ; buffer size. Bigger lines will bomb the program. ;

    Oh, if only buffer overflows in MSDOS 2.0 were useful in any way…

  4. holy snap! with this source and a little work, we could have DOS on all the machines! z80, 6502, AVR, the possibilities are endless!

    Oh, right, but all the software, games, etc. is still x86… :/

    1. I think it might be a lot of work. I suspect this is assembler, so one has to do a lot if translation to fit “foreign” CPUs. You also have to deal with fewer registers on the 8bit CPUs.

      Microsoft used a lot of concepts across their BASICs, but as far as I know, they started from scratch with each new CPU. That probably says something about how translatable an 8086 DOS would be to 8bit CPUs.

      Michael

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.