Saturday, July 31, 2010

CP/M, the Old Skool Way

First, the Agony of Defeat

A couple of nights ago, my friend Nick and I spent hours trying to get the PX-8 peripheral port to talk to the Propeller microcontroller using RS232. We did not succeed, and it is still not clear why. We tried changing parameters, re-examining our assumptions on wiring, and even broke out the multimeter to make sure that some signals were going across the wire. Alas, to no avail.

Why won't anybody talk to me?

The peripheral port on the PX-8, officially called the "Serial" port, uses RS232 at 38400 baud to speak to the disk drive. Although I don't have a PF-10 disk drive, I do have a cool program on Linux ("vfloppy") that emulates a disk drive. You plug the PX-8 Serial port into the PC RS232 port with the right kind of cable, run the vfloppy software, and voila, up to 4 simulated disk drives, each with storage of around 300 KB. Since my PX-8 works fine with vfloppy, I know that this RS232 link can be successfully accomplished. The Propeller development board that I use is equipped with a MAX3232 chip, which boosts the Propeller's 3.3V signals to the levels needed for RS232 communications. When I connect the Propeller to my PC using RS232, it works fine.

We checked to ensure that the voltage levels from the MAX3232 were not too loud or too soft for the PX-8. Turns out, according to the technical manual, the PX-8 has a pretty wide range that it will accept on either the "Serial" or the "RS232" port. So, we're still not sure why things didn't work. We will continue to work on this; however, it's clear that the problem won't be solved by the end of the Retrochallenge 2010.


I decided to punt, and do something with the PX-8 that I've been interested in for quite a while - use it like an old skool CP/M system by connecting a terminal to it.

Driving a CP/M box like it was meant to be driven

Systems like the Altair, IMSAI, North Star, etc. used to be "headless" - you had to connect some I/O device to them to have input and output. Frequently this was a video terminal of some sort. Although I'd like to have a video terminal, like an old VT100 or Lear-Siegler, I do not currently own one. But I do have a Propeller development board, which has seen quite a bit of use on this fledgling project. I decided to rewire it, and use it as a standalone terminal.

The PockeTerm is a product of Briel Computers. It is, according to the site, a "A low cost color choice terminal that has VT-100 compatible commands for controlling cursor and screen functions." It's a neat little standalone terminal unit that was made for vintage computers, but can also be used to connect to Unix/Linux systems if you wish. The heart of the PockeTerm is the Propeller microcontroller.

Have I already got the hardware for my own terminal?

This got me thinking - my Propeller Professional Development Board (PPDB) has nearly all the hardware goodies included in the PockeTerm, short of the SD Card slot. I also have a breadboard-ready SD card unit, so I thought, why not breadboard my circuit, wired similarly to a PockeTerm, and use it with the PX-8, giving me a nice 80 column display?

Step 1: Wire the PPDB like a PockeTerm

On the Briel Computers site, there is a manual, a schematic, and a download of the PockeTerm software. I used the schematic diagram and wired up the PPDB the same as a PockeTerm, with the following result:

Note that the PockeTerm does not do any hardware handshaking, so I had to also add a wire to bring up Clear To Send (CTS). (The PX-8 RS232 port won't talk to you unless CTS is active.)

Step 2: Load the PockeTerm software and test

Worked great! I hooked up the PPDB to my PC (with HyperTerminal), and the two were talking in no time.

Step 3: Connect the PPDB to the PX-8

Based on all the work we've been doing trying to talk to the Serial port, I had PX-8 compatible cabling at the ready. The PX-8 uses a Mini-DIN 8, same connector style (but not the same wiring!) as a Macintosh serial port. I have two cables, one wired as the virtual drive cable, and the other wired as a standard RS232 modem cable.

Once hooked up, I used the simple "TERM.COM" program on the PX-8 to ensure that it was happily talking to the Propeller terminal.

Step 4: Redirect I/O on the Epson PX-8

In order for the PX-8 to use a terminal for I/O instead of its own screen and keyboard, you have to run the CP/M "STAT" command with the right parameters. STAT is a program used for many various things in CP/M, among which is port redirection. The command:


tells the PX-8 to use the RS232 port for input and output, instead of using the screen and keyboard.

Note that it's important to have a terminal connected to the PX-8 (and tested) before you do this - otherwise you lose control of the PX-8 and have to do a low-level reset!

Step 5: Run some interesting software that uses the terminal

Using some of the utilities provided as part of the vfloppy suite, I was able to get both MBASIC and Turbo Pascal 3.0 for CP/M loaded into compatible disk images. Here's Turbo Pascal, running on the PX-8, and displayed on the Propeller-based VT100/ANSI terminal program:

I played around with Turbo Pascal and MBASIC for a while, and was quite happy with the results. The RS232 link worked quite well at 9600 baud, making for a fairly snappy response on the programs.

Just for grins, here are a couple of my reference manuals:

Because the PockeTerm software speaks many VT100/ANSI codes, I was able to write a small Turbo Pascal program to send the right codes to clear the screen. Wrote my own little CLS program...

Step 6: Play around with CP/M using a terminal for a while (this step is in progress)

Step 7: Get back to work on the PXDrive project!

Well, that's it for this year's Retrochallenge entry. Too bad we couldn't make more progress on the virtual drive - but this did get my PX-8s up and running for some fun, and in the end, I guess that's the point of it! I'll keep up the updates on this blog as more progress is (hopefully) made on the virtual drive!

Thanks to the Retrochallenge folks for another neat event, and for the great Twitter updates!

No comments: