By the time personal computers based on microprocessors began to emerge in the mid-1970s, programmers had been writing operating systems – the software that manages the computer hardware and provides commonly used services for application programs – for about twenty years. Big mainframe computers had operating systems that were huge and complicated, created from hundreds of thousands of lines of code. But other operating systems, designed to fit in the small memory of minicomputers, were tiny. That was the kind that the PCs could use.
Computer Scientist Gary Kildall created just such an operating system in 1974 for a small computer called the “Intellec-8″ that Intel had designed to showcase their new microprocessors. Called “CP/M”, it was unlike most other operating systems for small computers because it was written in PL/M, a portable higher-level language that he had designed earlier, rather than in the assembly-language of a particular computer. That meant that CP/M could be ported to run on many different personal computers. And if the applications were written in PL/M, they could be ported as well.
The early availability of CP/M, combined with its portability, made it a runaway success. Kildall started a company called Digital Research, Inc. (DRI) in Pacific Grove, California to develop and market CP/M, and for years it was the dominant operating system for personal microcomputers. It was eventually overtaken by Microsoft’s MS-DOS for the IBM PC in the 1980s, but before then it was responsible for a vibrant ecosystem of application programs that contributed to the rapid proliferation of the early personal computers.
To mark the 40th anniversary of the prototype demonstration in Kildall’s backyard tool shed in Pacific Grove in the fall of 1974, the Computer History Museum is pleased to make available, for non-commercial use, the source code of several of the early releases of CP/M.
To go to the download section, click here.
In the early 1970s, Gary Kildall was an instructor in computer science at the Naval Postgraduate School in Monterey, California. He was also a part-time contractor for Intel, and he began using an Intel development system to create software for that young company’s new microprocessors.
In 1974 Kildall wrote a program that allowed microprocessor designers to replace slow paper tape storage with the new fast 8″ floppy disks that were becoming commercially available. Initially called Control Program/Monitor, later renamed Control Program for Microcomputers (“CP/M”), his program proved to have value far beyond fulfilling the requirements of his part-time consulting gig for Intel. When it was fully configured as a commercial operating system in 1976, CP/M elevated a hobbyist activity into a mainstream personal and small business computer tool, and in doing so it laid an important foundation for the personal computer revolution.
Early versions of CP/M were written entirely in PL/M (“Programming Language for Microcomputers”), a high-level systems programming language he developed for Intel in 1972 for its microprocessor development systems . Primarily a subset of the mainframe computer language PL/I, it also incorporated ideas from ALGOL and XPL, and included an integrated macro processor. In an article presented at the 1975 National Computer Conference , Kildall called CP/M “modest in structure and scope”, but “allowing access to all machine functions, without becoming completely dependent upon a particular CPU organization.”
Starting in the late-1970s, one of the premier publications for the incipient personal computer software industry was the unusually-named Dr. Dobb’s Journal of Computer Calisthenics & Orthodontia. In the January 1980 issue, Gary Kildall published a personal memoir  about the creation and growth of CP/M. These sections quote liberally from that article.
The first generation of software for microprocessor-based systems was developed using mainframe timesharing systems. Kildall dreamt of the day that the microprocessors themselves could be used to develop their own software.
He realized that a key requirement was better storage, and that there was something appropriate on the horizon.
Not one to let the lack of hardware be an impediment, Kildall proceeded to develop CP/M using a timesharing simulator.
Assistance to build the hardware interface to the floppy disk did materialize, however, allowing CP/M to come to life.
The proliferation of CP/M depending on it being adopted by PC manufacturers. Kildall’s hardware savior was the first adopter.
It quickly became clear that in order to make adaptation to other computers easy, the hardware-dependent portions had to be segregated into a separate, easily-changed part.
It was a successful strategy. DRI licensed CP/M to IMSAI for a one-time fee of $25,000, and others soon followed.
Before CP/M, computer manufacturers designed their operating systems to work only with their own hardware and peripheral equipment. An IBM operating system would only work with IBM computers; a Burroughs operating system with Burroughs computers, etc. And applications had to be written for the specific operating system of each computer. Such “closed systems” made it difficult or impossible to mix and match the best pieces of equipment and software applications programs from different manufacturers.
Kildall’s addition of the BIOS allowed not just IMSAI systems but all Intel 8080 and compatible microprocessor-based computers from other manufacturers to run same the operating system on any new hardware with trivial modifications that could be accomplished by a programmer in a few hours. This capability stimulated the rise of an independent software industry by expanding the potential size of the market for each product. A single program could run without modification on computers from multiple suppliers.
Together with his wife Dorothy McEwen, Kildall incorporated Digital Research, Inc. in Pacific Grove in 1976 to market CP/M version 1.3, which incorporated the BIOS code. Through mail order advertisements in Byte magazine and other publications, the word got out that there was a manufacturer-independent operating system available.
There was little competition. CP/M was first sold by mail-order to hobbyists for $75 . It later became a standard OS offered by many pioneering personal computer manufacturers, such as Altair, Amstrad, Kaypro, and Osborne. By 1980, about 200 different computer models were running CP/M.
CP/M was initially limited to personal computers based on the Intel 8080 microprocessor and its derivatives. But CP/M and the application programs written for it provided such value that it was reasonable to do a “brain transplant” and install an additional microprocessor into computers that didn’t have an 8080 or compatible chip. Microsoft, for example, built a Zilog Z80-based “SoftCard” for the otherwise incompatible Apple II because they were a supplier of language compilers and interpreters for CP/M. It also enabled the Apple II to run popular CP/M applications such as dBASE and WordStar.
DRI released many versions of CP/M, of which the largest seller was version 2.2 in 1979. They also developed multiuser (MP/M), multi-tasking (Concurrent CP/M) and networking (CP/Net) versions. By 1982, the company enjoyed annualized sales in excess of $20 million, employed more than 200 people, and claimed that “more than a million people” were using systems based on its technology.
In 1980, Tim Paterson at Seattle Computer Products used DRI’s 1976 CP/M Interface Guide and other information to guide the development of QDOS, a new operating system with the look and feel of CP/M but different internals, which he was writing for the new Intel 8086 16-bit microprocessor. Microsoft later acquired QDOS and licensed it to IBM as PC DOS, and to other PC-compatible manufacturers as MS-DOS.
Because of the popularity of the IBM PC platform, by the mid-1980s’ CP/M had lost its market dominance to MS-DOS. For more information about the MS-DOS story, see another in the Computer History Museum Historical Source Code series: “Microsoft MS-DOS early source code“.
CP/M and the other operating systems for small personal computers, including MS-DOS  and Apple DOS , were very different from the operating systems we know today, or the ones that were on the large mainframes in the 1970s. A PC-based operating system was basically just a file management system, a rudimentary text command processor, and a way to load application programs. CP/M came with five built-in commands (for saving, erasing, renaming, listing, and typing files), and nine additional “transient” commands. There was no graphical user interface, no loadable device drivers for new peripherals, and no memory management system.
The “Introduction to CP/M Features and Facilities” manual initially published by DRI in 1976  describes its key features:
The original implementation of CP/M used only Kildall’s high-level PL/M language. The later versions of CP/M that had a separate BIOS used a mix of assembly-language and PL/M.
Although CP/M disappeared as a mainstream operating system, echos of it still survive. As recently as early 2014, whenever the IBM OS 4690 operating system booted up in point-of-sale terminals around the world, it displayed the notice “Copyright © 1976 Digital Research”.
CP/M was indisputably an important part of the early personal computer revolution. In April 2014 the Institute of Electrical and Electronic Engineers recognized the development of CP/M as an IEEE Milestone in Electrical Engineering and Computing by installing a bronze plaque outside the former DRI headquarters at 801 Lighthouse Avenue, Pacific Grove.
We are releasing scanned printer listings and/or machine-readable source code for four early versions of CP/M dating from 1975 to 1979. Some versions are incomplete, but please don’t ask us for what is missing because we are releasing everything we have.
This material is provided for non-commercial use only. All the files are combined into one ZIP file with four directories representing the four versions.
If you would like to support the Computer History Museum’s efforts to preserve and publish historic source code like this, please consider making a voluntary contribution.
This is the earliest source code for CP/M we have, dating from before there were official version numbers. It was used at Lawrence Livermore Labs for their Octopus  network system. Another variant was produced for terminal-maker Omron.
CP/M was originally written in PL/M and compiled with Intel’s FORTRAN-based cross-development tools running on a timeshared mainframe computer. The object code was in an Intel hex tape format that couldn’t be linked with other objects, which meant that the BIOS and the BDOS had to be in a single source code module. This version also had no fixed entry point for operating system calls; application programs had to call the BDOS entry point using the “magic address” of where it compiled to.
Built-in commands had a long form (“DIRECT” for directory listing) and a short form (“DIR”). But they were primitive. If you typed “DIR”, it showed nothing; you needed to type “DIR *.*” to show all files. Udo Munk, a dedicated CP/M enthusiast, observed, “One also can’t do DIR B:*:*. One first has to switch to B: and then run commands there. This shows very well how this all was improved over the time. It must have been a very dynamic process of constantly trying and moving forward.”
For this early version we have original PL/M source code files for the BIOS and BDOS, for the Console Command Processor, and for the Transient Command Loader. These were recovered by Udo Munk from the CP/M Users Group disk #5. Other files in this directory are later reconstructions by Udo; see the readme.txt file for more details.
In response to the need to supply another version of CP/M to microcomputer maker IMSAI, Kildall realized that he needed to start making it easier to modify for different computers. In version 1.3 the BIOS and BDOS were separated and separately compiled. The BIOS was rewritten in assembly-language so that it has easy access to hardware I/O registers. There was now a permanent entry point at location 0005 for BDOS calls. This is, in essence, the first public release of CP/M.
The authentic source code we have for this version, courtesy of Steven A. Ness, is a scan of a printer listing that was released by Digital Research in 1976. Steve describes how he acquired the manual from Gary Kildall:
There is a gap of several lines on page 78 of the listing. The missing code has been reconstructed by Larry Greene from a later version and is included as a text file in the directory.
Update on August 2, 2016: Bob Zeidman has created text files from the image scans of the code, and they are in the Zeidman_code subdirectory. Thanks, Bob!
For version 1.3 we also have an amazing 48-page reverse-engineered source code listing that we think was written by Wayne Gramlich and modified by Leo Kenen. Even though CP/M was partially written in PL/M, this carefully constructed hand-annotated disassembly of the object code was made without access to the original source code. The author analyzed the code and created his own original comments. In some places he noted that he wasn’t sure whether the object code was compiled from PL/M or assembled from 8080 assembler code! The printed listing is dated 1980, but the disassembly was probably done earlier. If anyone knows more about this tour-de-force, please let us know.
Manuals related to this release are:
In this version the BDOS has been divided into two parts: a main PL/M body, and a “BDOS Interface Module” written in assembly language.
This is the first version that didn’t require a mainframe computer to build. Compilation and assembly was done on Intel development systems running ISIS, which had a PL/M compiler and a macro assembler.
For this version we only have the BDOS source code, in its two parts.
Manuals related to this release are:
Version 2.0 considerably expanded and generalized access to disks. There could be up to 16 logical drives with 8 MB each, as specified by a “disk parameter block”. Files could be spread over up to 512 extents. There was also a new concept of users with “user numbers”, whose files are kept separated.
The source code of this version, thanks to former Digital Research VP of Engineering Tom Rolander, is a scan of the source code listing released by the company in 1979.
We also have machine-readable source code for most of the files. We suspect they have been retyped from the listing, so they may have errors, but spot checks are encouraging about their accuracy.
Manuals related to this release are:
Thanks to Steven Ness, Tom Rolander, and Udo Munk for donating source code, and to Al Kossow, Dag Spicer, Udo Munk, and Len Shustek for contributing to this blog. Thanks also to the many other CP/M enthusiasts and former employees and consultants of DRI who inspired this source code release project, including Larry Greene, Herb Johnson, Emmanuel Roche, and John Wharton.