SECTION 11

[continue/next section] [MAIN/Introduction] [table of contents]

11. Introduction to CP/M 3.0


TABLE OF CONTENTS

11.1 WHAT CP/M 3.0 IS

11.2 WHAT YOU NEED TO RUN CP/M 3.0

11.3 WHAT IS ON YOUR CP/M 3.0 DISK

11.3.1 CP/M+.SYS
11.3.2 CCP.COM
11.3.3 .COM Files
11.3.4 Other Files

11.4 GETTING STARTED WITH CP/M 3.0

11.4.1 Loading or Booting CP/M 3.0
11.4.2 The Opening CP/M Screen Display

11.5 THE COMMAND LINE

11.5.1 Types of Commands
11.5.2 How CP/M Reads Command Lines

11.6 HOW TO COPY YOUR CP/M 3.0 DISK

11.7 LANGUAGES AND APPLICATION SOFTWARE

11.7.1 What To Buy
11.7.2 How To Install It on Your C128

11.1 WHAT CP/M 3.0 IS

CP/M is a product of Digital Research, Inc. The version of CP/M used on the Commodore 128 is CP/M Plus Version 3.0. In this chapter, CP/M is generally referred to as CP/M 3.0, or simply CP/M. This chapter summarizes CP/M on the Commodore 128. For detailed information on CP/M 3.0, follow the instructions on the coupon enclosed in the box in which the Commodore 128 is supplied.

CP/M 3.0 is a popular operating system for microcomputers. As an operating system, CP/M 3.0 manages and supervises your computer's resources, including memory and disk storage, the console (screen and keyboard), printer, and communication devices. CP/M 3.0 also manages information stored in disk files. CP/M 3.0 can copy files from a disk to your computer's memory, or to a peripheral device such as a printer. To do this, CP/M 3.0 places various programs in memory and executes them in response to commands you enter at your console. Once in memory, a program executes a set of steps that instruct your computer to perform a certain task.

You can use CP/M to create your own programs, or you can choose from the wide variety of available CP/M 3.0 application programs.

11.2 WHAT YOU NEED TO RUN CP/M 3.0

The general hardware requirements for CP/M 3.0 are a computer containing a Z80 microprocessor, a console consisting of a keyboard and a display screen, and at least one floppy disk drive. For CP/M 3.0 on the Commodore 128 Personal Computer, the Z80 microprocessor is built-in; the console consists of the full Commodore 128 keyboard, and an 80-column monitor; and the disk drive is the new Commodore 1571 fast disk drive. In addition, there is either one or two CP/M disks packed with the computer. If two CP/M disks are supplied, one contains the CP/M 3.0 system and an extensive HELP utility program, and the other contains a number of other utility programs. If one CP/M disk is supplied, the system and HELP utility are on one side of that disk and the utility programs are on the other.

Note: Although CP/M can be used with a 40-column monitor, the display is 80 column but with only 40 columns displayed at one time. To view all 80 columns of the display, you must scroll the screen horizontally by pressing the {ctrl} key and the appropriate cursor key ({crsr left} or {crsr right}).

11.3 WHAT IS ON YOUR CP/M 3.0 DISK

show b:
B: RW, Space       336k

A>dir [full]

Scanning Directory...
Sorting  Directory...
Directory for Drive A: User  0

    Name     Bytes   Recs   Attributes      Name     Bytes   Recs   Attrib.
------------ ------ ------ ------------ ------------ ------ ------ --------
CCP     .COM     4k     25  Dir RW      CPM+    .SYS    23k    182  Dir RW
DIR     .COM    15k    114  Dir RW      FORMAT  .COM     5k     35  Dir RW
HELP    .COM     7k     56  Dir RW      HELP    .HLP    83k    664  Dir RW
KEYFIG  .COM    10k     75  Dir RW      KEYFIG  .HLP     9k     72  Dir RW
PIP     .COM     9k     68  Dir RW

Total Bytes     =    165k  Total Records =     1291  Files Found =    9
Total 1k Blocks =    165   Used/Max Dir Entries For Drive A:    15/  64

A>dir b: [full]

Scanning Directory...
Sorting  Directory...
Directory for Drive B: User  0

    Name     Bytes   Recs   Attributes      Name     Bytes   Recs   Attrib.
------------ ------ ------ ------------ ------------ ------ ------ --------
DATE    .COM     8k     25  Dir RW      DATEC   .ASM     2k      5  Dir RW
DATEC   .RSX     2k      3  Dir RW      DEVICE  .COM    16k     58  Dir RW
DIR     .COM    30k    114  Dir RW      DIRLBL  .RSX     4k     12  Dir RW
DUMP    .COM     2k      8  Dir RW      ED      .COM    20k     73  Dir RW
ERASE   .COM     8k     29  Dir RW      GENCOM  .COM    30k    116  Dir RW
GET     .COM    14k     51  Dir RW      INITDIR .COM    64k    250  Dir RW
PATCH   .COM     6k     19  Dir RW      PIP     .COM    18k     68  Dir RW
PUT     .COM    14k     55  Dir RW      RENAME  .COM     6k     23  Dir RW
SAVE    .COM     4k     14  Dir RW      SET     .COM    22k     81  Dir RW
SETDEF  .COM     8k     32  Dir RW      SHOW    .COM    18k     66  Dir RW
SUBMIT  .COM    12k     42  Dir RW      TYPE    .COM     6k     24  Dir RW

Total Bytes     =    314k  Total Records =     1168  Files Found =   22
Total 1k Blocks =    314   Used/Max Dir Entries For Drive A:    23/  64

11.3.1 CP/M+.SYS

This is the main CP/M Plus system file. It contains all parts of the system that remain permanently resident in memory: the Basic Input/Output System (BIOS) which loads into the top of memory, the Basic Disk Operating System (BDOS) which loads into memory immediately below BIOS, and the System Parameters which load into the bottom page of memory.

11.3.2 CCP.COM

On booting CP/M the Console Command Processor (CCP) is loaded into memory immediately below the BDOS. The remaining memory, below CCP and above page 0, is known as the Transient Program Area (TPA) and is where applications are loaded to. CCP is the program which processes any input (usually entered from the keyboard) in response to the system prompt (A>). It contains 6 built-in commands (listed in Table 14-1), and also supports the 14 console editing commands (listed in Table 13-1).

Any word entered in response to the system prompt which is not one of the built-in commands is treated by CCP as a transient command, so CCP attempts to find and execute a file named as that word with the .COM extension. If it does not find such a file on the currently logged disk, it displays the word followed by a question mark then brings back the system prompt.

If more than one word is entered in response to the system prompt, all words after the first are treated as parameters to be passed to the transient command.

A language or application program is loaded and run by invoking it as if it was a command. All CP/M programs include a .COM file

11.3.3 .COM Files

The other .COM files all contain transient commands (listed in Table 14-2).

HELP.COM displays messages, held in HELP.HLP (whose extension indicates it is a data file, not a program file), about the C128 CP/M system and its commands. If you are not familiar with CP/M and have no other manuals or books about it, you may find it useful to print out any HELP you look at. Pressing {ctrl} and {p} CAUSES any screen output also to go to the printer: pressing {ctrl}{p} again turns off this facility.

Enter HELP for the list of subjects covered, or HELP C128_CP/M for information specific to this implementation. (The character in the middle of C128_CP/M is obtained by pressing the {left arrow} key at the top left of the keyboard.) If you are printing and do not want pauses after each screenful, then enter HELP C128_CP/M [NOPAGE].

11.3.4 Other Files

.ASM indicates an Assembler source file.

.RSX indicates a Resident System eXtension, which is a file automatically loaded by a command file as and when it is needed.

11.4 GETTING STARTED WITH CP/M 3.0

The following paragraphs tell you how to start or "boot" CP/M 3.0, how to enter and edit the command line, and how to make back-up copies of your CP/M 3.0 disks.

11.4.1 Loading or Booting CP/M 3.0

Loading or "booting" CP/M 3.0 means reading a copy of the operating system from your CP/M 3.0 System Disk into your computer's memory.

You can boot CP/M 3.0 in several ways. If your computer is off, you can boot CP/M by first turning on your disk drive and inserting the CP/M 3.0 system disk, and then turning on the computer. CP/M 3.0 then loads automatically. If you are already in C128 BASIC mode, you can boot CP/M 3.0 by inserting the CP/M system disk into the drive, typing the BASIC command BOOT and then pressing {return}. CP/M 3.0 then loads. In C128 mode, you can also boot CP/M by inserting the System Disk and pressing the {reset} button.

If you are in C64 mode, and you want to enter CP/M mode, first turn off the computer. The insert the CP/M System Disk into the drive and turn on the computer.

Caution: Always make sure that the disk is fully inserted in the drive before you close the drive door.

In CP/M 3.0 on the Commodore 128, the user has a 59K TPA (Transient Program Area), which is, in effect, user RAM.

11.4.2 The Opening CP/M Screen Display

After CP/M is loaded into memory, a message similar to the following is displayed on your screen:

[ASCII IMAGE]

An important part of the opening display is the following two-character message:

A>

This is the CP/M 3.0 system prompt. The system prompt tells you that CP/M is ready to read a command entered by you from your keyboard. The prompt also tells you that drive A is your default drive. This means that until you tell CP/M to do otherwise, it looks for program and data files on the disk in drive A. It also tells you that your are logged in as user 0, simply by the absence of any user number other than 0.

Note: In CP/M a single disk drive is identified as drive A. This is equivalent to unit 8, drive 0 in C128 and C64 modes. Usually, the maximum number of drives in CP/M is four. Additional drives are identified as drives B, C, etc.

11.5 THE COMMAND LINE

CP/M 3.0 performs tasks according to specific commands that your type at your keyboard. These Commands appear on the screen in what is called a command line. A CP/M 3.0 command line is composed of a command keyword and an optional command tail. The command keyword identifies a command (program) to be executed. The command tail can contain extra information for the command, such as a filename or parameters. The following example shows a command line.

A>DIR MYFILE

In this example, DIR is the command keyword and MYFILE is the command tail. To send the command line to CP/M 3.0 for processing, press the {return} key.

As you type characters at the keyboard, the appear on your screen. The cursor moves to the right as you type. If you make a typing error, press either the {inst/del} key or CTRL-H to move the cursor to the left and correct the error. CTRL is the abbreviation for the {ctrl} key. To specify a control character, hold down the {ctrl} key and press the appropriate letter key. (A list of control characters and their uses is given in Section 13.)

You can type the keyword and command tail in any combination of upper-case and lower-case letters. CP/M 3.0 interprets all letters in the command line as being upper case.

Generally, you must type a command line directly after the system prompt. However, CP/M 3.0 does allow spaces between the prompt and the command keyword.

11.5.1 Types of Commands

CP/M 3.0 recognizes two different types of commands: built-in commands and transient utility commands. Built-in commands execute programs that reside in memory as a part of the CP/M operating system. Built-in commands can be executed immediately. Transient utility commands are stored on disk as program files. They must be loaded from disk to perform their task. You can recognize transient utility program files when a directory is displayed on the screen, because their filenames are followed by a period (full stop) and COM (.COM). Section 14 presents lists of CP/M built-in and transient utility commands.

For transient utilities, CP/M 3.0 checks only the command keyword. Many utilities require unique command tails. If you include a command tail, CP/M 3.0 passes it to the utility without checking it. A command tail cannot contain more than 128 characters.

11.5.2 How CP/M Reads Command Lines

Use the DIR command to demonstrate how CP/M reads command lines. DIR, which is an abbreviation for directory, tells CP/M to display a directory of disk files on your screen. Type the DIR keyword after the system prompt, and press the {return} key:

A>DIR {return}

CP/M responds to this command by displaying the names of all the files that are stored on whatever disk is in drive A. For example, if the CP/M system disk is in the disk drive A, a list of filenames like this appears on your screen:

A: PIP COM:ED COM:CCP COM:HELP COM:HELP HLP
A: DIR COM:CPM SYS

CP/M recognizes only correctly spelled command keywords. If you make a typing error and press {return} before correcting your mistake, CP/M 3.0 repeats or "echoes" the command line followed by a question mark. For example, suppose you mistype the DIR command, as in the following example:

A>DJR {return}

CP/M replies with:

DJR?

This tells you the CP/M cannot find a command keyword spelled DJR. To correct typing errors like this, you can use the {inst/del} key to delete the incorrect letters. Another way to delete characters is to hold down the {ctrl} key and press {h} to move the cursor to the left. CP/M provides a number of other control characters that help you edit command lines. Section 13 tells how to use the control characters to edit command lines and other information you enter at your console.

DIR accepts a filename as a command tail. You can use DIR with a filename to see if a specific file is on the disk. For example, to check that the file MYFILE is on your disk, type:

A>DIR MYFILE {return}

CP/M 3.0 performs this task by displaying either the name of the file you specify, or the message:

No File

Be sure you type at least one space after DIR to separate the command keyword from the command tail. If you do not, CP/M 3.0 responds as follows:

A>DIRMYFILE {return}
DIRMYFILE?

11.6 HOW TO COPY YOUR CP/M 3.0 DISK

Before doing anything else you should back-up your CP/M system disk. This can be done using either one or two disk drives. If using two disk drives these may be 1541s, 1571s, or one of each. The back-up disks can be new or used. You can either format new disks, or reformat used disks. To make back-ups use the FORMAT and PIP utility programs found on you CP/M system disk.

  1. Format the diskette using the FORMAT program, as either C128 single sided (if using a 1541) or C128 double sided (if using a 1571). (The C64 single sided option is for formatting disks compatible with the CP/M 2.2 package once sold for the Commodore 64.)
    Enter the command FORMAT, select the required disk type with the {crsr down} key, press {return}, and follow the onscreen instructions. Press {y} (Yes) or {n} (No) in response to the 'Do you want to format another disk' question.
  2. Use the Peripheral Interchange Program (PIP) - on the second surface of the original disk - to copy files. Enter PIP and the usual system prompt (A>) will be replaced by the PIP prompt (*).

If you have a single disk drive use drive A as the source drive and drive E as the destination drive. Drive E is referred to as a virtual drive - that is, it does not exist as an actual piece of hardware. Put the disk to be copied from in the drive and enter

E:=A:*.*

(You will be prompted each time the source disk and the destination disk have to be swopped.)

If you have two disk drives, put the source disk in drive A (which is device 8) and the newly formatted disk in drive B (device 9 - set by putting the left DIP switches on the back of the 1571 down while the drive is switched off) and enter

B:=A:*.*
to copy all the files.

Your original CP/M disk is a flippy - i.e. recorded as 2 single sides, so it must be taken out of the drive and turned over to get at the second side. This is required for use in a 1541, which is a single sided drive. If you have a 1541 you should copy the 2 surfaces onto 2 separate disks. However, if you have a 1571 you will find it convenient to copy both surface onto a standard double sided disk: after copying the first side, turn over the original disk and copy the second side onto the same destination disk by again entering the copy instruction in response to the PIP prompt.

You may sometimes want to make disks that just have the system files on them. To do this use PIP to copy the files CPM+.SYS and CCP.COM to the newly formatted disk.

Note: Only disks that you intend to use to boot CP/M need these 2 files on them - putting them on other disks wastes space.

With a single drive, enter

E:=A:CPM+.SYS
to copy the first file and then
E:=A:CCP.COM
to copy the second file.

When you have finished PIP, press {return} to return from the PIP prompt to the system prompt.

A full description of PIP can be obtained by entering HELP PIP, HELP PIP_OPTIONS and HELP PIP_EXAMPLES.

11.7 LANGUAGES AND APPLICATION SOFTWARE

CP/M is just an operating system, that is a means to an end - not an end in itself. On its own it does not do anything useful. If you want to write your own programs you will need a language, either assembler or high level, in which to write them. If you want to play games or do business work you will need application programs.

11.7.1 What To Buy

Because CP/M has been implemented on almost every computer ever designed that used the Intel 8080 or the Zilog Z80 cpu, there is a very large amount of software available for running on CP/M systems. The most comprehensive catalogue of commercial software is the 'CP/M Software Finder' published for Digital Research by Que Corporation and available through good software retailers (ISBN 0-88-022-021-X). Since it is not convenient for the CP/M Users Group to supply its library on Commodore format disks, a selection of public domain CP/M software has been made available through the independent Commodore Products Users Group (ICPUG), for which membership application forms can be obtained by sending an s.a.e. to Membership Secretary, ICPUG, 30 Brancaster Rood, Newbury Park, Ilford, IG2 7EP, England.

CP/M normally uses Modified Frequency Modulation (MFM) ot record on disks. Commodore DOS normally uses Group Code Recording (GCR). The Commodore 1571 disk drive can read both, but the older 1541 can only read GCR. Off-the-shelf CP/M software packages only come as MFM disks. Even with MFM there are many different formats: the 1571 can read disks formatted for:

Epson QX10

(512 byte sectors, double sided, 10 sectors per track)

IBM-8 SS (CP/M-86)

(512 byte sectors, single sided, 8 sectors per track)

IBM-8 DS (CP/M-86)

(512 byte sectors, double sided, 8 sectors per track)

IBM-9 SS (CP/M-86)

(512 byte sectors, single sided, 9 sectors per track)

IBM-9 DS (CP/M-86)

(512 byte sectors, double sided, 9 sectors per track)

KayPro II

(512 byte sectors, single sided, 10 sectors per track)

KayPro IV

(512 byte sectors, double sided, 10 sectors per track)

Osborne DD SS

(1024 byte sectors, single sided, 5 sectors per track)

Osborne DD DS

(1024 byte sectors, single sided, 5 sectors per track)

Therefore when buying CP/M software you must buy it on a disk in one of the above formats. Also, be aware that your C128 will run software written to run under either CP/M 2.2 or CP/M Plus (which is the newer name for what was originally known as version 3). However, CP/M-86 is the version of CP/M designed for use on 16-bit processors: CP/M-86 software will not run on your C128's 8-bit Z80 processor, although the 1571 drive will let you read CP/M-86 data files.

If you only have a 1541 disk drive you will have to get any software you buy transferred from MFM format to (Commodore) GCR format. Some software retailers may be willing to do this for you, but there will probably be a copying charge. Alternatively, you may find that your local ICPUG group provides facilities to do this at its meetings.

11.7.2 How To Install It on Your C128

Because there are so many different computers using the CP/M operating system, many CP/M programs have to be configured for the particular hardware on which they are to be used. The process of installing a program on your C128 involves setting parameters within the software. The program manual will describe how to install the program if this is required. Most programs provide a list of common terminals which they support. If ADM31 appears in this list, select it. If not, your will have to do a custom installation.

Listed below are the entries that should be made when running WINSTALL.COM (the installation program that is part of the Wordstar package). These also provide the information that will be needed for installing other programs, although not all packages ask the same questions.

Terminal name                            Commodore 128
Screen size
  Screen height                          24
  Screen width                           80
Cursor positioning
  Function code sequence                 1Bh 3Dh
  Characters to be sent between line
    number and column number             none
  Characters to be sent after line
    number and column number             none
  Is the column number sent before
    the line number?                     NO
  What character is sent to the
    terminal to signify line 1?          20h
  What character is sent to the
    terminal to signify column 1?        20h
  What types of code are sent to
    signify line and column numbers?     Single byte BINARY value
  Terminal start-up
    Function code sequence               1Bh 59h 1Bh 1Bh 1Bh 60h
  Terminal exit
    Function code sequence               none
  Highlight-on
    Function code sequence               1Bh 1Bh 1Bh 52h
  Highlight-off
    Function code sequence               1Bh 1Bh 1Bh 51h
  Erase to End of Line                   1Bh 54h
  Delete Line                            1Bh 52h
  Insert Line                            1Bh 45h
  Does your terminal use last character
    on screen as a scroll command?       YES

Most Commodore printers require installation as a Standard Printer with NO Communications Protocol and Primary list device as the Printer Driver.

Note: The h against the numbers above indicate that they are hexadecimal numbers (using base 16 instead of the decimal base 10).

[top of document]

page URL: www.bigfoot.com/~c128page/c128sg/sect-11.htm
contact: c128page@bigfoot.com