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.
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 ….
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.
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.
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).
Yup! Me too. JOE FTW.
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
^KB ^KK ^KC ^KV
Those are the ones that have stuck.
not sure if your wordstaring or wordperfecting, those two always muddled me. wordperfect was my first dataease to mailling list system.
It’s been released for some time now, they just put it on github recently is all
It looks like it’s now under an MIT license
What text encoding do the source files use?
Probably ASCII
Definitely ASCII – Unicode didn’t exist in those days
I wonder what they were thinking. If you want source code for DOS then there’s http://freedos.org/
FreeDOS isn’t the same thing. It’s a community-created clone of DOS, not the one Microsoft made back in the day.
this is only a recent github commit cause they now own github(prosperity/reference/research/search) , originally it was release in 2014, http://www.computerhistory.org/atchm/microsoft-ms-dos-early-source-code/ , hackaday is catching up, soon we shall see source to OS/2 , Love you bill & jenny :-)
About 35 years too late.
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.
IBM PC DOS was a rebranded version of MS DOS… so you’re claiming they copied from themselves. Scandalous!
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.
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.)
Huh? I think you have your chronology wrong. MS bought QDOS because IBM could not. They then licensed to IBM.
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.
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.
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.
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.
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.
XENIX.ASM and XENIX2.ASM files look interesting.
Now if we can get them to open source MS Comic Chat and 3D Movie Maker, we’ll be getting somewhere.
I miss the times I had with comic chat. Talk about a defining program of my youth
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?
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.
There was a leak of NT codebase some years back.
Haha … World domination is ahead for me! Boot sector virus to rule the whole world!
Ah. 30 years too late …
Pitr, is that you? (yes, that’s an UF reference)
God, root, what is difference? Am to be doink bad things to your networks! :D
Nothing like a proper text editor like edit or a fancy one like eded. Oh btw, BASICA ruled.
They must have run out of ways to make money off of it.
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…
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… :/
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
Remember the gold mine that was Norton Commander? It’s spiritual successor, DOS Navigator is still around and works well with both Windows and Linux. Personally, I use NDN, as it has a ton of features and an excellent text editor that even supports regex!
Who needs source code? It was insanely easy to RE 6.22 binary codebase and add features as if it was BASIC or C or Fortran source..
Not sure if you’re aware of this but somebody has purposely done some monkey-patching to prevent the source from assembling. They’ve also renamed the files in places. It’s a total mess. You’d also need an ancient MASM v1.10 to do anything with it, which isn’t available. So it’s a disingenuous move on their part.
I’m also siding with CP/M (rather than QDOS) as the pedigree of MS-DOS. Bill was just a college drop-out and lacked the experience to know what he was doing.
Speaking of editors, my editor of choice was the command like ed.exe which came with a copy of WordPerfect. The custom macro support was better even then than what you’ll find in editors today.
I’ve always had a thing for CP/M even though I spend so much time on MSDOS. I make a z80 circuit that ran both once..