Friday, August 04, 2017

My TRS-80 Model 100 Meets My LG G6 - Can They Be Friends?

I had some initial success in getting my TRS-80 Model 100 to talk to my Mac mini. The fact that I could type some text in the Model 100's terminal and have it show up on the Mac's terminal was a huge step in the right direction. Next up, I needed a reliable way to shuffle code back and forth from the Model 100. After all, if I compose some brilliant code on the Model 100 I'm going to want an easy way to share it with the world.

I was also curious if I could get the Model 100 to talk to my LG G6. I have a USB Host On the Go adapter, so technically I can plug in the USB serial cable into my phone. But would it do anything? Turns out, it does!

I hooked up the Model 100 to my LG G6 via serial / USB cable and kicked off Gnuroot. I was hoping that I'd be able to use command line tools to access the serial port. Yeah, that was a no go. Before I gave up though, I searched the Google Play store for Serial Consoles and found a slew of interesting possibilities. I installed YJ Term on my phone, launched it and was delighted that popped up a dialog box confirming I wanted to access the USB port. I clicked yes. I made sure the Model 100 and the LG were using the same port settings (9600 baud, 8-bit, no parity, 1 stop bit and no xon/xoff) and typed a message in in YJ Term. I hit enter Send and the text appeared on my Model 100! Whooo!

The reverse worked, too. In short, I'd re-demonstrated basic serial communication was possible, though now I was able to make the connection with my cell phone.

While this was fun to see, it didn't really solve my problem. I needed a way to ship entire files back and forth.

Looking through the Model 100 Quick Reference guide, I noticed that the BASIC Interpreter had a clever trick: you could treat the COM port like any other file. This is a trick right out of the Unix handbook. Or, actually, it's probably the other way around. Either way, you can save basic code to a file by entering:

  save "foo.ba"

You can save the contents of the current BASIC program to the COM port by entering:

 save "COM:88n1d"

Incidentally, you can do the same trick with writing to the printer port. Running the above, pushed all the code I'd loaded into the interpreter over the wire to my phone. This was showing real promise.

One issue I ran into is that YJ Term and other serial consoles were apparently built for debugging purposes more than anything else. So you can save a transcript of the the interaction between the phone and Model 100, but you get extra gunk like timestamps and such. I did a bit of digging and found Serial USB Terminal. This little app has the ability to remove that debugging info, which means that I was able to cleanly send code to the Model 100 and save it on my phone:

In theory, the reverse should work too. I should be able to enter the following code on the Model 100 to have it slurp in a program:

 load "COM:88n1d"

But my attempts to do this simply timed out. Once I get this part of the process decoded, I'll be ready to start my Model 100 BASIC coding career. This is going to be fun!

4 comments:

  1. This post will break the Internet because it is so delightful what you are doing. Keep at it.

    ReplyDelete
  2. Thanks Grant! I'm trying to get the pieces together so I can do really interesting things....stay tuned!

    ReplyDelete
  3. When loading from the M100's serial port, don't use the end quotation.
    So the command would just be: LOAD "COM:88N1D

    ReplyDelete
  4. @Blog4pav - Whoa, how do you know this?

    ReplyDelete