Wednesday, August 8, 2007

Is DOS a Rip-Off of CP/M?

Paterson v. Evans lawsuit dismissed

In his book They Made America (Little, Brown & Co., 2004), author Harold Evans revives claims that DOS is based on the late Gary Kildall's CP/M, using words such as "slapdash clone" and "blatant copies". I sued the author & publisher for making false and defamatory statements.

The case was dismissed last week shortly before it was to go to trial. The main reason this happened is because the judge ruled that I am a “limited purpose public figure.” This sets a very high bar of protection for free speech, leading the judge to then rule that the book represented protected opinions.

Facts not in dispute

What may be most surprising about the issue is that there is no significant dispute on the actual relationship between DOS and CP/M. The relationship is simply this: DOS implements the same Application Program Interface (API) as CP/M. The API is how an application program (such as a word processor) asks the operating system to perform a task, such as to read or write a disk file.

There is no suggestion that I copied any CP/M code when I wrote DOS. (To this day, I have never seen any CP/M code.) And the internal workings of DOS are quite different. For example, unlike CP/M, DOS used the FAT (File Allocation Table) system for organizing disk files, which made it much faster but meant floppy disks were not interchangeable between CP/M and DOS.

One point of disagreement: In his memoirs (quoted by Evans), Kildall claims that I dissected CP/M to learn how it worked. This is not true, and it doesn’t even make sense. Since DOS worked so differently, there would have been nothing I could learn from CP/M’s internal workings to help in writing DOS.

What do I mean by “implement the same API”? Every operating system has basic functions like reading and writing disk files. The API defines the exact details of how to make it happen and what the results are. For example, to “open” a file in preparation for reading or writing, the application would pass the location of an 11-character file name and the function code 15 to CP/M through the “Call 5” mechanism. The very same sequence would also open a file in DOS, while, say, UNIX, did not use function code 15, 11-character file names, or “Call 5” to open a file.

Translation Compatibility

Since CP/M and DOS both had the same API, you would think that a program for one would run on the other, right? Wrong. CP/M was only for 8-bit computers based on the 8080 or Z80 microprocessors. DOS was only for 16-bit computers based on the Intel 8086 microprocessor. At the time DOS was written, there was a vast library of 8-bit CP/M programs, none of which could run on 16-bit DOS computers.

While 8-bit programs could not run on 16-bit computers, Intel documented how the original software developer could mechanically translate an 8-bit program into a 16-bit program. Only the developer of the program with possession of the source code could make this translation. I designed DOS so the translated program would work the same as it had with CP/M – translation compatibility. The key to making this work was implementing the CP/M API.

So sue me

When you boil it all down, the thrust of Evans’ story is that Kildall and his company, Digital Research (DRI), should have sued for copyright infringement and DOS would be dead. CP/M would have then been chosen for the IBM PC (because it was the only choice left), and the history of the PC would be much different.

While DRI was free to sue for copyright infringement, the likely success of such action is still controversial at best. The question was whether the published API, used by all the applications that ran under CP/M, was protected from being implemented in another operating system. There are experts who say no, and there are experts who say maybe, but from what I can tell as of 2007 there is yet to be a successful finalized case.

I say that because Evans & I each brought our own copyright experts into our negotiations to settle the case. Mine was Lee Hollaar of the University of Utah, while Evans used Douglas Lichtman of the University of Chicago. Lichtman provided a handful of case citations to show “that the issues here are not clear in either direction, and, in a hypothetical copyright suit filed by Kildall, he might have won and he might have lost.” But the only case that seemed to support DRI’s side was a preliminary injunction in 2003 (Positive Software v. New Century Mortgage). We didn’t think it really applied, and as a preliminary injunction it hadn’t gone through a full trial, let alone appeal. I would suppose this is the best he had. Hollaar said to me “I feel that it's clear from the cases under similar circumstances that you would have won.” I have wished my suit against Evans could have really become a copyright suit about CP/M & DOS so this could be settled.

If tiny Seattle Computer Products had been sued by Digital Research back when DOS was new, I’m sure we would have caved instead of fighting it. I would have changed DOS so the API details were nothing like CP/M, and translation compatibility would have been lost. But in the end that would have made absolutely no difference. No one ever used or cared about translation compatibility. I had been wrong to think it was a valuable feature.

Lichtman mentioned to me that he was working for SCO in their lawsuits against Linux. If I understood him correctly, SCO was trying to establish that an API can be protected by copyright, so it could be used to collect royalties on Linux, whose API is the same as or similar to UNIX.

23 comments:

  1. Tim, this is great stuff. Now that the suit is behind you perhaps you could post some more interesting historical tidbits about the early days of DOS.

    ReplyDelete
  2. Wow. Well, it shows that it pays to really find out whether a given feature is worth putting in. This is amazing stuff at least to us geeks...

    ReplyDelete
  3. Ever notice how fast Windows runs? Neither did I.

    ReplyDelete
  4. What was the nature of your relationship with Bill Gates?

    ReplyDelete
  5. "Not even Intel could provide me with an 8086 assembler to do the most basic programming, so I wrote one myself. It was actually a Z80 program that ran under CP/M, but it generated 8086 code."

    This might make it kinda like a cross assembler :)

    ReplyDelete
  6. Now we've got a BBC talking point in Bill Gates' legacy, and the Eurofools on said board cannot even get the origin of DOS down pat. Somebody was saying that IBM Germany developed it in the 70s. Sheesh!

    ReplyDelete
    Replies
    1. "Somebody was saying that IBM Germany developed it in the 70s. Sheesh!"

      IBM did develop BOS, TOS, DOS/360 in the 60s. And they had promoted the OS meme.

      Delete
  7. This info is certainly questionable, and unreliable. I can tell you this since my old boss, Pat Martini of CCT (in business 1976-2000), actually obtained early CP/M code, licensed from Kildall. It was later used to write a small proprietary operating system to run on Gordon Moore's 8085 CPU for a large government military contract, among other proprietary projects.

    It is said that Martini actually wrote (rewrote/implemented) the first 16 CP/M operating system calls - the low level hardware controls, way back in the very early days of DRI. Note that, contrary to many non-verified claims, MS-DOS has and still does contain the same 0h-0Fh calls!

    CCT's later Concurrent DOS 86 operating system, from other Kildall licensed code, was rewritten originally for S-100 bus systems as part of a huge government contract, and later ported again for use on the very large VME bus systems in the mid 1980's, for a Pentagon 'top secret' Central American incursion.

    (Later side note): It is interesting and somewhat amusing to note that the above systems somehow found their way into the motor vehicle department of a large Central American capital city and were still in use as of the early 1990's!

    All of the above used Digital Research based operating system technology licensed from Gary Kildall, a long time friend of Martini. Check out Byte magazines from the early to mid 1980's to see the huge CCT multi-page centerfold ads.

    Note that CCT did all that for over 25 years using several iterations and reiterations of Gary Kildall's CP/M operating system! Additional CCT information is difficult to locate, however, probably because of all of the top secret government contracts and legal problems and that followed during the late 1980's.

    I heard a while ago that Martini is still around doing new computer things with much more modern hardware and operating systems! He relinquished all of his DRI licensing to a third party in the early 1990's. That included CCT's rewritten ANSI standard version of Gary's original 16bit C compiler - this was under a single proprietary license granted exclusively to Martini/CCT as the sole owner!

    Cool history! J. Loggins, former CCT Director of Hardware Operations.

    ReplyDelete
  8. This guy "Alessio Di domizio" in this article
    http://www.appuntidigitali.it/3070/gary-kildall-il-vero-padre-del-dos/

    say that (please see comment number 23)

    QDOS ha copiato illegalmente il *sorgente* di CP/M ,non l’interfaccia.

    In english

    QDOS has copied integrally *the souce code* of CP/M, not the interface.

    This is real?

    ReplyDelete
  9. Nice to see that the original QDOS person is clarifying things...Even if one accepts Patersens claim that no Assembler code was actually copied from CP/M, only APIs were referred to, one can still see that without the pioneering work of Kildall on CP/M, there would not have been any DOS in the form we know today. There would have been other OSs just like Apple etc. Many universities were playing with microprocessor code that time... many tried OS-type code... But undoubtedly Gary Kildall was the pioneer.

    Kildall could have fought back .. on his own ...He could have given DR-DOS free... Even early 90s was not late... but it was not to be!!!

    ReplyDelete
  10. Just wanted to say thanks for taking all your time in writing this as it made a very interesting read on finding about the history and origins of DOS.

    I also wanted to say it would also be quite interesting if you ever decide to continue on with it but maybe in a book of some sorts.

    ReplyDelete
  11. Useful article! I have some limited CP/M experience. Also, I wrote my own DOS emulator for Linux (called DOSRUN) using vm86 sycall of the Linux kernel, and writing my own implementation of DOS interrupts, and some structures, coded in C. I realized that DOS seems to be a mixture of CP/M and UNIX ideas, structures ("API"), but I never knew what was the reason. Now I know that there was some kind of goals that one can port/translate/etc programs under DOS more easily. Thanks for the information!

    ReplyDelete
  12. Great story, thanks! I've got a question. You wrote:

    « If tiny Seattle Computer Products had been sued by Digital Research back when DOS was new, I’m sure we would have caved instead of fighting it. I would have changed DOS so the API details were nothing like CP/M, and translation compatibility would have been lost. But in the end that would have made absolutely no difference. No one ever used or cared about translation compatibility. I had been wrong to think it was a valuable feature. »

    Why didn't people care about translation compatibility? Implementing a widely targeted API seems like a smart thing to do. Programmers could have quickly ported their applications to QDOS. Customers might have thought that this would guarantee an ample supply of software. So why didn't the idea catch on? Because back then programs were written also to the hardware, not only to the OS?

    ReplyDelete
  13. MsDos got an important life extension with the introduction of the IBM AT.

    The IBM AT would boot with the words "AT Multiuser System" on the screen. Ever wonder what that meant? Digital Research was implementing a multiuser CP/M to run on the 286 chip. The intended design was to allow a AT to have multi-port serial boards with users using serial terminals to access the system.

    So what happened to that OS? Concurrent Dos, as it was named later, did find use in many systems. But the full-scale public release as a shipping component of the AT never happened. The way Gary and other DR staff explained it to me, there was a change in the 286 chip that caused multitasking bugs. The change in the chip was intended to improve yields, but had unintended results.

    IBM could have pressed Intel to fix the problem with the chip, but that problem got the IBM management thinking. IBM is managed by the sales department. So the people calling the shots are vary focused on sales, and not on engineering. In doing some analysis on the impact to sales, the question of "how many AT's will we sell?" is a basic foundation for the decision process. So think about it, do you put one AT in an office, and have 16 people connected to it with Wyse terminals? Or do you sell the same office 16 PC's? Which would make more money?

    Concurrent Dos failed to be shipped with the system that was designed to run it, because IBM decided they could sell more computers if they didn't ship the AT with it's intended multiuser system.

    It was a sad day for the indistry, dos based desktop computing would have had a new set of capabilities had IBM not killed the AT Multiuser System. This was not the first time IBM decided to compromise the design of the PC... but it may well have been the last time. The AT was the last important contribution to the PC line. Clone makers took over after that, with few of IBM's later designs getting enough traction to make a difference. Sure many parts of IBM's later designs were used in other systems, but none of their later systems, such as the PS2, had much impact.

    But the lost multiuser capabilities were in UNIX and big-iron systems, so the concurrent multiuser PC was only delayed. But I wager that Microsoft might have had less money to spend on launching Windows if they had lost the AT market to the multiuser system. That system could have shifted the money from Bill Gates to Gary Kildall.

    I was employed by Gary in the late 1980's and early 1990's. I was his hardware designer for the Intelliphone, a smartphone platform who's touch-screen prototypes resembled today's iPhone. During the time I was designing the Intelliphone hardware, DR Dos was the hottest thing going. Windows ran better on DR Dos than MsDos, because the built-in memory manager provided more usable memory to Windows. To shut that down, Microsoft changed Windows to detect the underlying OS, and to through up a fake blue-screen if it detected DR Dos.

    ReplyDelete
  14. so basicaly u are the one who created dos thats not fare you created and bill eat money
    sir i am great fan of yours sir i have an idea for us pls sir if you are ready to work with me then contact me, i have brilliant ideas and i am low programmer thats why want u sir we can make sums of money,
    contact me:
    mayurtherockstar@live.co.uk

    ReplyDelete
  15. "There is no suggestion that I copied any CP/M code when I wrote DOS. (To this day, I have never seen any CP/M code.) "

    If you compare the first 40 DOS INT21H services with the CP/M BDOS services, the similarity between service number and function is striking.
    Offcourse this could be a coincident, who am i to judge.

    MSDOS: http://en.wikipedia.org/wiki/MS-DOS_API#DOS_INT_21h_services

    CP/M: http://www.seasip.demon.co.uk/Cpm/bdos.html

    ReplyDelete
  16. @Snurrberget: Yes, that would be part of reimplementing the CP/M API in DOS, as the author has explicitly said he did. All you need for that is the programming manual. This is *not* the same thing as copying the code. It doesn't even require looking at the code. It is just implementing application compatibility with a competing system, which is not prohibited by copyright (as also shown by the fact that SCO has since lost its copyright case against Linux, which also does nothing but reimplement the UNIX API in a new system).

    ReplyDelete
  17. I'm pretty sure that the first version of WordStar for the PC did use the automated translation facility. But they followed it up very quickly with a second version that took advantage of the PC's memory-mapped video to speed up output, and therefore didn't use the translation procedure.

    ReplyDelete
  18. No, I guess I was wrong. WordStar 3.0 for MS-DOS was ported from the CP/M-86 version, not directly from the CP/M-80 version.

    ReplyDelete
  19. I suppose you are right, given the Oracle vs. Google case that concluded APIs are not in fact copyrightable.

    ReplyDelete
  20. SOLO QUIERO MANIFESTAR MI ADMIRACIÓN POR QUE HOY ME DI CUENTA QUE NO FUE Bill Gates SI NO Tim Paterson QUIEN ESCRIBIÓ EL SISTEMA OPERATIVO DOS

    MUCHAS GRACIAS POR TODA ESA GENIALIDAD

    Att Gabriel Gomez Resterpo
    gabriel7012@gmail.com

    ReplyDelete
  21. An API is just a way of securing specific points in a system as a reference to pass information in a specific manner.

    That said MSX-DOS v1 is 100% CP/M compatible, running on 8 bit Z80 (nah 8080), and that is 100% based on MS-DOS sources.

    If I remember correctly, a 8086 DOS program compile with 16bit compatible 8080 mnemonics can execute on MS-DOS

    If I understand Bill Gates of the time, it would have made sense that any newly acquired OS for the IBM PC should easily run software originally written for CP/M use.

    Unless Gate specifically asked Paterson to provide a 16bit CP/M compatible OS, I think it was pure luck QDOS was around when Bill needed it for the unreleased IBM PC as its agreed OS.

    There _may_ have been collusion on IBM's part, considering they had already been turned down by DRI as its main OS. Hell its possible that they even asked Bill to provide an OS that was able to run CP/M software, and not that famous idea he just offered to provide an OS, as it was behind closed doors after all.

    Who know, moot question, and in the end Caldera vs Microsoft was NOT over CP/M compatibility ...

    Cheers

    Paul

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete