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!

Monday, July 26, 2010

Voltage problem?

I'm still working on my Retrochallenge entry. There are only a few more days in the month, and I feel like I'm pretty close to the goal. However, it could be that a good ol' hardware issue has me stuck.

I've reverse-engineered some of the code from the "vfloppy" program, and figured out how the PC serial port is used to talk to the PX-8. It's very straightforward, as I thought, based on the specs - 8 bits, no parity, 38400 baud, no flow control, just raw I/O. No magic at all. And that's exactly the way the serial code for the Propeller works, too, by default. So, why do I not have reliable communication?

Based on the trouble I had making the vfloppy program work with one computer and not another, it occurred to me that serial port voltage/current might be an issue. I checked the Epson PX-8 tech specs, and it looks like the serial and RS232 ports on the PX-8 want +/- 8V. Standard RS232 voltage is +/- 12V, and that's what the MAX3232 chip (used on the Propeller development board for serial communications) puts out. So, I'm wondering if there's a sufficient voltage mismatch as to be causing communication issues? Seems unlikely, but I'm kind of at a loss to understand why this is being so difficult to get going.

Anyhow, I'll keep working - perhaps I can put some resistors in line, and see if that improves the situation.

Saturday, July 3, 2010

The first speed bump

When trying to accomplish something with technology, it seems like there are always these strange "gotchas". I've encountered the first on my road to a PX-8 virtual drive prototype...

As I set out to produce the PX-8 virtual floppy drive, one resource that I'm hoping to use for reference is the open source, Linux-based "vfloppy" program (see previous post). Turns out, vfloppy works great on my old Dell laptop, but not on my newer one (Dell D630). Both are running Ubuntu 10.04 LTS, both have the same serial UART, and they are configured identically. However, with the D630, I get serial communication errors, and with the older Dell Inspiron, I don't. Ugh.

Since I've got the source code, I went poking around to see how the serial port is initialized and opened in the vfloppy program (epspdv3.c). It's pretty straightforward stuff using the standard libraries. Should be about as hardware non-specific as you can get.

Thinking it might be my specific D630, I tested another that I had handy. Same issue. So the problem is not with faulty hardware, but with some specific hardware/software issue.

I know problems come up when trying to accomplish something - it's part of the challenge of a project. But this is my least favorite kind of problem, because it is, at best, only a tangent to the real problem I'm trying to solve.

I might just be stuck using my older laptop for the project, unless some magic happens...

Friday, July 2, 2010

Linux has come a long way, baby

Per an earlier post, I needed to install Linux on one of my machines in support of my Retrochallenge 2010 entry. Bear in mind, I've always been a Linux enthusiast, and have used it since my router QA days in the early 90s (Linux was a great, free environment for network testing). Ah yes, ye olde days of Slackware and disk sets. We only had a 56 Kbps link to the Internet (yes, for the whole company), and being able to get a working Linux with just a few 1.44 MB disks was awesome! But, I digress.

I've been using Ubuntu 10.04 on my Dell Inspiron laptop for about 2 hours now, and let me tell you, it is pretty, and it is fast. It's also quite complete, having transparently (and accurately) detected all the hardware in the laptop. It even let me turn off "tapping" on the touch pad (clicking with a tap, something that drives me NUTS). The laptop is a Pentium M 1.6 GHz with 1 GB of RAM, and runs like a dog under XP. It is not just usable, but snappy, with Ubuntu. I am writing this blog entry from it right now.

Is 2010 the famed year of Linux on the desktop? :-) Maybe for me...

Thursday, July 1, 2010

PX-8 virtual drive: Next stop - Linux and vfloppy!

The vfloppy disk simulator is software that acts like a disk drive for the Epson HX-20 and PX-8 systems. It is written in C, for Linux. It's regularly updated, and now supports the D88 virtual disk file format used by the PX-4/PX-8 emulators produced by Toshiya Takeda.

All the software in play here is GPL/open-source, which is awesome. Having an open, working, updated implementation of the disk drive simulation will be very helpful in my efforts to produce a Propeller-based virtual drive.

This is the most current and best solution I'm aware of for emulating the Epson PF-10 floppy drive on a modern system, so I'm off to install Linux on a spare machine. Rather than use a virtual machine and have the potential hazards of uneven serial port support, I'm putting this on real hardware. I'm going with Ubuntu 10.04 on a Dell Inspiron laptop. Will be nice to take the new Ubuntu for a test drive anyhow!

Retrochallenge 2010 begins!

The Epson PX-8s are charging their NiCads - warming up for their role in my entry for this year's Retrochallenge event. May the games begin!