TI-84 Programming Tutorial

Master TI-BASIC programming on your TI-84 calculator. Learn to create programs, games, and custom functions with step-by-step tutorials, practical examples, and optimization techniques.

โฑ๏ธ 45 min read
๐Ÿ’ป Programming Guide
๐ŸŽฎ Games & Apps

Game Development Tips

โ€ข Start with simple games and add features gradually
โ€ข Use getKey for real-time input in graphics games
โ€ข Keep game loops efficient to maintain smooth performance
โ€ข Test boundary conditions and edge cases thoroughly
โ€ข Add sound effects using the Tone command for better experience

๐Ÿš€ Getting Started with TI-BASIC

TI-BASIC is the built-in programming language of the TI-84 calculator. It allows you to create custom programs to automate calculations, create games, and build useful tools for math and science.

Creating Your First Program

Let's start by creating a simple "Hello World" program to understand the basics.

Program Creation Steps:

1
Access Program Menu: Press PRGM to open the program menu
2
Create New Program: Arrow right to NEW, select 1:Create New, press ENTER
3
Name Your Program: Type HELLO (max 8 characters), press ENTER
4
Enter Code: You're now in the program editor, ready to write code
Program: HELLO
PROGRAM:HELLO
Disp "HELLO WORLD"
Disp "Welcome to TI-BASIC!"
Pause

Running Your Program

Once you've written your program, you need to know how to execute it.

Running Programs:

1
Exit Editor: Press 2ND + MODE (QUIT) to return to home screen
2
Access EXEC Menu: Press PRGM, then select EXEC tab
3
Select Program: Choose your program from the list (HELLO)
4
Execute: Press ENTER twice to run the program
HELLO WORLD
Welcome to TI-BASIC!

Press any key to continue...

Program Management

Learn essential program management tasks for efficient development.

Task Menu Path Steps Notes
Edit Program PRGM โ†’ EDIT Select program, press ENTER Makes changes to existing code
Delete Program MEM โ†’ MGMT โ†’ 7:Prgm Select program, press DEL Permanently removes program
Rename Program Edit โ†’ Change first line Edit PROGRAM:NAME line Must follow naming rules
Copy Program Edit โ†’ Copy code Create new, paste code Useful for variations
Archive Program MEM โ†’ MGMT โ†’ 5:Archive Select program type Protects from RAM resets

Program Naming Rules

โ€ข Program names can be 1-8 characters long
โ€ข Use only letters and numbers (A-Z, 0-9)
โ€ข Names are case-insensitive (HELLO = hello)
โ€ข Avoid names that conflict with built-in functions
โ€ข Choose descriptive names for easy identification

๐Ÿ“ Basic Programming Concepts

Understanding fundamental programming concepts is essential for creating effective TI-BASIC programs. Let's explore variables, input/output, and basic program structure.

Variables and Data Types

TI-BASIC supports several types of variables for storing different kinds of data.

Variable Type Examples Range/Limits Usage
Real Numbers A, B, X, Y ยฑ1ร—10โปโนโน to ยฑ9.9999...ร—10โนโน General calculations
Lists L1, L2, Lโ‚ƒ Up to 999 elements Arrays of numbers
Matrices [A], [B], [C] Up to 99ร—99 elements 2D data arrays
Strings Str1, Str2, Str0 Up to 255 characters Text and messages
Graphics Pic1, Pic2, Pic0 95ร—63 pixels Images and graphics

Input and Output Commands

Interacting with users is fundamental to useful programs.

Input/Output Examples
; Display text
Disp "Enter a number:"

; Get user input
Input "Number: ",A

; Display variable
Disp "You entered:",A

; Prompt for multiple inputs
Prompt B,C

Mathematical Operations

TI-BASIC supports all standard mathematical operations and functions.

Operation Symbol Example Result
Addition + 5 + 3 8
Subtraction - 10 - 4 6
Multiplication * 6 * 7 42
Division / 15 / 3 5
Exponentiation ^ 2^3 8
Square Root โˆš( โˆš(16) 4
Absolute Value abs( abs(-5) 5

Your First Useful Program

Let's create a program that calculates the area of a circle.

Program: CIRCLE
PROGRAM:CIRCLE
ClrHome
Disp "CIRCLE AREA CALCULATOR"
Disp ""
Input "Radius: ",R
ฯ€*R^2โ†’A
Disp "Area =",A
Pause

Memory Considerations

TI-BASIC programs run in RAM, which is limited. Large programs or those using many variables may cause "ERR:MEMORY" errors. Archive important programs to protect them from RAM clearing.

๐Ÿ”„ Control Structures

Control structures allow your programs to make decisions and repeat actions. These are essential for creating intelligent, interactive programs.

Conditional Statements (If-Then-Else)

Use conditional statements to make your programs respond differently based on user input or calculations.

If-Then-Else Structure
; Basic If-Then
If A>0
Then
Disp "Positive number"
End

; If-Then-Else
If A>0
Then
Disp "Positive"
Else
Disp "Zero or Negative"
End

Comparison Operators

These operators are essential for creating conditions in your programs.

Operator Meaning Example True When
= Equal to A = 5 A equals 5
โ‰  Not equal to A โ‰  0 A is not zero
> Greater than A > 10 A is greater than 10
โ‰ฅ Greater than or equal A โ‰ฅ 0 A is zero or positive
< Less than A < 100 A is less than 100
โ‰ค Less than or equal A โ‰ค 50 A is 50 or less

Loops

Loops allow your programs to repeat actions, making them more powerful and efficient.

For Loops

Use For loops when you know how many times to repeat something.

For Loop Examples
; Count from 1 to 10
For(I,1,10)
Disp I
End

; Count by 2s from 0 to 20
For(I,0,20,2)
Disp I
End

; Calculate factorial
1โ†’F
For(I,1,N)
F*Iโ†’F
End

While Loops

Use While loops when you need to repeat based on a condition.

While Loop Examples
; Number guessing game
randInt(1,100)โ†’N
0โ†’G
While Gโ‰ N
Input "Guess: ",G
If G>N
Disp "Too high"
If G<N
Disp "Too low"
End
Disp "Correct!"
End

Practice Program: Grade Calculator

Let's combine what we've learned to create a useful grade calculator.

Program: GRADES
PROGRAM:GRADES
ClrHome
Disp "GRADE CALCULATOR"
Input "Number of grades: ",N
0โ†’S
For(I,1,N)
Input "Grade "+toString(I)+": ",G
S+Gโ†’S
End
S/Nโ†’A
Disp "Average: ",A
If Aโ‰ฅ90
Disp "Grade: A"
If Aโ‰ฅ80 and A<90
Disp "Grade: B"
If Aโ‰ฅ70 and A<80
Disp "Grade: C"
If Aโ‰ฅ60 and A<70
Disp "Grade: D"
If A<60
Disp "Grade: F"
Pause

Control Structure Best Practices

โ€ข Use proper indentation to make code readable
โ€ข Always match If with End statements
โ€ข Prefer loops over repetitive code
โ€ข Use meaningful variable names (I for index, N for count)
โ€ข Test edge cases (what if user enters 0 grades?)

๐Ÿš€ Advanced Features

Advanced TI-BASIC features allow you to create sophisticated programs with graphics, file operations, and complex data handling.

Working with Lists

Lists are powerful for handling multiple data values efficiently.

List Operations
; Create and fill a list
1,2,3,4,5โ†’Lโ‚

; Access list elements
Lโ‚(3)โ†’A ; A = 3
10โ†’Lโ‚(2) ; Change 2nd element to 10

; List operations
dim(Lโ‚)โ†’S ; Get list size
sum(Lโ‚)โ†’T ; Sum all elements
max(Lโ‚)โ†’M ; Find maximum
min(Lโ‚)โ†’N ; Find minimum

; Sort list
SortA(Lโ‚) ; Sort ascending
SortD(Lโ‚) ; Sort descending

Graphics and Animation

Create visual programs using the calculator's graphics capabilities.

Basic Graphics
; Clear and setup graphics
ClrDraw
AxesOff
GridOff

; Draw points and lines
Pt-On(50,30) ; Draw point at (50,30)
Line(0,0,95,63) ; Draw diagonal line
Circle(47,31,20) ; Circle at center with radius 20

; Text on graphics screen
Text(10,10,"Hello Graphics!")

; Simple animation
For(X,0,90,5)
ClrDraw
Pt-On(X,30)
DispGraph
End

Subroutines and Modularity

Break complex programs into smaller, manageable pieces.

Main Program with Subroutines
; Main program
PROGRAM:MAIN
Menu("CALCULATOR","Add",A,"Subtract",S,"Quit",Q)

Lbl A
prgmADD ; Call ADD program
Stop

Lbl S
prgmSUB ; Call SUB program
Stop

Lbl Q
Stop

Memory Management

The TI-84 has limited RAM (~24KB). Large programs or extensive use of lists/matrices can quickly fill memory. Always test programs on a calculator with typical memory usage.

๐ŸŽฎ Game Development

Creating games is one of the most exciting aspects of TI-BASIC programming. Games help you learn advanced programming concepts while creating something fun.

Game Design Principles

Before coding, consider these fundamental game design elements.

Element Description Implementation Example
Player Input How players control the game getKey, Input, Menu Arrow keys for movement
Game State Current condition of game Variables, lists Player position, score, lives
Graphics Visual representation Pt-On, Text, Pixel test Player sprite, obstacles
Game Loop Main program cycle While loop Update, draw, check conditions
Win/Lose Conditions How game ends If statements Reach goal, lose all lives

Simple Game: Number Guessing

Let's start with a text-based guessing game to learn game programming basics.

Program: GUESS
PROGRAM:GUESS
ClrHome
Disp "NUMBER GUESSING GAME"
Disp "I'm thinking of a number"
Disp "between 1 and 100"
randInt(1,100)โ†’N
0โ†’T ; Tries counter
0โ†’G ; User's guess

While 1 ; Game loop
; Increment tries
T+1โ†’T
Input "Guess #"+toString(T)+": ",G
If G>N
Disp "Too high!"
If G<N
Disp "Too low!"
End
If G=N
Disp "Correct! You got it in"
Disp T," tries"
Pause
Stop
End

Graphics-Based Game: Snake

Now let's create a simple Snake game using graphics.

Program: SNAKE (Simplified Version)
PROGRAM:SNAKE
ClrDraw
47โ†’X ; Snake X position
31โ†’Y ; Snake Y position
1โ†’D ; Direction (1=right, 2=down, 3=left, 4=up)
0โ†’S ; Score

; Place food randomly
randInt(5,90)โ†’FX
randInt(5,58)โ†’FY
Pt-On(FX,FY)

While 1 ; Game loop
; Check for key press
getKeyโ†’K
If K=26 ; Up arrow
4โ†’D
If K=25 ; Down arrow
2โ†’D
If K=24 ; Left arrow
3โ†’D
If K=27 ; Right arrow
1โ†’D

; Move snake
If D=1
X+2โ†’X
If D=2
Y+2โ†’Y
If D=3
X-2โ†’X
If D=4
Y-2โ†’Y

; Check boundaries
If X<0 or X>94 or Y<0 or Y>62
Then
Disp "GAME OVER!"
Disp "Score: ",S
Stop
End

; Check if food eaten
If abs(X-FX)โ‰ค2 and abs(Y-FY)โ‰ค2
Then
S+10โ†’S
randInt(5,90)โ†’FX
randInt(5,58)โ†’FY
End

; Draw everything
ClrDraw
Pt-On(X,Y) ; Snake head
Pt-On(FX,FY) ; Food
Text(1,1,"Score:"+toString(S))
DispGraph
End

โšก Optimization Techniques

Writing efficient TI-BASIC code is crucial for creating responsive programs. Learn techniques to make your programs run faster and use memory more effectively.

Speed Optimization

Several techniques can significantly improve your program's execution speed.

Technique Slow Method Fast Method Speed Gain
Variable Storage A+1โ†’A IS>(A,MAX) ~2x faster
List Operations For loop with Lโ‚(I) Built-in list functions ~5x faster
String Building Str1+Str2โ†’Str1 Pre-allocate string size ~3x faster
Graphics Multiple Pt-On calls StorePic/RecallPic ~4x faster
Calculations Repeated complex math Store intermediate results Variable

Memory Optimization

Efficient memory usage prevents crashes and allows for larger programs.

Memory-Efficient Programming
; Clear unused variables
DelVar A
DelVar B

; Use lists efficiently
โ†’Lโ‚ ; Clear list
ClrList Lโ‚‚,Lโ‚ƒ ; Clear multiple lists

; Reuse variables
Input "Value: ",A
A*2โ†’A ; Reuse A instead of new variable

; Archive large programs
; Use 2ND+MEMโ†’5:Archiveโ†’7:Prgm

Code Size Optimization

Smaller code means faster loading and more available memory.

Code Size Reduction Techniques
; Use shorter variable names
A ; Instead of COUNTER

; Combine operations
A+1โ†’A:B-1โ†’B ; Two operations on one line

; Use implied multiplication
2A ; Instead of 2*A
ฯ€Rยฒ ; Instead of ฯ€*R^2

; Eliminate unnecessary commands
A ; Displays A (instead of Disp A)

; Use built-in functions
rand ; Random number 0-1
int(rand*6)+1 ; Dice roll 1-6

Algorithm Optimization

Choose efficient algorithms for better performance.

Efficient Algorithm Examples
; Efficient factorial calculation
PROGRAM:FACTFAST
Input "N: ",N
seq(X,X,1,N)โ†’Lโ‚
prod(Lโ‚)โ†’F
Disp F

; Fast prime checking
PROGRAM:ISPRIME
Input "Number: ",N
If Nโ‰ค1 or (N>2 and fPart(N/2)=0)
Then
Disp "Not prime"
Stop
End
For(I,3,โˆš(N),2)
If fPart(N/I)=0
Then
Disp "Not prime"
Stop
End
End
Disp "Prime"

Optimization Trade-offs

Remember that optimization often involves trade-offs between speed, memory usage, and code readability. Optimize only when necessary, and always test thoroughly after making changes.

๐Ÿ”ง Practical Applications

TI-BASIC programming shines when solving real-world problems. Here are practical programs that demonstrate useful applications for academics and daily life.

Scientific Calculator Programs

Extend your calculator's capabilities with custom scientific functions.

Program: QUADFORM (Quadratic Formula Solver)
PROGRAM:QUADFORM
ClrHome
Disp "QUADRATIC FORMULA"
Disp "axยฒ + bx + c = 0"
Input "a: ",A
Input "b: ",B
Input "c: ",C

Bยฒ-4ACโ†’D ; Discriminant

If D<0
Then
Disp "No real solutions"
Disp "Complex solutions:"
(-B)/(2A)โ†’R
โˆš(-D)/(2A)โ†’I
Disp R," + ",I,"i"
Disp R," - ",I,"i"
Else
(-B+โˆš(D))/(2A)โ†’X
(-B-โˆš(D))/(2A)โ†’Y
Disp "xโ‚ = ",X
Disp "xโ‚‚ = ",Y
End
Pause

Physics and Engineering Programs

Solve common physics problems with automated calculations.

Program: MOTION (Kinematic Equations)
PROGRAM:MOTION
Menu("KINEMATICS","Find Velocity",V,"Find Distance",D,"Find Time",T,"Quit",Q)

Lbl V
Disp "v = vโ‚€ + at"
Input "Initial velocity: ",V0
Input "Acceleration: ",A
Input "Time: ",T
V0+ATโ†’V
Disp "Final velocity: ",V
Pause
Stop

Lbl D
Disp "d = vโ‚€t + ยฝatยฒ"
Input "Initial velocity: ",V0
Input "Acceleration: ",A
Input "Time: ",T
V0T+0.5ATยฒโ†’D
Disp "Distance: ",D
Pause
Stop

Lbl Q
Stop

Financial Calculator Programs

Create programs for financial calculations and planning.

Program: COMPOUND (Compound Interest Calculator)
PROGRAM:COMPOUND
ClrHome
Disp "COMPOUND INTEREST"
Disp "A = P(1 + r/n)^(nt)"
Input "Principal ($): ",P
Input "Annual rate (%): ",R
R/100โ†’R ; Convert to decimal
Input "Times compounded/year: ",N
Input "Years: ",T

P(1+R/N)^(NT)โ†’A
A-Pโ†’I ; Interest earned

Disp "Final Amount: $",round(A,2)
Disp "Interest Earned: $",round(I,2)
Pause

Statistics and Data Analysis

Process and analyze data sets with custom statistical programs.

Program: STATS (Descriptive Statistics)
PROGRAM:STATS
ClrHome
Disp "DESCRIPTIVE STATISTICS"
Input "How many values? ",N

; Input data
For(I,1,N)
Input "Value "+toString(I)+": ",X
Xโ†’Lโ‚(I)
End

; Calculate statistics
mean(Lโ‚)โ†’M
median(Lโ‚)โ†’MED
stdDev(Lโ‚)โ†’SD
min(Lโ‚)โ†’MIN
max(Lโ‚)โ†’MAX
sum(Lโ‚)โ†’SUM

; Display results
ClrHome
Disp "RESULTS:"
Disp "Mean: ",round(M,3)
Disp "Median: ",MED
Disp "Std Dev: ",round(SD,3)
Disp "Min: ",MIN
Disp "Max: ",MAX
Disp "Sum: ",SUM
Pause

Utility Programs

Create helpful utility programs for everyday calculator use.

Program: CONVERT (Unit Converter)
PROGRAM:CONVERT
Menu("UNIT CONVERTER","Temperature",T,"Length",L,"Weight",W,"Quit",Q)

Lbl T
Menu("TEMPERATURE","F to C",FC,"C to F",CF,"Back",B)

Lbl FC
Input "Fahrenheit: ",F
(F-32)*5/9โ†’C
Disp "Celsius: ",round(C,2)
Pause
Goto T

Lbl CF
Input "Celsius: ",C
C*9/5+32โ†’F
Disp "Fahrenheit: ",round(F,2)
Pause
Goto T

Lbl Q
Stop
๐Ÿ’ป Try These Programs

๐Ÿ› Debugging & Testing

Every programmer encounters bugs. Learning to effectively debug and test your TI-BASIC programs is essential for creating reliable, professional-quality code.

Common Error Types

Understanding common TI-BASIC errors helps you identify and fix problems quickly.

Error Message Cause Solution Prevention
ERR:SYNTAX Invalid command syntax Check command spelling and syntax Use program editor carefully
ERR:MEMORY Insufficient RAM Archive programs, clear variables Optimize memory usage
ERR:DIVIDE BY 0 Division by zero Add input validation Check denominators before division
ERR:INVALID DIM List/matrix size error Check list dimensions Validate list operations
ERR:ARGUMENT Invalid function argument Check function parameter ranges Validate inputs before calculations

Debugging Techniques

Use these systematic approaches to find and fix bugs in your programs.

Debug Output Example
; Add debug output to track program flow
PROGRAM:DEBUG
Input "Enter N: ",N
Disp "DEBUG: N = ",N ; Debug output

If Nโ‰ค0
Then
Disp "DEBUG: Invalid input"
Stop
End

1โ†’F
For(I,1,N)
Disp "DEBUG: I=",I," F=",F
F*Iโ†’F
End

Disp "Result: ",F

Input Validation

Proper input validation prevents many runtime errors.

Robust Input Validation
PROGRAM:VALIDATE
ClrHome
Disp "SAFE DIVISION"

; Get and validate first number
Lbl A
Input "Numerator: ",A
If Aโ‰ int(A) and abs(A)>1E10
Then
Disp "Number too large!"
Pause
Goto A
End

; Get and validate denominator
Lbl B
Input "Denominator: ",B
If B=0
Then
Disp "Cannot divide by zero!"
Pause
Goto B
End

; Perform calculation
A/Bโ†’R
Disp "Result: ",R
Pause

Testing Strategies

Systematic testing ensures your programs work correctly in all situations.

Program Testing Checklist:

1
Normal Cases: Test with typical, expected input values
2
Edge Cases: Test with boundary values (0, 1, maximum values)
3
Invalid Input: Test with negative numbers, decimals where integers expected
4
Extreme Values: Test with very large or very small numbers
5
Memory Stress: Test with low available memory conditions

Error Handling Patterns

Implement robust error handling to create professional programs.

Error Handling Template
PROGRAM:ROBUST
ClrHome

; Main program loop with error handling
Lbl MAIN
Menu("PROGRAM","Calculate",C,"Help",H,"Quit",Q)

Lbl C
; Try calculation
Input "Value: ",X

; Validate input
If X<0
Then
Disp "Error: Negative input"
Disp "Please use positive numbers"
Pause
Goto MAIN
End

; Perform calculation
โˆš(X)โ†’R
Disp "Square root: ",R
Pause
Goto MAIN

Lbl H
ClrHome
Disp "HELP:"
Disp "This program calculates"
Disp "square roots of positive"
Disp "numbers only."
Pause
Goto MAIN

Lbl Q
ClrHome
Disp "Thanks for using this program!"
Stop

Professional Programming Habits

โ€ข Always validate user input before processing
โ€ข Provide clear, helpful error messages
โ€ข Include help or instruction screens
โ€ข Test with a variety of input scenarios
โ€ข Comment your code for future maintenance
โ€ข Use consistent naming conventions

Start Programming Today!

Put your new TI-BASIC skills to work! Use our free online TI-84 calculator to practice programming, test your code, and build amazing programs and games.

๐Ÿ’ป Start Programming Now