Tuesday, July 11, 2017

TRS-80 Model 100 Hacking - Getting Connected

While it was fun firing up my Dad's TRS-80 Model 100 and writing a bit of code for it, I was left with a choice: leave this as a fun little experiment, or continue hacking away. After weighing the alternatives, I've opted for the latter: let's hack on the Model 100!

I made this decision for two reasons. First, I've always had an interest in playing with small systems. I could easily imagine an Arduino chip and simple form of output (maybe an LCD, maybe just a bunch of LEDs) that would let me run Forth or Lua in an embedded way. It would be sweet to see how much functionality I could wring out of such a small platform. Heck, the pieces are almost there to make this a wearable. Just imagine it: a watch running on your wrist that was little more than a Forth interpreter? Alas, the devil is in the details, and I've never found quite the right combination of hardware to justify jumping into this project.

The TRS-80 Model 100 is one form of this this hardware dream. Think of it as a computer, and it's a joke. Think of it as microprocessor, plus a simple LCD screen and a keyboard, and it's exactly what I describe above. Why build my own embedded system when I have one right in front of me?

Maybe one day I'll get to that Lua or Forth powered watch, but for now, I've got plenty I can learn about embedded systems right from the Model 100. Heck, the Model 100 is powered by an Intel 8085 processor, which was apparently used in the Mars rover Sojourner. If it's good enough for NASA, it's good enough for me.

The other reason to continue to hack on the Model 100 is more philosophical. In some many ways, the computer is a collection of constraints: it has a tiny amount of RAM, a terribly slow processor and is powered by horrendous programming language (line number BASIC). But, as any Haiku author or Twitter novelist can tell you, constraints bring out creativity. My hope is that by learning to operate in such a hostile environment, I'll stretch my skills and change my perspective as a programmer. At the very least, I'll be more thankful for the modern hardware and programming languages I have at my disposal.

OK, so I'm doing this.

The next challenge to tackle was finding some way to hook the Model 100 up my computer to transfer files. I figured if I could set up a basic serial connection, then I can be confident that I can use the Model 100 knowing that I can publish and save my work with relative ease. A google search on the topic came up with some interesting leads, but it was ultimately this article that saved the day: Surfing the Internet… from my TRS-80 Model 100. Sean Gallagher had a more audacious goal than me: he want to surf the web from his Model 100. I just wanted to send bytes back and forth to another device.

The invaluable recommendation in his article was to suggest that you can buy the necessary null model cable to connect a Model 100 serial port to a USB device at RetroFloppy.com. I headed over there, and at 12:26am dropped an e-mail to the company asking for advice. I specifically linked to Sean's article.

12 minutes(!) later, I had an e-mail back in my inbox. David at Retro Floppy told me exactly what I needed, and even confirmed the cables used in the article. Now that's customer service! I bought the cables and waited.

A few days later, the cables showed up, and I was eager to see if I could get my Mac and the Model 100 to exchanges some bytes. Everything fit when plugged in. That was a good sign.

This StackOverflow article suggested a few apps for doing low level serial communication on a Mac. From the command line, I ran:

sudo screen  /dev/tty.usbserial-A105ZB14 9600

On the Model 100 side, I opened up Telecom. It took a few tries, but I was able to use the Stat command to setup the device in use. I typed Hello World on my Model 100 keyboard, and text appeared in the screen session! It was corrupted, putting some junk between each character, but it worked!

Rather than debug this further, I downloaded and kicked off Serial. It allowed me to select the USB serial port and showed me what settings to use (9600.N.8.1). I set those values on the Model 100, and tried connecting both again. Success!

We've got the world's most primitive data connection!

That's all I had time for today. Next up, I need to figure out a reliable way to transfer files between the two devices. And once I've done that, I can start on my first hacking project: doing music creation on the Model 100.

No comments:

Post a Comment