To Type, Shoot Straight, and Speak the Truth...

A man of the cloth and the steel he wields

File Transfer for TRS-80 Model 100/102/200 using a Digital Audio Recorder: The Road Less Travelled…

It all started simply enough: I came up with the idea of using my retrotech timelapse camera kit to do a timelapse of the upcoming Phoenix Type-In.  Well, when you come up with these ideas, the first thing you do is check your kit and get it ready.  Thus began the adventure…

I pulled the Timelapse Kit out of the closet where I had stored it some months ago, and I expected the batteries in the TRS-80 Model 100 to be dead. They were. No big deal, I changed them. Then I booted it up to find that it had sat long enough without power that the memory had cleared, wiping the resident TL.BA program that I use as an intervalometer.  “No Problem” thought I, “I have a backup right here on my PC.

TRS-80 Model 100, still kickin' since 1983

TRS-80 Model 100, still kickin’ since 1983

Well, in order to transfer the file from my PC to the Model 100, I need a null-modem cable (you remember them, right?) and a PC with an RS-232 port. I can whip up an old PC from parts in minutes that will suit, but for some reason I couldn’t find my Null Modem Cable.

Ergh. No way to transfer the file then. Well, I guess I’ll just rewrite the timelapse program. No Problemo – it’s like 20 lines of BASIC. I dusted off the Model 100’s BASIC reference manual and set to work. About halfway into it, I discovered that the Model 100’s Backspace key had stopped working… and I discovered that by not being able to delete a typo. Ergh…

IMG_3844Ok, that’s gonna be a problem, but I can power through it. I have my Model 200 that I can use instead. Now I just have to figure out how to get what I’d already typed from the 100 to the 200.  At first I considered trying to use the PDD drives I have, but they’ve been fritzy for decades and I don’t really trust them. That left me with the old CCR-81 Cassette Drive.

image011It was then that I got the bright idea of trying to use a Digital Audio Recorder to transfer the files rather than the Cassette Drive. After all (I reasoned), a digital audio file will probably have better data fidelity than a 30 year old tape recorder with dry belts and a God-knows-how-old cassette tape, right?

So I gave it a try. I happen to have picked up an iKey Audio M3 at Deseret a week or two ago for $10 (smokin’ deal – still in the box!), and it can be set to record 44k Mono WAV files.  After a few tries (the TRS-80 is a little deaf, and needs the sound levels just about as high as they’ll go for both recording and playback), I found I could save the files from the Model 100 to the M3 recorder and load them into the Model 200 for editing. YAY! :D

I then happily finished the timelapse program, tested it on the Model 200 and then saved it to the M3 and loaded it to the Model 100. Mission accomplished!

And then I realized that I had a digital representation of my program as an audio file on an SD card I could read on my PC.  Hmmn… I wonder if anyone has written some sort of converter to read an audio file of a saved program on cassette and turn it back into ASCII? That would be a handy way of transferring files from my Model 100/200 to the PC, wouldn’t it?

It turns out that someone has… *sort of*… At least they have for the TRS-80 Model I/III/4. Completely different machines, different processor and OS, but just maybe they use the same format for recording data to tape? Might as well give it a try and see what happens… I downloaded the utilities for converting Model I/III/4 WAV files to CAS (a format used to load the programs into emulators), and to convert from CAS to Hexidecimal Text.

My first attempt wouldn’t load because the M3 recorder records a WAV file that isn’t Microsoft 16-Bit PCM format, so the first thing to do is convert it to that format. I loaded the WAV file into the Free Audacity audio editor and simply “exported” it to the proper format.

2014-07-25-5Once in the right WAV format, the file imported into WAV2CAS just fine, and I could immediately see that even though the program didn’t understand the audio file’s data headers, it could read the file and could show the HEX and ASCII contents. I couldn’t select or copy that text though. First I needed to “Save” each chunk of the packet as a separate CAS file. I did so, exporting all chunks except the first one, which contained garbage headers.

2014-07-25-1The next step is to fire up the PLAYCAS program and load each of the CAS files into it, then right-click the title bar to get the menu where you can “save text”, which finally exports the data to a plain ASCII text file.

2014-07-25-2Well, OK. Not really plain ASCII. What you get is a bunch of text files that contain the data in a HEX column and an ASCII column. This is not really what you want in the end, so here’s how to get the plain text. First, open up all the text files in a text editor (I use Notepad++) and copy/paste them all together in order. What you get looks like this:

2014-07-25-3Delete the headers and use the “Regular Expression” search/replace function to get rid of the ASCII column. All you want is the HEX column.  Copy that entire HEX column and go to a HEX to ASCII converter site and paste the HEX code into the “convert” box.

2014-07-25-42014-07-25-6What you’ll get in return is the ASCII text with some garbage characters at the beginning and ends of the chunks. Just cut out these garbage characters, and what’s left is your text file!

and here it is:

10 CLS:PRINT”Canon PS600 Timelapse”
20 PRINT”2014 – T. Munk – munk.org”
30 PRINT:INPUT”Seconds Between Shots”;D
50 I1=30
110 B=INT(I1*D)
200 INPUT “#Exposures to Shoot”;A:O=A
300 CLS:PRINT”Timelapse Program:”
305 PRINT”Shoot”;A;”Exposures”
310 PRINT”At”;D;”Second Intervals.”
350 PRINT:INPUT”Press <ENTER> To Begin”;G$
390 IF G$ = “” THEN 400 ELSE 10
400 CLS:MOTOR ON:FOR Z = 1 TO 25:NEXT Z
410 MOTOR OFF:A=A-1
411 S2=INT(D*A)
413 PRINT”*** TRS-80 Timelapse ***”
414 PRINT “<SHIFT><BREAK> To Quit.”
420 FOR X=1 TO A STEP 1
425 PRINT@122,”Exposure”;X;”of”;O
430 FOR E=1 TO B STEP 1
433 R=ABS((E/I1)-D):R2=INT(R)
435 PRINT@162,”Countdown:”;R2
440 NEXT E
450 MOTOR ON:FOR Z=1 TO 25:NEXT Z:MOTOR OFF
490 NEXT X
495 PRINT@122,”Exposed”;X;”of”;O
500 A=O
1000 PRINT@162,”Ended Shoot.          “

Oh, and in case you want to hear what this data file sounds like in the language of the TRS-80’s Cassette Save format, listen to this WAV file.  (set your volume low first, for Jebus sakes, the TRS-80 sings one screetchy song!)

Alternately, you can use the above WAV file to load this program directly into your own Model 100/102/200!

 

 

Updated: August 2, 2014 — 6:41 pm

13 Comments

Add a Comment
  1. This reminds me of the Timex Sinclair 1000 that I used to play with. We’d transfer cassette tape files over the phone lines, using a Radio Shack battery-powered audio amp, as a makeshift modem. Fun stuff.

    1. Yeah, I got a little obsessed about it after catching up on the new AMC series “Halt and Catch Fire”. The little Model 100 shows up in enough scenes that II started thinking about it a lot. Unlike Mad Men where Selectric II’s pop up in 1959, ten full years before they actually existed, The Model 100 did in fact exist and was sold in the show’s current 1983 (it had been introduced just a few months before Comdex ’83).

      After playing around last night, I suspect that it’d be trivial to convert the cassette-save WAV files directly to plain ASCII if only I understood what the Model I/III/4 utilities were doing. It seems that the data format is the same, but the utilities just don’t grok the header bits and the handshake bits in-between the data chunks, and so can’t link the chunks together. If I understood how the format worked and knew a dang thing about Windows programming, I’d do it myself. :D

  2. I understood none of these but it sure sounds impressive. (:

  3. Well, it’s all Greek to me!

  4. Man, oh, man! Does that ever take me back! It’s great to see where we came from and get some feeling for how we got here. Kudos, Ted, for remembering it and having the guts to try to make it work with old gear. This kind of project isn’t exactly easy even with modern tools but there’s an advantage with the primitive tools in that they both forced and made possible an understanding of the low-level processes you were working with. Great example. Thanks.

    1. I agree. One of the many things I love about the Trash-80 is the fact that the technical reference manual is only a couple hundred pages long and describes in fine detail every memory address and instruction set and how each function controls each specific IC. Heck the addressable memory map for the Model 100 fits on a single page in the manual. It’s the closest I’ve come to an understanding of how software operates on hardware at the very lowest level in a computer, only possible because it’s such a simple and comprehensible system.

      Oh and after some research, it appears to me that the base carrier format of the audio is probably AFSK, which I think is also used in HAM packet-radio data transmission. It just uses frequency shifting to represent digital 1’s and 0’s as waveforms. If this is so, it would explain why the Model 1/3/4 CAS converter has no problem decrypting the plain text in the file and only chokes on the flow-control codes and headers. I have an idea about maybe writing an analyzer/decryptor in PHP, assuming I can find a library that can analyze waveforms in an audio file. Then it’d just be a matter of converting the waveforms to binary, then to ASCII and stripping out the high-ASCII headers and control codes as extraneous noise.

      Good Jebus, this rabbit hole is deep…

      1. Well, to analyze the waveforms, while you’re waiting for Goodwill to give you an oscilloscope next week, what about opening it in one of those music editing apps that are all over the net these days? At least might give you some ideas about the structure.

  5. Wow. I worked a number of roundabout ways doing various things in my earlier days with old tech, but nothing as magnificently confusing as what you did here, and I even understand most of what you said. XD

  6. You bring back a lot of memories from the late 70s early 80s. Weren’t computers fun way back then?

    1. still fun, if you do it right! :D

  7. Wow that really takes me back. This is why I like hanging out with you. I tend to just do these as thought experiments but you actually haul out the gear and DO them.

  8. Very clever and super interesting. Thanks for documenting.

  9. Thanks for sharing that WAV!! I needed to hear that sound again.

Leave a Reply

Your email address will not be published. Required fields are marked *

To Type, Shoot Straight, and Speak the Truth... © 2015 Frontier Theme