TI-89 Programs


Brief Statement

Below are some of the programs and functions that I wrote mostly back in 2001-2005 after buying one of the original TI-89's. With no computer at home, much time was spent learning the system and how to make it better.


TI-89 Titanium Simulator External Link


A program inserted within other graphics programs to allow standard graph navigation for image placement.

Variables k, x and y must not be local
This is for a screen resolution of 159x77

keyarrow()
:Prgm:Goto #("k"&string(exact(k)))

:Lbl k337:If x≠0:x-1→x:Goto e
:Lbl k340:If x≠158:x+1→x:Goto e
:Lbl k338:If y≠0:y-1→y:Goto e
:Lbl k344:If y≠76:y+1→y:Goto e

:Lbl k339:If x≠0 and y≠0 Then:x-1→x:y-1→y:EndIf:Goto e
:Lbl k345:If x≠0 and y≠76 Then:x-1→x:y+1→y:EndIf:Goto e
:Lbl k342:If x≠158 and y≠0 Then:x+1→x:y-1→y:EndIf:Goto e
:Lbl k348:If x≠158 and y≠76 Then:x+1→x:y+1→y:EndIf:Goto e

:Lbl k4433:If x≥10:x-10→x:Goto e
:Lbl k4436:If x≤148:x+10→x:Goto e
:Lbl k4434:If y≥10:y-10→y:Goto e
:Lbl k4440:If y≤66:y+10→y:Goto e

:Lbl k4435:If x≥10 and y≥10 Then:x-10→x:y-10→y:EndIf:Goto e
:Lbl k4441:If x≥10 and y≤66 Then:x-10→x:y+10→y:EndIf:Goto e
:Lbl k4438:If x≤148 and y≥10 Then:x+10→x:y-10→y:EndIf:Goto e
:Lbl k4444:If x≤148 and y≤66 Then:x+10→x:y+10→y:EndIf:Goto e

:Lbl 13:Lbl k4109: Lbl k0:Lbl e:EndPrgm

Removes anything visual from the graph display.

graphoff()
:Prgm
:FnOff
:ClrDraw
:setGraph("Grid","OFF")
:setGraph("Axes","OFF")
:setGraph("Labels","OFF")
:EndPrgm

Moves a point on the graph screen until activated by hitting enter, the point can then be moved freely to draw until hitting enter a second time.

pen()
:Prgm
:Local i,j
:StoPic j
:0→i
:75→x
:34→y
:Loop
:getKey()→k
:If i=0
:RplcPic j
:keyarrow() © (first program above)
:PxlOn y,x
:If k=13 and i=1
:Goto e
:If k=13 and i=0
:1→i
:EndLoop
:Lbl e
:DelVar k,x,y
:EndPrgm

Adds saved picture to graph display in selected position.

addpic()
:Prgm
:Local i
:StoPic i
:0→x
:0→y
:Loop
:getkey()→k
:RplcPic i
:RclPic #p,y,x
:If k=13
:StoPic i
:If k=4109
:Goto e
:keyarrow() © (first program above)
:EndLoop
:Lbl e
:DelVar k,x,y
:EndPrgm

Allows placement of a rectangle in the graph display in a position and size of choice. Plot is a solid 3x3 box, it must be saved to use this program the way it has been set up.

box()
:Prgm
:Local i,ξ,ψ
:StoPic i
:78→x
:37→y
:Loop
:getKey()→k
:RplcPic i
:keyarrow() © (first program above)
:RclPic plot,y,x
:If k=13
:Goto m
:EndLoop
:Lbl m
:x+1→ξ
:y+1→ψ
:Loop
:getKey()→k
:RplcPic i
:keyarrow()
:If k≠13
:RclPic plot,y,x
:PxlLine ψ,ξ,ψ,x+1
:PxlLine ψ,ξ,y+1,ξ
:PxlLine y+1,ξ,y+1,x+1
:PxlLine ψ,x+1,y+1,x+1
:If k=13
:Goto e
:EndLoop
:Lbl e
:DelVar k,x,y
:EndPrgm

Flips the graph display horizontally.

fliphorz()
:Prgm
:Local i
:For i,0,158
:StoPic #("m"&string(exact(i))),0,i,1,77
:EndFor
:graphoff() © (second program above)
:For i,0,158
:RclPic #("m"&string(exact(i))),0,158-i
:EndFor
:For i,0,158
:DelVar #("m"&string(exact(i)))
:EndFor
:EndPrgm

Flips the graph display vertically.

flipvert()
:Prgm
:Local i
:For i,0,76
:StoPic #("m"&string(exact(i))),i,0,159,1
:EndFor
:graphoff() © (second program above)
:For i,0,76
:RclPic #("m"&string(exact(i))),76-i,0
:EndFor
:For i,0,76
:DelVar #("m"&string(exact(i)))
:EndFor
:EndPrgm

Creates a noise effect on the graph display which eventually appears as static. This is an endless loop which must be broken manually.

decay(t)
:Prgm
:Local i
:If t=-1 Then
:Loop
:PxlChg rand(77)-1,rand(159)-1
:EndLoop
:EndIf
:If t=0 Then
:Loop
:PxlOff rand(77)-1,rand(159)-1
:EndLoop
:EndIf
:If t=1 Then
:Loop
:PxlOn rand(77)-1,rand(159)-1
:EndLoop
:EndIf
:EndPrgm

Fades graph screen by inverting pixels on every other line vertically, then horizontally.

scorbord(n,r)
:Prgm
:Local i
:For i,0,76,2
:PxlLine i,0,i,158,-1
:EndFor
:For i,0,158,2
:PxlLine 0,i,76,i,-1
:EndFor
:EndPrgm


Searches for and replaces a character in a string value.

chrrplc(s,c,r)
:Func
:Local d,i,t
:""→t
:If getType(s)≠"STR"
:string(s)→s
:For i,1,dim(s)
:mid(s,i,1)→d
:t&when(d=c,r,d)→t
:EndFor
:EndFunc

Displays all letters in a string as uppercase.

caseup(s)
:Func
:Local c,i,t
:""→t
:If getType(s)≠"STR"
:string(s)→s
:For i,1,dim(s)
:ord(mid(s,i,1))→c
:t&char(when(c≥97 and-c≤122,c-32,c))→t
:EndFor
:EndFunc

Displays all letters in string a as lowercase.

casedown(s)
:Func
:Local c,i,t
:""→t
:If getType(s)≠"STR"
:string(s)→s
:For i,1,dim(s)
:ord(mid(s,i,1))→c
:t&char(when(c≥65 and-c≤90,c+32,c))→t
:EndFor
:EndFunc

Displays all 1st letters in words in a string as capitalized.

casetitl(s)
:Func
:Local c,d,i,t
:If getType(s)≠"STR"
:string(s)→s
:0→d
:""→t
:For i,1,dim(s)
:ord(mid(s,i,1))→c
:t&char(when(c≥97 and c≤122 and (i=1 or d=32),c-32,
…when(c≥65 and c≤90 and i≠1 and d≠32,c+32,c)))→t
:c→d
:EndFor
:t
:EndFunc

Displays anything in centered alignment in PrgmIO

dspcntr(x)
:Prgm
:Local i,f
:If getType(x)≠"STR"
:string(x)→x
:int((26-dim(x))/2)→f
:For i,1,f
:" "&x→x
:EndFor
:Disp x
:EndPrgm

Displays anything in two columns in PrgmIO

dsplftmd(l,m)
:Prgm
:Local b,i
:If getType(l)≠"STR"
:string(l)→l
:If dim(l)>13 or dim(m)>13-Then
:Dialog
:Title "ERROR"
:Text "Dimension"
:EndDlog
:Goto e
:EndIf
:If getType(m)≠"STR"
:string(m)→m
:13-dim(l)→b
:For i,1,b
:l&" "→l
:EndFor
:Disp l&m
:Lbl e
:EndPrgm

Displays anything to the left and a second statement or numbers to the right with a choice of guide between the two in PrgmIO

dspside(L,r,t)
:Prgm
:Local f,m,s
:""→m
:If getType(L)≠"STR" :string(L)→L
:If getType(r)≠"STR" :string(r)→r
:string(t)→t
:26-dim(L)-dim(r)→s
:If t="b" Then
:For f,1,s
:m&" "→m
:EndFor
:EndIf
:If t="d" Then
:For f,1,s
:m&"."→m
:EndFor
:EndIf
:If t="m" Then
:For f,1,s
:m&"-"→m
:EndFor
:EndIf
:If t="u" Then
:For f,1,s
:m&"_"→m
:EndFor
:EndIf
:Disp L&m&r
:EndPrgm

Enter a phrase and hand it off to a friend. Bug free of pressing all the wrong keys and not case sensitive. Only replaces letters with underscores.

hangman(s)
:Prgm
:Local e,f,g,h,i,t,u
:""→t
:For i,1,dim(s)
:ord(mid(s,i,1))→g
:t&char(when(g≥65 and g≤90 or g≥97 and g≤122,95,g))→t
:EndFor
:0→e
:""→f
:Loop
:Lbl i
:ClrIO
:If e≥1:Disp " 0 "&f
:If e=2:Disp " |"
:If e=3:Disp "-+"
:If e≥4:Disp "-+-"
:If e=5:Disp "/"
:If e=6:Disp"/ \"
:If e=0:Disp ""
:If e≤1:Disp ""
:If e≤4:Disp ""
:If s=t or e=6
:Goto f
:Disp t
:InputStr "Your Letter?",g
:ord(g)→g
:when(g≥65 and g≤90,g+32,g)→g
:If g≤96 or g≥123
:Goto i
:char(g-32)→h
:char(g)→g
:If inString(s,g)=0 and-inString(s,h)=0 and inString(f,h)=0 Then
:""→u
:For i,1,dim(s)
:If mid(s,i,1)=g Then
:u&g→u
:ElseIf mid(s,i,1)=h Then
:u&h→u
:Else
:u&mid(t,i,1)→u
:EndIf
:EndFor
:u→t
:EndIf
:EndLoop
:Lbl f
:Disp s
:If e=6
:Disp "You Died!"
:If s=t
:Disp "You Live!"
:EndPrgm


Generates a list of all prime numbers between two inputs.

prime(i,f)
:Func
:Local x,m
:{}→m
:For x,i,f
:If isPrime(x)=true
:augment(m,{x})→m
:EndFor
:EndFunc

Returns a randomized integer list with each element appearing only once.

rndord(n)
:Func
:Local i,j,m,r
:{}→m
:For i,1,n
:Lbl i
:{rand(n)}→r
:For j,1,dim(m)
:If r=mid(m,j,1)
:Goto i
:EndFor
:augment(m,r)→m
:EndFor
:EndFunc

Converts a list format to a string format

:Func
:Local s,i,x
:""→s
:For i,1,dim(m)
:string(mid(m,i,1))→x
:s&x→s
:If i≠dim(m)
:s&" "→s
:EndFor
:EndFunc

Determines if list contains a certain value

:Func :Local i :For i,1,dim(m) :If string({n})=string(mid(m,i,1)) :Return i :EndFor :0 :EndFunc


Converts input meters to exact feet, inches, and nearest 32nd of an inch.

mtoft(m)
:exact({int(1250*m/381),
…int((1250*m/381-int(1250*m/381))*12),
…round(((1250*m/381-int(1250*m/381))*12-int((1250*m/381-
…int(1250*m/381-1250*m/381))*12))*32,0)/32})

Converts decimal to any number system from 1 to 36 and vise versa depending on input.

base(b,d)
:Func
:Local s,e,t
:If getType(d)="NUM" Then
:int(Ln(b*d)/(Ln(b)))→e
:""→s
:While e≠0
:int(b^(1-e)*d)→t
:d-t*b^e/b→d
:e-1→e
:If t>9 Then
:s&char(55+t)→s
:Else
:s&string(exact(t))→s
:EndIf
:EndWhile
:Else
:0→s
:For e,1,dim(d)
:mid(d,dim(d)-e+1,1)→t
:If ord(t)>64
:string(ord(t)-55)→t
:s+b^(e-1)*expr(t)→s
:EndFor
:EndIf
:s
:EndFunc

Allows time for a key to be pressed and returns its numerical value. This was helpful in creating the graphics navigation program keyarrow().

key()
:Func
:Local k
:For k,0,1
:getkey()→k
:EndFor
:EndFunc

TI-89/92 has no concept of time measurement. This program should be calibrated where the 96 is before use.

:Prgm
:Local s,t
:0→s
:0→t
:Disp "Ready..."
:Pause
:Loop
:t+1→t
:If mod(t,96)=0 Then
:s+1→s
:ClrIO
:Disp "Seconds: "&string(s)
:EndIf
:EndLoop
:EndPrgm

Basically a time dilation or stalling program.

:Func
:Local i
:0→i
:While i≠f
:i+1→i
:EndWhile
:EndFunc

Clears dimensional units returning a scalar value.

clrunits(u)
:approx(expr(left(string(u),
…inString(string(u),"*")-1)))

A reflex game of how long you can continue to press displayed numbers. "t" is the elapsed time to react, meaning higher numbers yield slower speeds.

reflex(t)
:Prgm
:Local d,t,z
:0→z
:Loop
:rand(9)→d
:ClrIO
:Disp d
:x→t
:Loop
:If getkey()-48=d
:Goto m
:t-1→t
:If t=0
:Goto n
:EndLoop
:Lbl m
:z+1→z
:If z=1000
:Goto n
:EndLoop
:Lbl n
:Disp z
:EndPrgm

Randomly assigns a positive or negative value by multiplication of 1 or -1.

rndsign(x)
:((rand(2)-1)*2-1*x

Yields complex and real solutions for quadratic equations in list form.

quadratc(a,b,c)
:exp►list(exact(cSolve(a*x^2+b*x+c=0,x)),x)

A memory game kind of like Simon Says, except you have to guess the next in the sequence or start all over. Variable n represents how many numbers will be used in each digit, and variable v is the overall digits.

passcode(n,v)
:Prgm
:Local i,k,s,t
:""→s
:For i,1,v
:s&string(rand(n))→s
:EndFor
:s→i
:""→t
:While s≠t
:string(key()-48)→k
:If inString(i,k)=1 Then
:right(i,dim(i)-1)→i
:t&k→t
:Else:s→i
:""→t
:EndIf
:ClrIO
:Disp t
:EndWhile
:EndPrgm

Scoreboard for top 6 scores. Enter name and score. Enter "" for the name and 0 as the score to set up or reset this program.

scorbord(n,r)
:Prgm
:Local t
:If n="" and r=0 Then
:"NONE"→n1
:"NONE"→n2
:"NONE"→n3
:"NONE"→n4
:"NONE"→n5
:"NONE"→n6
:0→s1
:0→s2
:0→s3
:0→s4
:0→s5
:0→s6
:Stop
:EndIf
:If r(less thans6
:Goto d
:If r≥s6
:6→t
:If r≥s5
:5→t
:If r≥s4
:4→t
:If r≥s3
:3→t
:If r≥s2
:2→t
:If r≥s1
:1→t
:If t=6 Then r→s6
:ElseIf t=5 Then
:s5→s6
:r→s5
:n5→n6
:ElseIf t=4 Then
:s5→s6
:s4→s5
:r→s4
:n5→n6
:n4→n5
:ElseIf t=3 Then
:s5→s6
:s4→s5
:s3→s4
:r→s3
:n5→n6
:n4→n5
:n3→n4
:ElseIf t=2 Then
:s5→s6
:s4→s5
:s3→s4
:s2→s3
:r→s2
:n5→n6
:n4→n5
:n3→n4
:n2→n3
:ElseIf t=1 Then
:s5→s6
:s4→s5
:s3→s4
:s2→s3
:s1→s2
:r→s1
:n5→n6
:n4→n5
:n3→n4
:n2→n3
:n1→n2
:EndIf
:n→#("n"&string(t))
:Lbl d
:ClrIO
:dsplftmd(n1,string(s1)) © (text two columns program above)
:dsplftmd(n2,string(s2))
:dsplftmd(n3,string(s3))
:dsplftmd(n4,string(s4))
:dsplftmd(n5,string(s5))
:dsplftmd(n6,string(s6))
:EndPrgm


Updated November 2023
Bill Liam East
Return to Athenaeum