CP/M Days
Originally published on: Wed, 07 Apr 2010 00:15:01 +0000
In my early days of computing, I used to read a lot of tech magazines. I had been reading about this “Operating System” called CP/M: Control Program for Microprocessors. The computers I had owned to date really didn’t have true operating systems, so I had a very vague idea of the significance of an OS.
I did understand that different kinds of computers seemed to be capable of running CP/M. I was already all too familiar with incompatibilities in dialects of BASIC, disk commands, and processor instructions and such on different computers. I thought that the concept of something that could act as a host on multiple computers so that the same program could run on all of them was a very novel concept.
My quest began by trying to find the CP/M cartridge for the Commodore 64 at an affordable price. The cartridge itself contained a Z-80 processor and came with the CP/M operating system on a series of 1541-compatible 170K diskettes.
During my searches, a local Commodore dealer told me that they carried Vic-20 80-column CP/M. I didn’t have a Vic-20 at the time, but thinking back, this may have been a decent purchase. It almost sounds like someone had rolled a Z-80 computer into a cartridge and merely used the Vic-20 as a terminal interface.
I finally managed to get a used cartridge and software from a friend for about $50. I then purchased the book The CP/M Handbook with MP/M by Rodnay Zaks.
Very nice book. I wish I still had it. I also purchased Mastering CP/M by Alan Miller.
I was experienced at writing Z-80 and 6502 assembly language, but the style taken on by these books was very intriguing. Unlike most of the code I found in other tech publications, the code written in assembly language for CP/M seemed to often rely heavily on assembler macros.
Unfortunately, I didn’t have a formal assembler so I ended up doing most of my exploration by using DDT to overtype in a few instructions on a dummy .COM file and invoke them.
The C64 CP/M from Commodore was quite slow. It was bound by a very slow serial disk drive which I think made the most difference. I didn’t have any CP/M software, so I didn’t make it very far.
During this time, I had discovered electronic Bulletin-Board Systems (BBS’s). A local CP/M community was present on a few of them. A few of these BBS’s had programs that one could download. Often, the downloaded files were accompanied by source code. While it wasn’t named formally, these files were my first exposure to what would later become open-source software.
A number of these files had the extension .LBR in the filename. These files were created with Gary Novosielski’s LBR ( Library ) utility. LBR was an early archive utility. It allowed one to combine multiple files into a single file for easier distribution much like the Unix tar utility. Sometimes, the contents of these LBR files were compressed using one of two utilities; Squeeze or Crunch.
Squeeze was a CP/M utility that employed Huffman statistical encoding to reduce the size of a given file. Crunch was a similar utility that employed the LZW algorithm against files. Crunch usually yielded a better compression ratio than Squeeze, but there were cases when the data actually compressed better with Squeeze.
A company known as System Enhancement Associates ( SEA ) created a utility called ARC for CP/M. It was later ported to MS-DOS and other platforms. ARC combined the functions of LBR, Squeeze, and Crunch into one utility that would compress as it archived. Many of the files I encountered were in ARC format.
Since I wasn’t able to download anything in a manner that could run on my C-64, I thought that all of this software might be out of my reach. Thankfully, the sysop of this BBS, jsw, had provided utilities that allowed one to view compressed files and/or members of archive files. I was able to capture the assembly-language and Turbo Pascal source code for a number of these utilities so that I could study them.
A short time later, Commodore released their C-128 computer. One of the features of this new computer was CP/M support via an internal Z-80 chip. The Z-80 still had to invoke routines from the 8510 ( 6502-compatible ) chip at regular intervals, so the C-128 had a reputation for running CP/M very slowly.
However, coupled with the new 1571 disk-drive which could read and write several native CP/M diskette formats as well as MS-DOS formats, C-128 CP/M turned out to be a lot more useful than C-64 CP/M. It also sported a 56K TPA ( Transient Program Area ) which meant that most CP/M programs would fit into the C-128’s available memory space.
I had downloaded a utility that would allow me to move a file from a Commodore-format floppy disk onto a CP/M formatted disk. I then downloaded the C-128 version of MEX ( the Modem EXecutive ) a terminal program with Xmodem file-transfer capability and transferred it to a CP/M disk. I was then able to download programs natively to the CP/M disks.
I was finally able to download ARC and LBR and other programs and actually run them on my system. A company named Zedcor had a free offering of a restricted version of their ZBASIC system that I had downloaded and tried.
I bought Turbo Pascal 3.0 for the C-128 and was completely blown away at the speed of the compiler. I was now able to compile the sources for some of these programs I had been downloading. I didn’t manage to do too much to them other than change the parameter-parsing routines that had to be hand-written in TP 2.0 ( which many of the utilities had been written in ) to use the ParamCount and ParamString functions new to TP 3.0.
One of the things that really intrigued me was CP/M disk I/O. On my Commodore machines in their native mode, disk files were arranged in linked-lists of blocks, so relative access to any portion necessitated either dropping down to sector-level I/O or the use of a special REL filetype. I was very impressed that I could open a CP/M file and traverse it either sequentially or randomly.
I tinkered, making some simple file utilities that were analagous to CP/M’s PIP and TYPE commands. I found an article in Byte magazine, with MS-DOS TP source for a file-copier and found that the file I/O functions worked identically in the CP/M version. ( I later found that in the MS-DOS edition, one could specify the size of the I/O buffers on the File of Byte type, but I’d never tried to use that with the CP/M edition of TP. )
Shortly after this, I moved on to a Commdore Amiga 500 computer and ended up getting rid of all of my other gear. I also got an MS-DOS machine soon after the Amiga. Although I had said “goodbye” to CP/M, I ended up using MS-DOS … CP/M’s distant cousin … for a number of years.