CCPZ is like CP/M, with bonuses. Underneath what you see is a standard CP/M installation but sitting above it is an improved interface. After people used CP/M for a while, they made some improvements. This is the story of one of those.
How Did This Happen?
CP/M is made up of three parts:
– the BIOS which controls the hardware,
– the BDOS which mainly does the file system, and
– the CCP or Console Command Processor.
The CCP is the bit that provides built-in, or “intrinsic” commands. When you type “DIR” to get a directory listing, that is handled by the CCP. It provides a prompt (like “A> “) and waits for you to type a line of text in. It reads the text, compares it to a list of built-in commands, and:
– if it matches, does the built-in command; or
– if it doesn’t match, tries to find and run a matching program instead.
The process makes the computer infinitely expandable as you can always add more programs and it will automatically understand more commands. However, the important thing here is that some commands are built-in.
With standard CP/M, the CCP understands:
– ERA. Erase a file.
– DIR. List the directory of files.
– REN. Rename a file.
– SAVE. Create a file.
– TYPE. Show the contents of a file.
– USER. Change user area to access different files.
The USER command is present in CP/M 2 but not in CP/M 1.
A New CCP
In many ways, the CCP is a program just like every other program. It is written to use standard BDOS calls, just like any other program. People noticed that, and wondered if they could write their own versions of the CCP. They soon found they could because the only differences between the CCP and a normal CP/M program are:
– it runs from a high memory address instead of at 0100H, and
– it gets loaded from the system area of the disk, outside the usual directory.
Neither of those differences prevent you writing your own CCP.
Assemblers use an “ORG” statement to set where a program is expected to run. Normal CP/M programs have a line saying, “ORG 0100H”. A CCP replacement program has the same line but with a different value.
Because we load the CCP into high memory, the actual value depends on how much memory we have. At the time, CP/M systems had between 20K and 64K of memory and you couldn’t put the CCP in a location that didn’t exist. These days, memory is cheap and every hardware implementation or simulation is likely to have 64K. In a 64K CP/M 2.2 system, the parts get loaded as follows:
– CCP E400 (len= 0800H, 16 sectors)
– BDOS EC00 (len= 0E00H, 28 sectors)
– BIOS FA00 (len= 0600H or less, 12 sectors or less)
The ORG statement for CCP or a replacement is usually “ORG 0E400H”.
The system area of an 8″ SSSD disk is 2 tracks of 26 sectors each. That’s a total of 52 sectors. The first sector is the boot sector, so CCP+BDOS+BIOS has to fit in 51 sectors. This means the BIOS is limited to 7 sectors (0380H), and empty buffer space is usually placed in the top 0280H of memory (and not initialized from disk). Other disk sizes have different system areas but they are, always, at least as big as the 8″ SSSD standard.
There were complex ways of loading bits of the operating system into different memory locations so that you could merge them properly and save a bootable image to the system tracks. However, these days it is usually easier to use a Windows command line tool like cpmfs to write into part of the system area of a disk image. It numbers the boot sector as logical sector 0 so to write “newccp.sys” into drivea.dsk, you can just do:
cpmfs drivea.dsk wr 1 16 newccp.sys
The “16” in the command is the CCP length of 16 sectors. If your CCP is smaller than that, you might want to still use 16 because the BDOS and BIOS expect to be loaded into specific memory addresses. Shuffling them down won’t work unless they are rebuilt for the different addresses (MOVCPM.COM does this).
So what about CCPZ? CCPZ is a rewrite of the CCP.
It was written in 1981 by RLC and others to provide additional features. As far as I can see, the contributors all stuck to initials and there’s no copyright with any further details. Unsung heros. The software was written to be used and was freely available at the time.
I’ve merged it with the windows build of z80sim and a CP/M 2.2 disk image. You can get a copy of that from cpm/z80sim/run-ccpz.zip. As usual, it is just:
– unZIP it somewhere, and
– double-click run.bat
You’ll see a CP/M prompt but you’ll be in CCPZ. It’s mostly the same as what you’re probably used to so it should seem mostly the same. Here’s some differences…
There are additional commands:
– LIST. Send a file to the printer.
– DFU. Set a default user area (like a search path).
– GET. Loads a file to a given memory address.
– JUMP. Runs a program loaded by GET, or runs a part of the operating system.
– GO. Rerun the last CP/M program with new args. Faster. Doesn’t need to be loaded again.
Existing commands are slightly different:
– DIR. Has options to show system files or all files.
– TYPE. Pauses at the end of each screen full.
– ERA. Tells you which files it is erasing.
– SAVE. Allows you to save a number of pages (100H) or sectors (80H), and to specify either in decimal or hexadecimal.
In my view, the most useful items are the search path and the paging for TYPE. I don’t use USER or set SYS attributes so features relating to those don’t really affect me. Having CP/M look on drive A for a program if it isn’t on the current disk is useful. If you’re in a fast emulator, it can be difficult to hit Ctrl-S to pause screenfuls of information in time so auto pausing after each page is great.
The source code for CCPZ is included in the run-ccpz download.
This is part of the CP/M topic.