105 comments

[ 3.0 ms ] story [ 193 ms ] thread
Thanks! Macroexpanded:

Microsoft Releases MS-DOS Source Code on GitHub - https://news.ycombinator.com/item?id=18428882 - Nov 2018 (7 comments)

The original sources of MS-DOS 1.25 and 2.0 - https://news.ycombinator.com/item?id=18097661 - Sept 2018 (115 comments)

MS-DOS is now Open Source - https://news.ycombinator.com/item?id=7468192 - March 2014 (3 comments)

Microsoft makes source code for MS-DOS and Word for Windows available to public - https://news.ycombinator.com/item?id=7466952 - March 2014 (204 comments)

MS-DOS Source Code Released - https://news.ycombinator.com/item?id=7466826 - March 2014 (7 comments)

Let's get MS-DOS 6.22. :)
And Windows XP.
Or if we need to start the bidding low.. QBasic, perhaps? :)
Sorry they started even lower actually! GW-BASIC!

https://devblogs.microsoft.com/commandline/microsoft-open-so...

Haha, yes! Although I'm being a bit sneaky, because QBasic would also indirectly get us Edit, I think ;-) It'd be interesting to see the code behind the 90s DOS IDEs.
Gw-basic looks a lot like what command.com should have been.
Kids these days ...

billg's very first BASIC, which he wrote on a night flight from Albuguerque to NY, or some such, for the Altair. 'Sbin a few decades, so ah disremember.

See Ichbiah's Le Nouveaux Magiciens.

Google ichbiah nouveax magiciens

And, get off my lawn! Grrr.

;-)

XP or its parts leaked. Surprisingly Win95 codebase never saw the light of day.
I kind of wish 95 or 98 would leak so we could more effectively patch it. I would love to see a modern TLS implementation running on 9x, it's one of the main barriers to browsing on old machines. I suppose Retrozilla comes close.

Kind of a silly thing to want, and of course "unsafe" for many tasks, but fun for hobbyists nonetheless.

I’d say that DOS 3.3 and 5.0 are probably the most desirable for pre-386 intel compatible processors systems
6.22's source code was readily shared by some russians back in 2002 or so, and it was the real deal
I thinks its a 6.00 beta
Midori would be cool to see as well
Five years ago, yeah, it was.
I kind of wish Microsoft would make "MicrosoftLegacy" for repos like this one, so we can see all of the old things they've open sourced.

The real thing I wish they could / would open source is that old pinball game.

I don't think it's theirs to publish. Also, the version bundled with Windows was apparently just a demo. The full game had more tables.
Thanks for the suggestion. We do have a "MicrosoftArchive" organization that we could consider transferring this sort of thing to...

As far as games, and the broader collection of earlier closed source applications: it's incredibly difficult to clear rights if there's third-party intellectual property that was written without the intention of being open, or licensed content, etc. It also takes a bit of an army to clean/review code and comments to get them ready.

[Source: I run our open source office... we help advise internally, but aren't staffed to do nostalgia open sourcing and so need to partner with people and teams who can help]

It would be neat if Windows 3.x could get open sourced, both the NT and non-NT versions.

There's probably a business argument that they're far enough removed from Windows 11 to not be a threat to Microsoft's sale of Windows 11.

Isn't Windows itself far enough removed to not be a threat to Microsoft's bottom line these days? Wouldn't be surprised to see modern Windows going open-source or at least source-available in the coming decade.
Yeah Im surprised windows 11 isn’t open source at this point
Even presuming the will existed in Microsoft, there's enough licensed code that open sourcing it as is would probably be a non starter. Probably a more viable approach would be open sourcing individual components as the rights are cleared and eventually replacing the third party components which aren't able to be renegotiated with freely available or internally built replacements. That being said, they -might- be able to free something like WRK with only a little prodding on legal's part, and that would be interesting in itself bc NT has a quite elegant internal architecture and not too many people get to see it overall.
> there's enough licensed code that open sourcing it as is would probably be a non starter.

This is exactly what Sun wrote the CDDL for; it let them open source as many components as possible while still leaving some pieces closed. Sun also ended up releasing a bundle of binaries that you drop into a source build to get a complete /functional OpenSolaris system with the still-needed closed bits included, and over time some of those components got replaced piecemeal with FOSS alternatives (although illumos still includes some closed parts AFAIK).

That's right, I definitely had the ordeal of freeing Solaris in mind when I was writing the comment. Honestly something of a minor miracle it even happened. (also I'm pretty sure all the closed stuff got purged out of illumos?, not even using Sun compilers now, it's all gcc/binutils)
> That's right, I definitely had the ordeal of freeing Solaris in mind when I was writing the comment. Honestly something of a minor miracle it even happened.

Good to keep the successes in mind:)

> also I'm pretty sure all the closed stuff got purged out of illumos?, not even using Sun compilers now, it's all gcc/binutils

https://illumos.org/docs/developers/build/#getting-the-close... seems to say there's still some blobs in there, and gcc is a patched version. That said, yes, AIUI it's gotten better.

At this point I'll take a version of Windows X (whatever the latest is when you read this, now or ten years from now) that has all the bloat removed, or is easily removable, no ads of any kind for any Microsoft apps or services, call it Windows for Professionals, or Windows for Devs. Whatever, add a +$200 price tag to it, and I'll pay you Microsoft more money, to maintain less software (since you'd have to remove more OS specific things), just guarantee LTS for 20 years after release. No forced updates, but updates should be on a predictable schedule and security updates should be highlighted as such.
If you're not able to do large projects easily due to licensing conflicts, I would focus on small, -mostly- self contained ones in the meantime. A couple of nice, high sentimental value suggestions here (IMO) would be MASM, the Windows XP version of Paint, MS Comic Chat (to the extent that it doesn't pull in IE stuff that MS would rather keep internal), and maybe some of the stuff off the first entertainment pack (not in licensing hell like Tetris) or builtin games for Windows? I could see Reversi being a big hit. Also freeing the subset of the Core Fonts for the Web you're able to, at least Comic Sans MS.
Also relatedly to the idea of doing source releases, it may be worth looking into doing officially blessed public -binary- releases of old Microsoft software. I'd imagine it would be at least somewhat easier to get past legal and would enable the masses of unwashed zoomers to experience gems like QuickBasic, early Windows and DOS versions, everything released for CP/M, and some products that MS acquired and subsequently buried and took the hatchet to, like Altamira Composer. Actually, on that note, a source release for Altamira Composer or MS Image Composer would also be really nice if it was in fact practicable.
I was sort of frustrated that while the source exists for 2.11 now, it doesn't quite build right out of the box into a free-standing disc image-- I think it was missing some data needed to build either MSDOS.SYS or IO.SYS. Once you have all the files, you still need a chicken and egg process to get to a bootable disc, not just a 360k image you can write to a floppy.
MASM is still shipping and being used, so hardly a candidate.
I'd love to see MS DOS 6.22 out into the world at some point if you can swing it!
Licensing issues would probably prevent this from happening, I can't comment on third party code from other sources, but rather famously, Microsoft got in trouble for disk compression code in the 6.x releases and had to substitute it later on. Personally, I would like to see one of the very late PC-DOS releases freed (7.1 or so), but considering IBM's indifferent to belligerent attitude on freeing their historical software, I don't see this happening any time soon.
Thanks for that response!

I am just glad Microsoft embraced open source and is even willing to open source some of their old tools. I fully understand... Sometimes people leave undesirable comments (swear words and curses for whoever breaks it, and so on...) so I appreciate anything you guys do. One of my secret hopes is someday I come on HN to find out that some if not all of Visual Basic 6 has been open sourced, that way I can always install it without having to sail the seven seas (an option I don't bother with anymore...) or trying to figure out where my old license key even went.

Quick question if you don't mind answering: Does Microsoft have a team that is devoted to just that full time? I'm assuming it would be your team, but is that essentially all or most of what your team works on?

I am not saying to stop sending some emails around and try to acquire third party IP permissions, but perhaps a contact to the IP rights might come out of the woodwork and speed up the processes if you release what you can while you are waiting.

Since this is mostly for historical interest, note what the IP is and what they do, for libraries, perhaps somebody will find a substitute or a version of library with similar functionality without the limitation. For images/sound just include blank ones of the proper dimensions/length and the same filename, if there is enough interest they can be remade.

Just to give you an idea of of the lengths preservationists are willing to go, people in the retroreversing community they are spending months to years converting by hand opcodes of binaries to annotated assembly or C code that compiles byte identically, a few non included IP bits shouldn't be much of a blocker to retro enthusiasts.

I was under the impression that they don't actually have the code for that pinball game.
Unfortunately, Microsoft doesn't own the pinball game - that was a Maxis production, one table from Full Tilt! pinball. Go talk to EA.
Not just "open-source", but actual MIT-licensed (aka Expat-licensed) Free Software:

https://github.com/microsoft/MS-DOS/blob/master/LICENSE.md

https://directory.fsf.org/wiki/License:Expat

Huh. Was not expecting that. Nice.

Edit: Of course they won't actually mention Free Software, because they don't want to acknowledge Free Software. smh

> actually mention Free Software

What would have satisfied you? I mean, MIT is "free software", what else do they need to say?

> Of course they won't actually mention Free Software, because they don't want to acknowledge Free Software.

What do you want, a love letter?

A sincere apology for the Halloween documents would be good start.
(comment deleted)
It's basically only the GPL family that mentions free software. They're the licenses forged out of the movement itself.

Everyone else is just happy to satisfy the spirit of the thing without giving it explicit mention.

What's the difference? The way most people use the term "open source" means the exact same thing as "free software", so I feel like this just being pedantic
Anyone understand why there is Xenix.asm in there?
Because Microsoft sold Xenix contemporary to early DOS? Some sort of comparability functions, perhaps.
Those files implement the "new" file handle API, which replaced FCB (File Control Block) from MS-DOS 1.0. It's somewhat inspired by Unix file descriptors.

It seems that "Unix" and "Xenix" were often used interchangeably in old Microsoft code. For example, there are 23 occurrences of "Xenix" in the MSVCRT.DLL source code (in the Windows 2003 SDK). This is one of them:

    crt\stdlib.h:241:_CRTIMP extern int errno;               /* XENIX style error number */
If I could pass my ideal version of copyright to the world, this is what I would dream:

1. Copyright is 20-30 years in length, maximum. (We can argue about that.)

2. For computer programs, a copy of all source code, build tools, and final binaries must be supplied in an offline format (maybe a Blu-ray Disc or a few?) to the Library of Congress to store, duplicate, and preserve as needed. This content will then be released on the copyright expiration, and the offline format is meant to render computer hacking ineffective for stealing the work. For software as a service that is continuously improved, new discs must be received yearly.

#2, I think, already has precedent considering the patent system. A patent is meant to describe how to perfectly recreate the patented technology (minus, maybe, a few trade secrets), so why not copyrightable software?

> #2, I think, already has precedent considering the patent system.

Deposit requirement is already part of the copyright system, applying to everything published that is subject to copyright unless exempted by regulation:

https://www.law.cornell.edu/uscode/text/17/407

Depositing assets is one thing, but the real change would be to deposit sources as well. Say, a book... if it got typeset on a computer, then the full files and fonts have to be deposited as well.
I can just imagine Donald Knuth reading this, running his hands with glee, and starting the next thirty years of his work.

Maybe keeping it nice and easy to start with by a six volume discussion of what a file is.

We do need major copyright reform, and I think even splitting copyright into categories makes sense. Some time-sensitive content, like sports and news broadcasts, might only warrant 4-5 years of copyright protection before becoming public domain. Books and movies may as well enjoy the 20-30 time frame you propose (the original 1790 copyright act offered a maximum of 28 years of protection, if you bought a 14-year extension to the default 14-year term). Software might warrant just 10 years of copyright protection, which is just about the maximum length that corporate support exists for; it could be reasonable to allow for a 10-year extension to an initial 10 years.
> a copy of all source code, build tools, and final binaries must be supplied in an offline format (maybe a Blu-ray Disc or a few?) to the Library of Congress to store, duplicate, and preserve as needed

Dude, I just want my turtle to move around on the screen. Now I have to ship Blu-rays to Congress?

Not your personal project, this idea was pitched solely for corporations who develop software. In my mind, this would most benefit video game preservation which is currently in a state of disarray. It would also protect corporations from themselves, as there have been multiple instances of high-profile retro games having their source code completely lost when they come back for a remaster.

A big example of this is Square Enix which lost the source code for multiple games, including (infamously) Final Fantasy 7. The remaster was a reverse-engineering project. They were also rumored to have lost Final Fantasy 8 though this was later shown incorrect. (And, in addition to that, they lost all of Kingdom Hearts 1). And that's just the mistakes we know of. (There's also Konami losing Silent Hill...)

That would effectively force most free software into the public domain?
> Library of Congress

I suppose the US is the only country in the world, and if I release software in Europe, I've got to ship it across the pond...

It's somewhat ironic that the country which seems to have the most people fear-mongering about "one world government" is also the country with the most people who think that their government is the only one in the world.
#2 may work for old software, but how can this work for contemporary, which even for "on premise" use receives frequent patches and updates? And becomes really tough with modern "cloud" (in broad meaning) software, which is tied to a lot of infrastructure.

And yes, I share the goal! I however don't see a practical way.

I think 20 years with N optional 10 year renewals (where N can be debated[1]). I'd like it to be short enough for the less-profitable works to make archivists jobs easier, but long enough for authors to be able to profit off of commercial adaptations (e.g. the GoT show appeared 15 years after the book was published).

I like #2, but it could be a burden; perhaps only registered works should do it (and registering would be required for renewals).

1: I like 3, which is much shorter than current copyright but significantly longer than you suggest

IMO, the optimal solution will be to make some kind of change in copyright law which distinguishes between personal, imaginative, creative works (like a novel or a painting) and corporate, formulaic, functional works (like a word processor or a textbook). Whether the line should be drawn along the personal/corporate axis or the creative/functional one is up for debate.
There are already some divides for personal/corporate (see e.g. the "Work for hire" rules), and purely functional works are already limited in how copyrightable they can be (see e.g. [1]).

Once you get away from purely functional into things like textbooks and word-processors, things get complicated quickly. If I write a word-perfect clone, that's pretty darn functional, yet I probably make lots of creative choices in the process that are hidden from the user. If it's a word processor with its own peculiar interface, there are even user-visible creative choices.

Did you perhaps mean aesthetic versus functional? If so, then that's even more of a treacherous area. How many people have Minard's famous chart[2] hanging on their wall for aesthetic reasons? Or what about e.g. Dr. Suess' books. Are those aesthetic, or are they an educational tool?

1: https://en.wikipedia.org/wiki/Lexmark_International,_Inc._v.....

2: https://en.wikipedia.org/wiki/Minard#/media/File:Minard.png

#2 wouldn't work internationally. Of course the US can internally have whatever kind of legislation they want, including whatever requirements for having one's works covered by copyright. But non-US authors or companies (or government organizations) obviously can't be obliged to supply materials to the US Library of Congress.

You could deny them copyright protection for their software within the US if they don't but that wouldn't be exactly popular.

Of course you could still do it purely internally within the US for software whose copyright belongs to US organizations or individuals, and it might achieve some of what you want.

I wonder if there are any copies of the "OEM Adaptation Kit" in the wild. Would be neat to be able to get this running on a not-IBM-compatable 8086 machine.
There's a copy of a MS-DOS 3.x kit around in the wild, yes. I think it might be 3.2, but I'm not sure.

When I say "in the wild" I obviously mean "yo ho ho and a bottle of rum"; nothing authorised.

Just crazy they wrote all of the command line tools in ASM - was that because C would have resulted in binaries that were too large?
I don't think C and x86 real mode with segment:offset addresses mix that well. Obviously there were compilers that did it (and then those "near" vs "far" pointers ...), but it's not great.

I think once you got to a flat 32 bit address space and more than 1mb of memory, C starts to make more sense.

(comment deleted)
IIRC the classic Macintosh for example, even despite the flat memory model, had relocatable code segments to deal with real memory limitations, with a relocatable base + fixed offset jump table. They're not identical situations, but I think Think C had pragmas to delineate segments (although my memory is shaky there).
It had them yes, and was mostly coded in Assembly and Object Pascal.
It wasn't that bad. You had different memory models back then. If you wanted to keep things easy you just compiled for a memory model in which each pointer was either 16 bit (for code/data smaller than 64kb) or a memory model with far pointers (access to all the memory).

There have been mixed memory models and you could go crazy with near and far to break out of the limits of the easy memory models.

Most of the time it was just a mater of picking a suitable memory model for your code and forget about near/far though. Not so different than today.

Yep. The "tiny" model gave you a single 64KB segment shared by both code and data. And the "small" model was the one where there was one 64KB segment each for code and data.

IIRC, with the tiny model you could often compile those to .COM files where MS-DOS would pick a free segment, load the file to the 0x100 offset, set all the segment registers to it, set the stack pointer to 0x0, and jump to the start at 0x100. Super simple (not even an executable header)!

C and x86 real-mode works just fine, why would it not? Yes, the segmented model is a bit of a pain but totally doable and it's not just a problem when programming C but also x86 Assembler, Pascal, etc. Even in Q(uick)Basic you won't get around it once you start to do more advanced system things.

http://alexfru.narod.ru/os/c16/c16.html

But indeed, we were all glad when the 32bit flat model was introduced with the 386.

They wrote a this before they had a good C tool chain. Microsoft didn't have a C compiler until 1985 which was a repackaged version of Lattice C.
Also the first IBM pc had what, 64kb of ram? It makes sense to do hand optimized assembler for that.

Segmented architecture has nothing to do with it, there was support for it in any Compiler that targeted the platform. And besides, it was how you did things back then, no surprises there.

Contrary to urban myths, C was only yet another language during the 1980's, and hardly used outside UNIX.
(comment deleted)
Now do Windows 2000! We'd need only modern hardware support and a few QoL / security updates and we'd have the perfect OS.
That's what ReactOS kinda wants to be — it targets Windows Server 2003 compatibility right now. It's still far from a usable state though.
Int 21H will be eternally fried in my brain.
I wish the source code of Netware 286/386 was made available - nobody uses it but it would be interesting to see how they did things.
Oh, nice..

I browsed a little through the code, and found that sort.com used self-modified to change the sorting order:

  ; note! jae is patched to a jbe if file is to be sorted in reverse!
  ;
  CODE_PATCH LABEL BYTE
         JAE     INNER_SORT_LOOP

I committed similar crimes in the 90th as well, but that was just me as a teenager programming stupid games in asm for fun and giggles. Not for commercial software.
Asynchronous I/O figures in prominently in Windows NT but I just assumed it wasn't ever thought about in DOS (being single-tasking and single-user). I was really surprised to see[0]:

Each driver in the chain defines two entry points; the strategy routine and the interrupt routine. The 2.0 DOS does not really make use of two entry points (it simply calls strategy, then immediately calls interrupt). This dual entry point scheme is designed to facilitate future multi-tasking versions of MS-DOS. In multi-tasking environments I/O must be asynchronous, to accomplish this the strategy routine will be called to queue (internally) a request and return quickly. It is then the responsibility of the interrupt routine to perform the actual I/O at interrupt time by picking requests off the internal queue (set up by the strategy routine), and process them. When a request is complete, it is flagged as "done" by the interrupt routine. The DOS periodically scans the list of requests looking for ones flagged as done, and "wakes up" the process waiting for the completion of the request.

I didn't realize that kind of forwarding-looking perspective was going into the design of MS-DOS.

[0] https://github.com/microsoft/MS-DOS/blob/master/v2.0/source/...

Reminds me of TSR (terminate and stay resident) programs, which felt like magic (I was happy to implement one a long time ago). TSR is an embryo of that in a way!
This brought back memories of school when some of us cheated on programming exercises by calling up a TSR program with solutions when the teacher was out of sight. Good times.
I've been looking for TSR & Packet driver coding examples and resources (for a non-keyboard triggered use case). I want to implement a localhost only webserver as either a TSR or Packet Driver.
Have you taken a look at mTCP[0]? There would be some good example code there. The TSR portion wouldn't be included in the mTCP code, but there is definitely code there for a webserver.

[0]: http://www.brutman.com/mTCP/mTCP.html

I have and that's the thing. Every webserver I'm aware of runs in the foreground unlike TSRs and PacketDrivers. I'm looking for a webserver that runs in the background.
I wonder how many of such drivers that would in reality only work when those two are called in succession
They copied this driver model from UNIX/XENIX. However the way it was implemented in DOS, the interrupt routine had to always return with the "done" flag set, so a driver that was compatible with it wouldn't ever be possible to run asynchronously on a newer version.

There actually was a multitasking version of MS-DOS, but it was only licensed to a few OEM's. These disk images surfaced about 10 years ago:

https://www.pcjs.org/software/pcx86/sys/dos/microsoft/4.0M/

https://www.os2museum.com/wp/multitasking-ms-dos-4-0-lives/

I knew that "Concurrent DOS" existed (non-Microsoft product) but I didn't realize that Microsoft did a multitasking DOS themselves. Very cool. Thanks for the pointer.
Thanks for the links. PCjs is amazing!