CP/M Programs for Windows

If you understand the title, you’ll think this is pretty crazy.

Certainly no-one would ever think to do a Google search for anything like that. Let me explain …

CP/M was an operating system for microcomputers, back in the 1970s mainly. It was useful. It was very capable. At the time. Time has moved on. Computers have moved on. Expectations have moved on. The new normal is far beyond the dreams of that era.

Running a CP/M program on a Windows computer just seems wrong in many ways. Yet, many of the programs provided functionality that is still relevant today. Just because a wheel was invented long ago, doesn’t make it less useful now. There might be some things we could learn from history. In the very least, it would be “Oh yeah, that approach – I’m glad we never do that any more.” However, it could also be “That’s right. That was a good approach. How would or could that apply today?”

Tic-Tac-Toe

After a fine introduction I now start talking about a very simple game. I do hope to get onto grander things later but tic-tac-toe (TTT) is what started this whole topic. I recently stumbled across a copy of tic-tac-toe written for CP/M. (I was looking at old disk formats and the game happened to be inside a disk image from the era.) The program was written in C and I couldn’t help wondering, given that C is typically portable, whether it would compile and run on a more modern computer.

The short answer was “no”. The longer answer was “yes”.

Whilst portability has always been a strength of C, forty years have passed since CP/M and the language has evolved a little since then. It’s not quite the same.

To my recollection, it also seemed like a new C compiler was being released every second week in that era. I’m sure I’m wrong but there did seem to be a lot of them and they all had better features than all the rest. There was probably money to be made and so there was quite a bit of competition around. In practice, different compilers meant slight differences in how you’d write programs.

Fortunately, the TTT program was written for the BDS C compiler which is one of the ones I’d used. If I’m remembering the right one, I liked BDS C. I hated that its libraries didn’t match the standard unix ones; but I loved that they included functions that let you do direct calls into CP/M. This meant I could rewrite the libraries so that they did match unix. The versatility amazed me.

Anyway, enough background. The program was released into the public domain, or was going to be. In either case, it now exists on one of the “abandonware” sites of old and long forgotten software. I’ve placed a copy in “ttt1.c“.

So, what about the “running it in Windows” bit?

I’ve made some mods to the program to get it to compile with a modern compiler (gcc) and compiled it for you. There is a ZIP file with the executable, the original source code, and a batch file to run it from Windows Explorer; in “ttt.zip“. It is now a 32-bit Windows executable so it should run on any 32-bit or 64-bit Windows computer. The original was a “.com” file that ran on 8-bit CP/M computers.

There’s no installer, no icon, no registry settings. It just runs.

For those of you that are only familiar with a Windows environment, it may be a shock as it uses console mode. Prompts will appear on the screen and you press keys in response. The original processed keys as you pressed them. The easiest way for me to get it going was to change that to press a key and then press ENTER.

All credit for the program goes to the original author (see the source code). As usual, software is provided “as-is”. No responsibility is accepted if it doesn’t do what you wanted or expected.

Articles

I’ve written some articles on CP/M.

Programs

There are a number of CP/M programs that are still relevant, useful or usable in Windows. Here’s what I’ve gotten going so far:

Basic1

Old fashioned BASIC for new fashioned computers.

CP/M Mastermind

Which are the right letters and which are in the right spots?

CP/M PNum

Print a file with line numbers.

CP/M Pressup

Be the first to press down their pegs.

CP/M TTT

Tic Tac Toe.

Previous

8080 Emulators

There are also emulators around for 8080 CPUs and systems. Those will run CP/M. They will also directly run all of the original 8-bit “.com” file programs without recompiling.

Z80 Emulators

I have two main Z80 emulators. These are z80emu, a HTML5 one that runs in your browser; and z80sim, a Windows program that runs on your desktop.

There are also packages of z80sim that come with a disk image and a “run.bat” that allow you to run up an entire operating system with a single (double-)click.

Run CDOS

A one-click computer running CDOS 02.36 from long ago ...

Run CP/M

A one-click computer running CP/M 2.2 from long ago ...

Run Cromix

A multi-user, multi-tasking operating system on a Z80, on Windows!

Z80 Emulator

Run CP/M Z80 programs in a web browser!

Z80 Simulator

Run a Z80 based system on your desktop.

Previous

CP/M Tools

The following may be of use if you are building things related to CP/M or Z80 processors.

bin2hex

Create Intel Hex files from a binary image.

cpmfs

Copy files between Windows and CP/M

Previous

More

You may be interested in my small collection of CP/M related programs, source code and disk images.

Other useful links:
https://amaus.org/static/S100/
http://www.z80.info/z80emu.htm
http://www.autometer.de/unix4fun/z80pack/ftp/

handheld computing

css.php