The 1979 CP/M OS— How Does It Look Today?

I work as a software developer for many years, the very first systems I tried to write programs for, were MS-DOS and Windows 3.1. Once I got curious — how people used computers in the old times before I was born?

Now it’s easy to get an answer to this question — we can run this system on a modern PC. I will show how to set up the CM/M emulator and run some of the original software of that time.

Hardware

Before we start, its interesting to see what sort of hardware was in use. The average computer 40 years ago was something like this:

Source © https://en.wikipedia.org/wiki/Intertec_Superbrain

This machine has a 2 MHz Z80 CPU, 16 KB RAM (can be upgraded up to 64), two 170 or 340 KB floppy drives. As a top configuration, the 10 MB hard disk drive could be added. The price was about 2000–4000$ depending on the configuration.

How does it work? Let’s figure it out.

CP/M Setup

Nowadays there are several CP/M emulators available. For Windows, we can use iz-cpm, which can be downloaded for free from Github. Another good emulator, that I’ve used for Linux, is RunCPM.

For Windows, we need to download the iz-cpm, unpack it and run download.bat that included in the archive. Several CP/M software packages will be downloaded to the software folder. Then we can run the emulator and specify which folders will be mounted as virtual “drives”. For example, we can mount “cpm22” as an “A” drive and “ladder” game folder as a “B” drive:

iz-cpm.exe --disk-a software --disk-b software/ladder

The CP/M is ready to use:

For Linux, I was using the RunCPM emulator, which looks a bit more accurate in the terms of simulation quality. First, we need to compile RunCPM and set the CP/M environment:

sudo apt-get install ncurses-devgit clone https://github.com/MockbaTheBorg/RunCPM
cd RunCPM/RunCPM/
make posix build
cd ..
mkdir Bin
cp RunCPM/RunCPM Bin
cp CCP/CCP-ZCP3.60K Bin

I put the emulator file into the separated directory Bin, and also copied the “CCP-ZCP3.60K” OS image. Now we have a folder, where our CP/M system is located. But if we run the simulator, we’ll get the error:

The system started, but it cannot find any drives. The solution is easy — we should create folder “A” and the subfolder “0” in the same place, where the emulator is located. Into the folder “0” I extracted files from the DISK folder, included with the RunCPM archive. Now the system is running properly and can recognise all files.

We can also download other apps and place them in other folders. The “CP/M Software” section on the GitHub page is the great starting point where lot’s of CP/M programs were collected.

Now we are ready to start.

Exploring CP/M

The very first impression is that the system has only text mode. No graphics, icons or any GUI. After the system boot, we get a console where different commands can be entered. It is possible to switch between disks by entering the A0: or B1: command, the folder contents can be viewed using the DIR command:

For example, we can get the executable files list by entering the command DIR *.COM. EXE-files were still not existing at those times, but the dir command can be used in the terminal even nowadays. The naming of the drives with “A”, “B”, “C”… letters is still in use now as well, but floppy drives A and B were gone down in history.

The BASIC (Beginners’ All-purpose Symbolic Instruction Code) was one of the popular programming languages at that time, and it was one of the first languages available for CP/M. For testing purposes I did a small program, that is calculating the prime numbers from 1 to 1000 (it was even hard to remember when I was using the BASIC last time before):

10 PRINT "PRIME NUMBERS FROM 1 TO 1000"
20 FOR N = 3 TO 1000
30 FOR D = 2 TO (N-1)
40 IF N/D=INT(N/D) THEN GOTO 70
50 NEXT D
60 PRINT N;
70 NEXT N
80 END

The CP/M simulator is automatically mapping the files and folders, so I can use any text editor, like “Notepad”, to edit files. I saved the file using the “PRIMES.BAS” name in the “0” folder, then I can load and run it in CP/M:

The program is very simple, but numerating the line numbers looks very archaic now, and after C++ or Python it’s not convenient. But at least, it works, and after the low-level assembler language, it was a great step forward.

Not only BASIC, but C was also available for CP/M. This is how the compilation of the same program looks like in C:

It’s funny to mention that the program does not require any “include” statement at the beginning, and there are no parameters of the “main” function. The C compiler itself has only 50 KB size, by the way, but it does the job fine. I can run the program and get my results:

The syntax of C looks much better than BASIC, at least from the modern developer prospective, and this program with minimum changes can be compiled also on the modern PC as well. Of course, the CP/M memory limitations were strict —no more than 60 KBytes of RAM were available for the whole system, and the average PC could have only 16K installed “out of the box”.

There were other languages for CP/M, like FORTRAN or ALGOL, people who are interested can test them for their own.

Text Editing

The WordMaster text editor UI from 1980 looks weird nowadays. It shows not only the text itself but provides a console to enter commands:

It works, but the experience is pretty clumsy. The editor can switch between “editing mode” and “commands mode” by pressing the ESC button. The main disadvantage that was discovered— cursor keys are not working, they probably did not even exist at that time, or their codes were different. Instead, hotkeys Ctrl+S and Ctrl+D can be used to move the cursor left and right, there are also other shortcuts, like moving the cursor to the next or previous word.

The editor itself is pretty powerful, it’s manual contains about 150 pages in the old-school printed format:

The editor has a short help inside though:

So, in general, it works, but comparing to the modern editors, it can be a sort of nightmare to deal with all hotkeys and text commands.

And last but not least. The WordMaster’s size is only about 11 KB. Nowadays even the app icon of the modern editor is bigger.

Gaming

One of the genres, almost completely disappeared today, is a sort of a text adventure quest. It is more like an interactive book than a modern computer game. One of such games for CP/M is the Colossal Cave Adventure:

Interestingly, the player is entering the answers in the free text form, not in the form of predefined commands. Of course, there were no complicated text parsing, neural networks or other NLP (Natural Language Processing) technologies inside — the game is just extracting the keywords from the text, but for simple phrases, it works pretty well.

In my opinion, interactive books can be attractive even today, for example, on the modern e-book readers.

Some other games are simply not working in the modern Terminal:

All, I was able to understand, is the text GAME OVER.

The modern PC speed can also be an issue. The Ladder game is working in the emulation but the speed is too fast, and the level ends within 1-2 seconds:

I can imagine that the developer in 1980 was using an empty loop to adjust the game speed, but he could not imagine that somebody will try to launch the game 40 years later on the CPU with several generations gap in the processing power (82300 MIPS of Core i7 vs 0.6 MIPS of Z80, to be more precise).

Connectivity

Obviously, in 1979 there was no internet, no emails, no online chats, no… you’ve got the idea. But it was possible to send files using the modem via the telephone line, with the speed of about 300 bits per second. The xmodem application was created later, but it gives us a picture of how it may look like:

The modem itself may use an acoustic coupling with a telephone line:

Source © https://en.wikipedia.org/wiki/Modem

The 300 bits per second speed looks not so fast, but keep in mind that the average application or document size was about 20–40 KB, so it was not so bad, and definitely faster than bringing the same file on a floppy disk to another part of the city.

Conclusion

It was fun to investigate how the CP/M works. Some things improved drastically nowadays, like text editing, some others, like working in the remote terminal console, are still useful today. Surprisingly, the computer with only 16KB of RAM was capable of doing the office work, like printing the texts, keeping the data tables and so on. The second thing that was amazing to me — the apps and files size. The text editor is 12 KB, the average game is 50 KB, the C-compiler is 40 KB (just as a comparison, last time when I was downloading the 200 MB printer driver for my Windows 10, I was 100% sure that something is wrong — what can be there that takes so much space?).

There are much more CP/M apps, that can be tested in the emulator, those who wish can try them on their own.

Those, who are interested in how to write the assembler code for the ALTAIR 8800 computer, are welcome to read another article. Those, who are interested in the history of Apple, can also read my review of Apple II.

Python and IoT Developer, science and ham radio enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store