"Advanced TI-82 Programming Techniques"

With self proclaimed ruler of the universe: Frank Force

This month we'll be examining subprograms and program structure and also talk about the Get function. Last month I was busy moving into a new house so I didn't write a column. If you want to write to me for whatever reason, my address is *****@voicent.com


Subprograms are really just programs run from inside other programs. They act as "functions" because they can be run and when finished, they will return to the spot in the program where they were executed. They're useful for various reasons:

Performing functions that would otherwise be repeated within the program, improving speed by separating essentials and nonessentials, making programs more accessible and easier to understand.

Subprograms can often make programs shorter by putting sections of code that occur more then once into the a subprogram. Then wherever that code used to appear, you would just run the subprogram. For example, many programs have a subprogram that will draw filled in circles, a function not ordinarily offered.

Mostly I use subprograms to improve speed. I usually have a repeating engine that takes care of all the essentials. This engine will take care of everything that will be occurring most of the time. Then I have one IF that will check if anything not yet accounted for happened, if so it runs a subprogram. It's simpler then it sounds.

I'll use Breakout as an example. Basically in the main engine all I accounted for was the ball moving. Then I had a separate engine that was identical to this but also moved the paddle left or right. All the functions that happened less often (when the ball hits a block, the wall, or the paddle) were dealt with from a subprogram.

As a general rule, try to put anything that occurs less then 90% of the time into a subprogram. You should notice a big speed difference.


The Get function is used to receive information from another calc. Usually in games it is used for variables but can also be used for pics, matrices, lists, and just about anything else. You have probably noticed that the Get function will work sometimes and not others. It would take forever to explain every use of Get, so I'm just going to try to explain when it will work. Get will work when the sending calc is at:

The home screen
A pause prompt
An Input
A Prompt
A Menu

It will not work anywhere else and the variable it tried to get will remain unchanged. Borrow someone else's calc and experiment with different methods of using the Get function. The most popular seems to be the "taking turns" method, used in Battleship, but there are many other ways.


I can't emphasize this template program enough. I know I've had it in every column so far, but it's just that important.

Repeat Ans = 75.5 / 4.5 Repeats until you press enter.
Getkey - 25 Stores in ans
If abs Ans = 1 Left (24) or Right (26) - 25.
Then So now Left = -1 and Right = 1
Run if you pressed Left of Right

Ans/4.5 - 1 Up (25) or Down (34). Do the math...
If abs Ans = 1 So now Up is -1 and Down is 1
Run if you pressed Up or down


That's about it for this month. I lost the book that said what we would be doing each month so you'll just have to be surprised next time. Chow.