Sunday, July 31, 2011

PX-8 virtual drive mock-up - the gory details

I am quite pleased to report that I managed to create a prototype of a virtual disk drive for the PX-8, using a Propeller "Professional Development Board", and a cable (more on this later) to connect to the PX-8. Here is a brief background of the project, and what I wanted to accomplish for the Retrochallenge:

The Goal

Create a prototype of a PX-8 virtual disk drive using the Propeller microcontroller.

Measurement of Success

The virtual drive should respond to a DIR command from the PX-8, and load a single file.

Main Obstacle

Garbled communications between the Propeller and the PX-8 "serial" (peripheral) port.

What we have here is a failure...

The PX-8 communicates with its peripherals over something called the "serial" port. This is different than the RS-232 port (it's got one of those, too); however, it is actually RS-232 under the hood. Specifically, 38400 baud, no parity, 8 bits, 1 stop bit.

The Propeller development board has built in a MAX3232 level converter and a female DB-9 connector wired as "DCE" (like a modem). Part of the stock software that comes with the Propeller IDE (called the "Propeller Tool") is a module for doing serial communications.

I had a model of software to work from - the "vfloppy" program. This software runs under Linux, and is a virtual disk drive for the PX-8. It is open-source, and works great.

But in order to make any progress at all, I first needed to find a solution to garbled communications between the Propeller and the PX-8. When looking at the bytes going to and fro, it was clear something was haywire.

That something was me.

When I constructed the cable for use with vfloppy, I neglected that a serial cable has two types of ground. One is similar to chassis ground, and the other is signal ground. The reference I was reading at the time for the PX-8 serial port connector did not differentiate, so I hooked the PX-8 signal ground to the PC side chassis ground. This made it kind of work, but not reliably, as there was obviously impedance between the two types of ground. Once I figured this out, just a few days ago, the garbled communications went away. Just in time, I hoped, for a Retrochallenge entry.

Now to make the Prototype

I knew I wouldn't have time to actually duplicate the EPSP protocol in time, so I thought, why not capture a session with a working package (vfloppy), then make a Propeller program to play back that session. It's a very dumb program, with hard-coded bytes in and bytes out. However, although a one-trick pony, it would demonstrate that not only could the PX-8 and Propeller now communicate, but actually have a working conversation.

vfloppy has a great debug mode that can output everything that's going on in a session. I captured that output for a session that included:

  • Go to the E: drive
  • Do a directory
  • Load a program called "BATTERY.COM"
The session was REALLY long, with lots of bytes. I knew I couldn't write a Propeller program that duplicated that session by hand. So, I dusted off my Perl brain cells, and wrote a Perl program that took the session output from vfloppy debug mode, and converted it to Propeller "Spin" code (Spin is the native language of the Propeller). Here's the ugly Perl code:



By the way, I know the pictures are not good. The lighting was bad, and I'm out of time. I'll get some better pictures later...

And here is a portion of the Spin program that it helped me to write (this is the Propeller Tool, the IDE for Propeller programming):



Here's a picture of the Propeller development board, wired up with VGA output and RS232 output, functioning as the PX-8 virtual drive:



And here's a picture of the PX-8 before power-up:



In the next picture, I power up the virtual drive and PX-8, then navigate to the E: drive. When this happens, the in/out byte sequence plays between the PX-8 and the Propeller exactly as recorded when I did the real session with vfloppy.

(For the next pictures, you'll have to click the image to get a bigger version to make it readable. Again, sorry for the bad lighting, and the notoriously bad contrast on the PX-8 display...)

Notice the PX-8 happily shows the E> prompt, perfectly fooled that it's talking to a real drive:



This thing is functioning like a player piano - so I have to type everything just like I typed it in the real session. Any deviation will make the house of cards fall down. So next, I type DIR (return), just like I did for real with vfloppy:



Now, the big moment - I actually run a program! From the PX-8's point of view, it still thinks it's talking to a real floppy drive. From the Propeller's point of view, it's just waiting for the right bytes to come in, then spewing what was recorded earlier:



Smoke and Mirrors


Before you say it, I know - this approach is smoke and mirrors, because there's really near zero intelligence on the Propeller side. However, it met my goal in proving that the PX-8 and Propeller could successfully communicate, and that the Propeller, when properly programmed, can be a virtual drive for the PX-8.

Next Steps!


Now that the facade has proven the viability of the project, my next step is to begin to crank out the code that makes this thing a virtual drive for real.

An SD card will serve as the mass storage for this device. I've used an SD card with the Propeller before, so that assumption should be a safe one.

The vfloppy code is a very useful reference implementation, but I want to make sure I understand everything that it does, and not just copy the logic from it. As I work through the reverse engineering and compare with the published Epson protocols, I'm sure it will be fun and enlightening.

I will keep my progress updated on this blog, and as the project matures, I may actually start a dedicated blog and progress site.

Yay! Time for some sleep! See you all in the Winter Warmup...

SUCCESS!

Full blog post coming next - but I'm packing a happy hooray and sigh of relief, as my Retrochallenge finishes successfully with hours to spare!

Details within a few minutes...

Saturday, July 30, 2011

One more day on Retrochallenge...

I've got one more day on the Retrochallenge.

And I've figured out the cause of the technical problem I was having with serial communications between the Propeller microcontroller chip, and the Epson PX-8 laptop.

Need to do a little soldering, and then hopefully, I can crank out enough code tomorrow to meet my objective!

Saturday, July 16, 2011

Detour #2 - The PC/XT Clone

One of the best times of my career was working with IBM PC/XT systems. Like many things we retro nerds play with, it seems quite primitive by today's standards. But this machine really did usher in the age where business got done with personal computers. And I had the good fortune to be right in the middle of it.

At Hughes Aircraft in the mid 80s, we were pretty much standardized on true-blue IBM. There was a small installed base of Compaq systems, and eventually clones got good enough to rely upon. While the clone dealer we worked with made very good systems, nothing really ever beat the tank-like quality of PC/XTs. I'm not convinced anything short of mil-spec equipment ever will. They were very nearly indestructible, and I can attest to this firsthand.

For this reason, using my PC Portable 5155 has been a joy. It's basically a PC/XT in a portable case, with 9" amber screen, dual 5.25" 360K floppy drives and CGA video in a very well-built case. The 5155 does have some inherent limitations, though - most notably, room for expansion. The form factor of the case makes it difficult to upgrade, since much of the card slot area is blocked by other components. Many of the card slots will only accept half-length cards, and 2 of the 3 full length slots are blocked by the built-in cards (CGA, floppy controller). I was able to get an AST SixPak Plus in there, luckily - otherwise I would have been stuck at a listless 256K of RAM.

Years ago, a buddy of mine gave me a turbo XT clone that he had used back in the day. To the best of his knowledge it was working, but it was missing parts. I had thought a couple of times of robbing parts from the PC 5155, since the clone case would be much more expandable, and more like the desktop machines I used back in the day. But I couldn't bring myself to gut a perfectly working piece of history.

Until it died.

I have a pretty pragmatic approach to my vintage computing. I don't buy something unless it works - no museum pieces. I also don't buy anything so expensive that I'm hesitant to play with it. So when it dies, I either repair it, or give it away. This time was weird and different, since I decided to harvest parts. But it was clear from troubleshooting that something on the motherboard was amiss, so I knew I could get working boards, etc.

It was a challenge to extract the keyboard. The keyboard just snaps off the unit, but the connector is an RJ-style hookup. Inside the 5155, the cable is translated to a standard 5-pin DIN cable by an adapter. I had to extract that adapter, which required some careful disassembly.

Here is the keyboard cable and attached adapter (extracted from within the 5155):



Here is the clone box open:



Card from left to right: CGA video adapter (from 5155), AST SixPak Plus (recovered from 5155), Western Digital FileCard hard drive on a card (10 MB), D-Link 10 Mbps ISA Ethernet card (yes, it networks!), and floppy controller (from the 5155). That's a single 5.25" 360K floppy on the right.

This case and power supply has a very PC/XT reminiscent feel. However, it is clone hardware, lacking a bit of the fit and finish of a real XT. It is pretty nice, though.

I connected it all and fired it up - success!



I did have to install DOS and other related software onto the hard card - more on all that later.

Here's a close-up shot of the computer with DOS running, showing the memory usage:



(Sorry that last pic is a bit dark - the screen doesn't show up well with a flash.)

That's all for now - I need to get started on my real Retrochallenge project! More later on the hard card, networking with Novell Netware 3.12, etc...

Saturday, July 9, 2011

Detour #1 - The HX-20

I'm trying to get started on my Retrochallenge 2011 entry. It's already July 9, and I've only got until July 31st to finish. However, I have stumbled over two hobby-oriented detours on my way to the work on the PX-8 disk drive. The first one? Rejuvenating my dear old Epson HX-20.

The HX-20 is widely regarded as the world's first notebook computer. Epson introduced the system in 1981, and I sold them in retail when they were released. Later, when working for Epson, I had the pleasure of being on the portable computer tech support team.

Back in '07, I received an HX-20 system, along with accessories, as a gift from Bill, a Retrobits listener. Since then, I have used the computer from time to time, but it was somewhat hobbled by an old and flaky NiCD battery pack. I replaced that battery with a 4 AA cell NiMH homebrew pack, but there were two things wrong with this. One, the charging dynamic on NiMH is different than NiCD, and I was never quite sure if I would smoke the NiMH and cause it to leak inside my HX-20. Second, the 4 AA pack was a weird fit and thus, an unsuitable replacement for the 4 sub-C cells that ships with the unit.

I considered buying 4 sub-C NiCD cells and making my own pack, but this gets complicated. The soldering and heat-shrink work is pretty exacting, especially since the 4 sub-C cell pack fits really, really tight in the HX-20's battery compartment. So, after some research, I found out that Batteries Plus makes custom batteries, and I gave them a try. The result was very good.

Here is the HX-20 disassembled, ready for the new pack. Disassembling the unit is pretty easy, but there are flat ribbon connector cables to worry about. These can be fragile and brittle in older computers, so I was quite careful in working with them.



Batteries Plus obtained and used the right connector type, so the battery fit snugly but perfectly. This is the battery they made:



Here it is installed, with the battery holder back in place:



The flat ribbon cables I mentioned before were a little tricky to get re-seated properly when I put the two halves of the computer back together. At first, some of the keys on the keyboard didn't work. I needed to take it back apart and re-seat those cables, then all was fine. Here's the unit back together, and running from the charge the battery had as delivered:



Happy me - 1981 computer, 2011 batteries. As you can see, the system itself is in great shape. I've got all the manuals and everything. So, in a little while, I'm going to crank out some new BASIC programs.

Next post - Detour #2 - my PC/XT clone Frankenstein!