Friday, January 31, 2014

Retrochallenge Winter Warmup 2014 Success!

A few years ago, inspired by software disk drive emulators for the Epson PX-8 laptop computer, I set out to find a self-contained hardware/software combination that could serve as a portable drive. This would be a functional replacement for the PF-10 portable drive, which is unobtainium these days.

With the conclusion of this year's Retrochallenge Winter Warmup 2014, I'm quite a bit closer to the goal. The only thing missing is battery power, which I might be able to solve at some point.

Before going into gory details, here is a video of the drive emulator in action:




Now, the rest of the story...

HARDWARE

The Epson PX-8 is one of the first notebook computers. It's a gem. For a long time, they were still available (recently) brand-new in box. Alas, the distributor is now out of stock. I used the PX-8 back in the day, and worked on the support team for them at Epson. I did an entire podcast episode on this computer, so have a listen if you'd like to learn more.

The centerpiece of the drive emulator project is the Raspberry Pi - a $35 single board Linux computer. You can do a LOT of stuff with it. If this fine device has not made it onto your radar as yet, have a look at these links:

Raspberry Pi on Wikipedia

Raspberry Pi Official Site

Slapped on top of the Raspberry Pi is another key ingredient - the PiFace Control and Display (PiFaceCAD). It is a combination of things designed to help you control your Raspberry Pi without requiring the standard KVM (keyboard/video/mouse) setup. Here's a picture, with credit to the distributor, Element14:



It has a backlit 16x2 LCD display, 5 pushbuttons plus a rocker/button combo on the back, an infrared remote control reader (which I did not use), and a socket which attaches to the I/O pins on top of the Raspberry Pi. You can program all the functionality with Python, as well as do some things from C. I used Python, given it has good support for calls to the operating system.

To round out the hardware, I used a FTDI USB to RS232 converter as the serial port to connect the Raspberry Pi with the Epson PX-8. The final connection to the PX-8 required a custom cable, a mini DIN 8 to DB9. I will provide more info on this in a future post, and you can also find info on building such cables at Fred J. Kraan's site for the PX-8.

SOFTWARE

There are two key pieces of software, plus some configuration, involved in making this all work.

First, credit again to Fred J. Kraan for the vfloppy software, a disk drive emulator and set of associated disk image management utilities for the Epson PX-8. The software is updated from time to time, and not too long ago, switched to a new disk image format to make it compatible with a PX-8 emulator.

The vfloppy program is a command-line tool, so I needed to instrument it somehow to work with the PiFace CAD. Python was the natural choice for the "glue" logic to create a UI on the LCD screen, and launch the software with the disk image selected by the user. The "subprocess" module in Python permits the invocation of processes, and then control of those processes throughout their life cycle.

So, in short, I wrote a Python program to:

  • Present a UI for the user to select a disk image
  • Monitor the PiFaceCAD buttons for interaction
  • Once an image was selected, run the vfloppy program and save the process ID
  • When user pressed "SELECT", stop the vfloppy program, and permit a new image selection, running vfloppy again once selected
  • Exit the program if "EXIT" is selected, and stop the vfloppy process
CONFIGURATION

Writing the program wasn't the complete picture, however. The Raspberry Pi needed to run the program on boot-up. To accomplish this, I performed these steps:
  •  Created a new user on the Raspberry Pi
  • Added that user to groups as necessary to permit access to the Pi's I/O (gpio, spi)
  • Edited the user's startup shell script (~/.bashrc) to run the PF-2014 software on login
  • Set the Pi to auto-login the new user
With these settings in place, the Pi runs the software (which I call "PF-2014" in homage to the PF-10 disk drive for the PX-8) on startup. No hands or feet required.

I learned so much during this Retrochallenge, most notably about Python. I'll blog in a later post about some of the things I picked up (they're handy!).

Looking forward to the summer classic!


1 comment:

Paul Paradigm said...

I have been following your quest for PX-8 home brew magic drives for years! Nice to see a relatively straight forward solution. The PI's a fun thing - but for all the cables!

Paul Paradigm - VK2TXT