Thursday, December 31, 2009

Adventures in LPT - Part I

An integral part of cross-developing for any platform is obvious: how do we transfer our work to the real hardware?

In the world of the Commodore 64, a few decent solutions have been proposed:

1. Install a 5.25" floppy drive into your PC.

2. Create a C64 cartridge that emulates a C64 disk drive and takes an SD card (or similar) as input.

3. Create a cable to communicate between the C64 and a PC.

And yes, there are others that I didn't mention. But by far, my personal favorite is the third option. But what kind of cable do we use, and how does it work?

A few cables have been designed, my favorite being the XE1541 cable, invented by Nicolas Welte and Wolfgang Moser:




This image from http://amigakit.leamancomputing.com/catalog/images/1541-transfer-cable.jpg , if you didn't catch the watermark ;) .

This cable connects the 6-pin serial DIN port on the C64 to a standard 25-pin LPT (Line Print Terminal) on a PC. In this way, the two can be connected in such a way that the PC will act just like any peripheral device that could be connected to the C64. Specifically, we can write a program for the PC so that it will act exactly like a CBM 1541 floppy disk drive (or any C64-compatible floppy disk drive, really).

Astute and/or experienced readers will notice something. The C64's port is serial, but the LPT is parallel. How can this be, and why wouldn't we just connect the right lines to a serial COM port on the PC?

You have to remember here that the C64 is over twenty years old. The significance of this is that the transfer rate of its serial port is WAAAAAAAAAAAAY slower than that of modern COM ports. In addition, there are lines in the C64 serial port that can't be checked with a modern COM port without direct pinout control. This means that with hardware-controlled serial encoders and decoders on the COM ports, we can't slow the PC's connection down enough to effectively communicate with the C64. However, we can connect certain lines of the C64 to corresponding control and status register lines of the LPT. In this way, we can connect lines that weren't available to us by using a COM port. More importantly, though, we can simply continuously output or poll with correct timing the necessary values to/from the C64.

That's all for now I think :) . In the next parts of this series, I'll get into the specifics of the XE1541 cable, with schematics, some connector pinouts, etc :) . For now, wish me luck, as I finally submitted my MIT application! Also bring on 2010...YUP's got some big things planned; are you ready? ;)

0 comments:

Post a Comment