Was DOS copied from CP/M?

August 06, 2016

zeidman-August 06, 2016

Cleaning the Code
I had access to several versions of CP/M source code, but the most complete early version was a low resolution, dot matrix printout of version 1.3. I had to perform a number of time-consuming steps to get usable code.

First I had to remove things that were not source code, including stamps on each page indicating that the code is copyright by Digital Research in 1976. I had to cut out the stamps from each document page image and replace any underlying text that I could identify. I also manually cut out line numbers on the left margins and memory maps that weren’t part of the actual source code.

Some of the code ran off the printed page. Usually these were comments, which didn’t affect the functionality of the code but might have contained potential clues to copying. Unfortunately, anything printed off the page was lost forever.

I then performed OCR scanning on each page image and did several passes of manual corrections where the OCR didn’t produce good results, usually because the printouts weren’t clear.

I found a number of places where strange strings of characters showed up or unusual instructions that weren’t documented anywhere. I initially assumed these were some kind of deprecated instructions and searched online, put questions on various CP/M groups, and even asked Tom Rolander, DRI’s first employee. No one could identify these strange instructions. When I eventually saw a pattern, I realized that these were printer glitches causing extraneous letters to print at random times, and the printer to spew out random strings at other times. Carefully eliminating these superfluous characters, I ended up with legitimate source code that ran through an assembly language parser without errors.

Source Code Comparison
For the code comparison, I used the forensic techniques that I’ve developed at my consulting company Zeidman Consulting over the past 15 years or so, as well as the CodeSuite® tool from my software company Software Analysis and Forensic Engineering and followed the procedure that I’ve written about in my textbook on software forensics[11].

Searching for Clues
The first part of the process is to search for certain clues in the source code including the string “copyright,” company names, programmer names and initials, and any other relevant terms that can be thought of. You might be surprised how many times a copyright notice for company A can be found in the source code for company B it was copied.

Interestingly, a search for the terms “CP/M” and “CPM” produced some results in the DOS source code:

; 1.12 10/09/81 Zero high half of CURRENT BLOCK after all (CP/M programs don't)

STOSB ;Set it to zero (CP/M programs set low byte)

STOSB ;Set it to zero (CP/M programs set low byte)

STOSB ; Set it to zero (CP/M programs set low byte)

 

My research and my reading of the code led me to believe that the code above has something to do with the file system. Because it discusses differences between DOS and CP/M, it’s interesting, but not proof that the code was copied from CP/M. However, I also found the following reference to CP/M in the DOS code:

XOR AX,AX   ; zero extent, etc for CPM

DOCHAR:

  MOV     AL,BYTE PTR [BX]

  CMP     AL,1AH             ;^Z?

  JZ     FILEOFJ             ;CPM EOF

  CMP    AL,0DH             ;CR?

  JNZ     NOTCR

  MOV     [COLPOS],0

 

JZ FILEOFJ  ;CPM EOF

 

The CP/M file system used fields called “extents” to keep track of files in directories. The sizes of CP/M files were stored in sectors of 128 bytes each. If a file filled up less than the 128 bytes of the last sector, the other bytes were filled with an ASCII Control-Z character as an end-of-file (EOF) marker.

DOS had a different way of keeping track of files, by recording file sizes in bytes, and so no EOF marker was needed. The code above seems to indicate that MS-DOS could read CP/M files and had special code to do so, but my initial research showed that CP/M files were incompatible with DOS. Was this a clue to copying?

The answer is no. Further research showed that very early versions of DOS were designed to read and write CP/M files. The code I found confirms that compatibility. Eventually that compatibility was dropped from DOS. This is not a sign of copying.

< Previous
Page 2 of 4
Next >

Loading comments...