In my previous post, I discussed how I cleaned out and restored my old TI-85 Graphing Calculator after finding corroded batteries inside.
After finally getting it to turn on, I immediately started reliving my high school experience. It was honestly kind of surprising how quickly my memories came back to me. Despite not using the calculator for almost two decades, I was able to remember and use many of the functions and my fingers seemed to instinctively know where each letter was on the keyboard. Maybe it shouldn’t have been surprising though, that thing was an extension of my arm during many classes in high school and college and I spent a lot of free time reading the manual and learning the simple programming language that came pre-installed. (ProTip: This is not how you become popular in 1995.)
I had gotten the calculator out of storage to see if any of my old high school programs were still installed. Unfortunately, the TI-85 did not come equipped with permanent storage so programs needed power to survive in RAM. Mine were all lost.
I was probably feeling overly nostalgic because I started working on a new program for the calculator. Appropriately enough for a calculator, my program is called Simple Math. It takes two numbers and then adds, subtracts, multiplies, or divides them. Obviously, this is a bit redundant to the calculator’s basic functions. I was more interested in working with the TI-BASIC programming language than I was with creating something useful.
The TI-85 was limited to just 8 characters for the names of variables, functions, and files (as were most of computers of that era). So the program is actually called SMPLMTH. When loading it up from the Programs menu, this is what you see.
The program has a greeting and then asks for two numbers. The TI-85 has two methods of asking for user input. The first (and the one I’ve used here) is the Input command. It simply displays a question mark and then waits for the user to type in a value.
The second method is using a Prompt command. This is very similar except that the name of the variable being loaded is displayed for the user.
After the user enters the numbers, the program displays the chosen numbers and then asks which mathematical function should be applied.
The TI-85 cannot concatenate strings and numbers so the line displaying the chosen numbers was fairly difficult to figure out. To be used in a sentence, the variables containing numbers had to be cast as strings. In modern programming languages, there are simple commands that can easily cast values to other data types, but not so on the TI-85. For example, in Excel, you would use the TEXT function to convert numbers to strings. (Although many can do it implicitly, including Excel. The TEXT function in the example below is not necessary to get the same result.)
To accomplish it on the TI-85, I needed to use a special function called St⯈Eq (String to Equation). It wasn’t as simple as just dropping the variable into the function. I ended up needing to do a Linear Regression on the variable and then substring the result into a new string variable. (I can’t take credit for the idea, I found the code on Technicalc.org.) That’s obviously needlessly complex but I think it was the only solution available.
It also highlights one of the major difficulties of writing TI-BASIC – the use of non standard characters. Converting strings required the Eq⯈St command. Storing a value to a variable requires another arrow character. For example, 60 → VarName. This is significantly different from other version of BASIC which used the LET command (ie. LET VarX=95). The arrow assigning values reminded me a little of the R syntax, although that can easily be typed with a keyboard (i.e. VarX <- 60).
I’m using a unicode arrow characters (U+2bc8 and U+2192) to replicate the look of these characters, but I have no idea what the characters actually are. They definitely make programs harder to write since you can’t use a regular text editor. As I recall, to write programs for a TI-85, you needed to use their TI-GRAPH LINK software. It was a very proprietary model.
Once you entered your numbers and made your calculation choice, the Simple Math program used an IF statement to determine which function to perform and output the result.
Despite the program being pretty useless, it was interesting to work in such an old environment and think about what has changed and what has remained the same in the years since I last used it.
Some functions like IF statements are very similar to their modern equivalents (although I needed to nest the IF statement to have multiple conditionals). Other things, like the lack of local variables were surprisingly different. (The variables that I used in the program were automatically global and accessible by any other program or calculation.) Even in this little program I was able to find several examples of increased efficiency and simplified syntax in modern programming languages.
It was also interesting to think about the possibility that I might be one of the only people in the world to write a program for this particular piece of hardware in 2019. Although that might not be true because the internet still has a surprising amount of resources of programming older TI graphing calculators. Perhaps there are more hobbyists out there than I realize.
ticalc.org has a ton of programs, examples, and guides for the TI-85
TI-Freakware has a guide to TI-BASIC for the TI-85.
TI-Basic Developer has a ton of guides and programs available (although apparently for later TI versions)
Wikibooks has a TI-Basic manual, but once again it seems more focused on later calculators. (I found a few commands that are not compatible with the TI-85.)
The University of Arizona maintains a website of TI-85 lessons.
The TI-85 is a bit of a relic now. Between the monochrome screen, tiny amount of memory, difficulty of transferring data and programs, and non-standard characters, it is hard to think of a compelling reason to use it today. Making kids learn coding on this in the age of languages like Scratch and Python would be needlessly difficult. However, playing around with it for an evening reminded me of what a remarkable piece of technology this was. Decades before anyone had conceived of a smartphone, millions of high school kids carried a programmable computer in their backpacks that wasn’t that much bigger than a modern larger smartphone (at least in length and height, not so much in terms of width).
Unfortunately I am not able extract my example program off of the calculator. I’ve long ago lost my graph-link cable and even if I had it, my computer doesn’t have a DE-9 connector. Also, the Graph-Link software for the TI-85 doesn’t support versions more recent than Windows 95.
If you’d like to see the program, I’ve typed up the code below. The variables NUMA and NUMB hold the numerical values (REAL type in TI-BASIC) and NUMAS and NUMBS are the String versions. It is released under the MIT License.
:Disp "WELCOME TO"
:Disp "SIMPLE MATH!"
:Disp "ENTER A NUMBER"
:Disp "ENTER ANOTHER NUMBER"
:sub(X,1,lngth X-3 → NUMAS
:sub(X,1,lngth X-3 → NUMBS
:Disp "YOU CHOSE "+NUMAS+" AND "+NUMBS+"."
:Disp "WOULD YOU LIKE TO:"
:Disp "1. ADD"
:Disp "2. SUBTRACT"
:Disp "3. MULTIPLY"
:Disp "4. DIVIDE"
:If ANS1 == 1
:If ANS1 == 2
:If ANS1 == 3
If ANS1 == 4
:Disp "THAT WASN'T A CHOICE!"