Volume 2 · Number 3 · July 1982

Page 13 of 37

An Introduction To CP/M

by Chris Blackmore

CP/M stands for Control Program for Microprocessors. CP/M is an operating system, as the glossy magazines will tell you. They rarely say what that means though. In his “CP/M Handbook” Rodney Zaks says that the purpose of an operating system is “to execute user commands and allow the user to conveniently use all of the hardware resources provided by the computer”.

Most readers of Micropower will already be familiar with one of the best operating systems for Z80 based computers available. Nas-Sys, which converts an otherwise useless lump of expensive electronics into a Nascom computer. When you switch a Nascom on, it automatically runs Nas-Sys which gets the system ready for you to use it, clearing the screen and setting various options, and then it waits for a command. Nas-Sys commands consist of a letter, usually followed by at least one hexadecimal number. Using these commands, you can load programs and data from tape, change and debug programs once they are loaded, save programs and data to tape, run programs and much much more. All of this is achieved using only 2K of EPROM, which is a remarkable example of compact programming.

What Nas-Sys does not do for its users (and this is not suprising, given its size!) is keep a record of where on a tape a given program or data file may be found or the name of the program or file, and it can not control a disc system without considerable extension. Its ability to control the screen and keyboard of a Nascom is, of course, superb. But what would happen if you tried to use Nas-Sys to run a TRS-80? or an RM380Z? This would be a silly thing to attempt, even though all three are Z80 based micros and will run each others BASIC programs with very little conversion work. Each machine has its own operating system, which has been designed to make the most of the available hardware.

If an operating system is to run on more than one machine. it will have to have its abilities reduced to the level of the “lowest common denominator”, or use routines which have been custom written for the machine it is to run on. CP/M was originally written for use on an Intel system that used the 8080 chip. Thus, it can be used on machines that use both the 8080 and the Z80. The main bulk of CP/M is the same for all the machines it is run on, only the routines referred to as the “primitives” are custom written for the particular machine by the implementer. These routines are the ones that read the keyboard, print characters on the screen or elsewhere, and transfer data to and from disc units. In any CP/M system, there is RAM from address 0000 upwards, for as far as you can afford. At address F000H there is an EPROM or ROM containing a very short program which loads CP/M from the disc unit into the memory and then hands control over to CP/M.

This automatic loading of the operating system is called “booting the system” for reasons far too obscure to be of interest here. On most systems, it is done automatically for you, but on others it is not. To show off my worldly wisdom, I

Page 13 of 37