TI-86 Advanced Basic
By Aaron Chernosky

Welcome to the 1st TI-86 Advanced Basic Lesson. I will try to make these lessons each you programming tips and ideas to help you make games and/or math and science programs. If you are confused about something I say in here, please E-Mail me. I will try to cover as much as possible for each topic or command.

  • Using Variables
  • Basic input and output
  • Creating useful loops
  • Using Variables

    A key to any good game or program is how you use variables. With other calcs such as the 82 or 83, you only really have 27 individual vars to work with. With the 86 however, you can create variables with more than one character. For example, "Time", "Year", "Date". Since you have this ability, you should use it. What I mean is, try not to make variables that you don't remember what they are. For example, make "tm" to "Time". You do have to be careful though not to use any pre-made variables, or commands. Some of them you can use, like "Xmin" and "Xmax", but others like, "abs" or "Input" are both commands.

    1000->Money
    
    5.5->Xmin
    
    0->Fun

    At the end of some programs, you may want to delete the vars that aren't needed anymore, or were temporary vars. These could be vars use in for loops if short sections that aren't needed for future use. You can delete these vars by using the DelVar(.

    DelVar(A,CC,LIST1)
    
    DelVar(Y1)

    I will explain how to use variables in later sections along with their respective commands and code.


    Basic input and output

    Input and Output is the basic function of a computer: you press buttons and it shows you something. In programming, depending on which language you use, this can be a big hassle or a simple button. Fortunately in 86-Basic, this can be accomplished fairly easily.

    Starting with Input, you probably already know how to use the Input command, but what about key-input? In the 86, when you press a button, it reads that button, that figures out where to go, whether it be the Math menu or a Table or whatever. You can use this on your own via a command called getKy. To use this command, you must you the If command to check if a certain key has been pressed. In many cases, you might want to store the getKy as a variable, like "Key" or just "K". You then want to check for certain keys using the If command. You must use the table on 217 in the User's Manual to help you find what key is what number. You can also get a program here that shows what key you pressed. Now, take a look at this program.

    Repeat K==105
    getKy->K
    If K==105:Then
    Disp "You pressed Enter."
    End
    If K==25:Then
    Disp "This does nothing."
    End
    End

    Now I will explain what that code does. First off, it creates a Repeat loop until you press Enter, which has 105 for its key code. Then, it stores getKy to "K". Then it checks to see what key you pressed. If you press Enter, it displays, "You pressed Enter" and stops. If you press up, it says, "This does nothing" and continues to wait for you to press enter.

    By creating loops like these, usually with added stuff, you can create cool programs and games. Using getKy is one of those things that takes seconds to learn but months to master. You really just need to try making certain things and basically experiment until you fully understand what you can do with this. If you want to, it is also a good idea to check out other peoples games and see what they did.


    Creating useful loops

    A loop is a certain piece of program code that repeats itself until a certain thing happens. Common loops are For(, Repeat, While, and Labeling loops. Each of these can do the exact thing another can and do more or do it better. Sometimes, it is hard as a programmer to figure out how exactly to create a useful loop, a loop that will accomplish each goal necessary. This section teaches you how to use each loop effectively so that you get the best output.

    ForThe command For is an increment loop. It starts out on a certain number and increments until it reaches the finishing number. This can be both positive a negative increments (using increments of -1). This can be used for pauses or to make something move across the screen. It is usually very useful in many situations.
    Repeat Repeat is like For but doesn't use increments. It waits until a specific command is performed then stops. Can be used for getKey loops and tracking certain variables.
    WhileUse While to do certain things while something is true. You can use this for lots of things all depending on one variable(s). This is a very helpful command that I use a lot.

    That's all for this lesson. I will probably come back and update this and fix some stuff but another lesson is around the corner.