<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wikiti.brandonw.net/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wikiti.brandonw.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bfr</id>
		<title>WikiTI - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wikiti.brandonw.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bfr"/>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=Special:Contributions/Bfr"/>
		<updated>2026-04-05T19:24:54Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks</id>
		<title>83Plus:Basic:Tricks</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks"/>
				<updated>2009-01-02T19:34:19Z</updated>
		
		<summary type="html">&lt;p&gt;Bfr: Forgot a &amp;quot;Then&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:83Plus:Basic|Tricks]]&lt;br /&gt;
[[Category:83Plus:Basic:Routines|Tricks]]&lt;br /&gt;
&lt;br /&gt;
There is a whole list of tricks that one can implement, once one is comfortable programming in TI-Basic which allow for a whole onslaught of capabilities, such as using less memory or making the program run faster.  There used to be a site called Kevtiva Inc. which had the largest list of TI-BASIC hacks I (Saibot84) have ever seen, including how to force a RAM reset (without the use of asm programs) but I've forgotten most of the meanest hacks. Here are some of the many tricks: (Please use common sense in deciding whether a &amp;quot;-&amp;quot; is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Memory==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
===Memory Management===&amp;lt;!-- â†’â‰ â‰¤â‰¥  --&amp;gt;&lt;br /&gt;
;Number values:In order to be able to save memory on the calculator, it helps to have a bit of an understanding as to how the calc manages the memory, especially in regards to numbers. Because TIOS is designed for school, and so is oriented for precision, it saves all real number values as 14-digits and an exponent of 10. In other words, it saves the number &amp;amp;pi; as 3.1415926535898 &amp;amp;times; 10&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;, but in memory, it is something more similar (not exact) to &amp;lt;code&amp;gt;0 31415926535898&amp;lt;/code&amp;gt; where the 0 tells TIOS what the exponent of 10 is that need to be applied to the 31415926535898.  However, this also applies to smaller values, such that a 13 is saved as &amp;lt;code&amp;gt;1 13000000000000&amp;lt;/code&amp;gt;.  For small, rational, terminating values, it can be seen that a good deal of memory is being wasted.  I've created the following formula which, when saved to Y0 (or any other Y function, works with numbers in the same way that the sub( function works with strings:&lt;br /&gt;
 int(10^(F)fPart(X/10^(int(2-A+log(X&lt;br /&gt;
:translated as a sub( statement, it would be the equivalent of sub(X,A,F) regardless of the position of the decimal point in X.  If you don't understand what the formula is doing, it's dividing X by 10&amp;lt;sup&amp;gt;value&amp;lt;/sup&amp;gt; so that the digit we're looking for (identified in A) is &amp;quot;moved&amp;quot; to be the first digit to the right of the decimal point, then ignores anything to the left or the decimal piont, then multiplies the value left over by 10&amp;lt;sup&amp;gt;F&amp;lt;/sup&amp;gt; and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).&lt;br /&gt;
;use more than 27 vars:If you need to use more than the 27 vars TIOS gives you with A-Z, other than using lists, matrices, strings, or Ans, you can go look in the [VARS] menu under Window.  Of these, being that the calculator is usually in function mode, you can use any of the window vars under T/theta (which are for parametric mode) and/or under U/V/W (which are for polar).  It is recommended that you prefer those under U/V/W because this mode is usually never used, whereas parametric has been used on more than one occasion by programs, such as for drawing X in terms of Y. You can also go into the Finance menu under [APPS] and go to Vars, but IIRC, some are read-only vars, so you will need to experiment to see if a var is accessible or not, but it is certain, that at least the '''N''' can be used problemlessly in your programs. You can also use the ''n'', which is found by going to the catalog and pressing &amp;quot;N&amp;quot; as a variable, as well as the sequential functions u,v, and w.&lt;br /&gt;
;Debugging:One of the easiest ways to help you debug your program is through the use of the Pause command.  You can use the Pause command to display the value of a var, or just to track the progress of your program.  During any of the Pause commands, you can press [ON] to break the program and choose Goto so that the calc will automatically bring you to the point in your program where it was Pause-ing when you interrupted it with the [ON] key. Some common bugs include using the Y var or the X var while drawing to the screen (TIOS tends to change the value of Y and/or X when doing certain things on the graph screen, so avoid using Y or X when working on the graph screen.&lt;br /&gt;
&lt;br /&gt;
===Memory Saving===&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Never write out closing ''')''' parentheses at the end of a line:You save '''1''' byte. The reason for this is that TIOS closes all still-open parentheses when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never write out closing '''&amp;quot;''' quotes at the end of a line: You save '''1''' byte. The reason for this is that TIOS closes any still-open quotes when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never use a Pause right after a Disp, unless the Pause has text:This is because both Disp and Pause can display text to the homescreen. Disp writes the text to the screen and then continues forward, but Pause waits for the [ENTER] key to be pressed.  When Pause is used with text, such as in&lt;br /&gt;
 :Pause &amp;quot;TEXT&amp;quot;&lt;br /&gt;
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].&lt;br /&gt;
;CAPITALIZE:For the most part, yes, it is nice to see that not EVERY character is in UPPERCASE on the calculator, but if you're looking to save space, don't use lower case letters.  Each lowercase letter takes up twice as much space as the uppercase ones.&lt;br /&gt;
;Read-Only Lists and Matrices:If you have a list or matrix that will be read-only, it behooves you to save it to a string or Y function (Y1-Y0). Instead of doing&lt;br /&gt;
 :{1,2,3,4,5,6,7,8,9â†’L1&lt;br /&gt;
 :L1(5 (to retrieve the 5th element of the list)&lt;br /&gt;
:try doing&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Str1&lt;br /&gt;
 :expr(Str1&lt;br /&gt;
 :Ans(5&lt;br /&gt;
:or&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Y1&lt;br /&gt;
 :Y1:Ans(5&lt;br /&gt;
:The benefit is that you are now no longer wasting the space, as explained in the [[83Plus:Basic:Tricks#Memory_Management|Number Values]].  When choosing between storing your list to a string and storing it to a function, keep in mind that string values are somewhat editable, while functions are completely read-only.  If you needed to edit something in the function, you'd have to convert it to a string first before editing, and then overwrite the original function.  It is therefore recommended that you save your lists to strings.&lt;br /&gt;
;No NewLine Required:The following commands do not require that you neither begin a new line, nor use a colon before the next command: Archive, Unarchive, DelVar. Example:&lt;br /&gt;
 Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1&lt;br /&gt;
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.&lt;br /&gt;
&lt;br /&gt;
==Speed Boosters==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use For( loops:In light of research I once read online, as well as through personal research and experimentation, it is fairly simple to see that For( loops are the fastest of the looping options.  To prove this, try running the following program on your calc, and see which one is the fastest:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Program:LOOPTEST&lt;br /&gt;
:Disp &amp;quot;FOR&lt;br /&gt;
:For(X,1,10000&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;FOR IS DONE&lt;br /&gt;
:1â†’X&lt;br /&gt;
:Disp &amp;quot;WHILE&lt;br /&gt;
:While X&amp;lt;10001&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;WHILE IS DONE&lt;br /&gt;
:0â†’X&lt;br /&gt;
:Disp &amp;quot;GOTO&lt;br /&gt;
:Lbl XX&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:If X&amp;lt;10001&lt;br /&gt;
:Goto XX&lt;br /&gt;
Pause &amp;quot;GOTO DONE&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:You will notice, especially if using a stopwatch, that the For( loop, IIRC, should even run a FEW SECONDS faster than the While loop, and/or the Goto loop. Therefore, see if you can't change your loops to use For( instead.  In the case of the While, change&lt;br /&gt;
 :While X&amp;lt;Y&lt;br /&gt;
:to&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
 :For(X,X,Y&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
:You most likely will be losing a few more bytes in memory, but it's very much worth it for the speed... and you've already saved much speed by doing the tricks above ;-)&lt;br /&gt;
;Get Returns on your IfThens, Fors, etc.:Each time you do an If-Then statement or a For( statement (among others), when the calc is &amp;quot;waiting&amp;quot; for an End statement, these conditions are taking up memory, which, after a while, slow down your BASIC programs. However, the benefit is that this is only the case, as long as your program is running... as soon as the calculator returns to the homescreen, these used memory is cleared again and you are ready to go at it again. The benefit of this is that when the calculator encounters a Return statement in a BASIC program, it &amp;quot;cancels&amp;quot; any conditions for its waiting for an End.&lt;br /&gt;
;Avoid storing to vars in a loop:Brandon Green writes in his BASIC Guru Online that his experiments have led to the conclusion that storing variables is a prime cause of slowdowns in TI-BASIC programs.  Therefore, try to restructure your code so as to avoid using the â†’ as much as possible.&lt;br /&gt;
&lt;br /&gt;
==Graphical Touches==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc.  Normally, you do something like this:&lt;br /&gt;
 :Text(15,10,&amp;quot;MY TEXT&lt;br /&gt;
:following this, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row, in the 10th column, in the small font... however, try adding a &amp;quot;-1&amp;quot; (without the quotation marks) as the first argument...&lt;br /&gt;
 :Text(-1,15,10,&amp;quot;MY TEXT&lt;br /&gt;
:This time, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row in the 10th column, in the LARGE font&lt;br /&gt;
;Write blank spaces to the graph screen when needing to erase stuff:as long as what you are trying to erase is at least 6 pixels high, it is srongly recommeded that you use the Text( command to write blank spaces to the screen instead of creating a Line(A,B,C,D,0 loop.  This is because to write a line, white or black, the calculator needs to do a lot of math to convert the X and Y coordinates into pixel coordinates, while writing text to the screen is almost at the same speed as it would take to draw a sprite to the screen in any asm program (since for the calc, text chars are just sprites) and so writing (blank) text to clear the screen is much faster.&lt;br /&gt;
;Try drawing graphics to the screen using text instead of lines: With access to the lowercase letters, as well as the Catalog menu, it is possible to draw graphics to the screen using text. For example, to draw a heart for a Zelda game would be much faster if you do something like the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:&amp;quot;vQ6Qv  &amp;quot;&lt;br /&gt;
:For(X,1,7&lt;br /&gt;
:Text(10,9+X,sub(Ans,X,1&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Another typical example is that of &amp;quot;drawing&amp;quot; a status bar to the screen using something such as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(P is the percent to be shaded in)&lt;br /&gt;
(L is the length of the bar in pixels)&lt;br /&gt;
(H is the horizontal position)&lt;br /&gt;
(V is the vertical position, using the top-left corner of the screen as point 0,0)&lt;br /&gt;
:Text(V,H,&amp;quot;(&lt;br /&gt;
:For(X,0,PL/100&lt;br /&gt;
:Text(V,H+X+1,&amp;quot;8&lt;br /&gt;
:End&lt;br /&gt;
:For(X,1,(100-P)L/100&lt;br /&gt;
:Text(V,H+PL/100+X,&amp;quot;)&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Using this technique, small graphics such as these can be drawn much faster than if we tried to draw them using lines and/or pixels and/or points.&lt;br /&gt;
;Simplify your Life:Save a GDB at the beginning of your program. &amp;quot;Graph Databases (GDBs) are useful storage centers of graph informaiton. This means that it saves not only the Zoom settings, but also Axes on/off, coord on/off, and the Y= equations. Using these can reduce the size of your program.&amp;quot; (quoted from http://web.archive.org/web/20021020121625/www.kevtiva.com/calc/gdb.htm) Turn off the axes with AxesOff, turn off functions with FuncOff, and set the Window to Xmin=0, Xmax=94, Xscl=8, Ymin=-62, Ymax=0, Yscl=8.  When your program is exiting, have it reset the previous GDB so that you don't mess up the gamer's graph settings.  &amp;lt;!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... --&amp;gt;While debugging your graphics, moving your cursor on the graph screen will now tell you both the pixel coordinates, as well as the point coordinates since you have synchronized them. http://www.meebo.com//skin/default/img/emoticons/big_smile.gif&lt;br /&gt;
;Convert Pts into Pxls:If you have not used the previous tip, it is important to know that the coordinates you give to any Pt command will be different from those you give to any Pxl command (if you want to use, say Pt-On/Pt-Off, with Pxl-Test).  The reason for this is that Pt commands take your window settings into account, while Pxl commands don't.Here is one set of formulas you can use to convert your Pt coordinates into Pxl coordinates:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;round(94X/(Xmax-Xmin)+47,0)-&amp;gt;A&lt;br /&gt;
round(-62Y/(Ymax-Ymin)+31,0)-&amp;gt;B&lt;br /&gt;
 -RobbieMc&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:With this formula, the Pxl command is Pxl-XX(B,A), where XX is On, Off, Test, or Change. Another formula can be found in the Ans your answers section of Cool Hacks. http://meebo.com/skin/default/img/emoticons/smile.gif&lt;br /&gt;
;Get rid of the &amp;quot;Done&amp;quot;:Use the following right before your program exits to avoid having the calc display the &amp;quot;Done&amp;quot; text on the homescreen&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:ClrHome&lt;br /&gt;
:&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:When used immediately before a &amp;quot;Stop&amp;quot; token, &amp;quot;Done&amp;quot; is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use &amp;lt;code&amp;gt;Output(1,1,&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;Get rid of the RunIndic:On the homescreen, do &amp;lt;code&amp;gt;Output(1,16,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. On the graph screen, do &amp;lt;code&amp;gt;Text(-1,0,90,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. (_ in this context refers to the space character.)&lt;br /&gt;
&lt;br /&gt;
==Cool Hacks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have &amp;quot; and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a &amp;quot; and the store arrow at the homescreen and press enter. An error message will appear; choose to Quit.  Press [Y=] and go to Y1. Press [2nd] [ENTER] to paste the previous homescreen entry into Y1. Press [2nd] [MODE] to {ESC}. At the homescreen, type Equ&amp;gt;Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the &amp;quot; quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif&lt;br /&gt;
;If condition&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;End:This will need a bigger explanation, but in short, you can have a conditional End statement that helps your loops run faster by only executing the End statement if needed. The reason this works is because you didn't use a Then statement: an If followed by a single non-Then statement is interpreted as an If with no Else clause and the single statement as the equivalent of the Then clause, even if the statement is End.  You can therefore also insert comments into your code (which is not recommended for BASIC unless you're still debugging it) by doing If 0:Whatever. For instance:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(untested...)(lines are numbered)&lt;br /&gt;
01:For(X,0,1&lt;br /&gt;
02:getKeyâ†’K&lt;br /&gt;
03:Kâ†’X&lt;br /&gt;
04:If not(Ans&lt;br /&gt;
05:End&lt;br /&gt;
06:0â†’X&lt;br /&gt;
07:&amp;quot;-&lt;br /&gt;
08:If K=25&lt;br /&gt;
09:&amp;quot;LEFT&lt;br /&gt;
10:If K=26&lt;br /&gt;
11:&amp;quot;UP&lt;br /&gt;
12:If K=27&lt;br /&gt;
13:&amp;quot;RIGHT&lt;br /&gt;
14:If K=34&lt;br /&gt;
15:&amp;quot;DOWN&lt;br /&gt;
16:If K=45&lt;br /&gt;
17:&amp;quot;CLEAR&lt;br /&gt;
18:If Ans=&amp;quot;-&lt;br /&gt;
19:End&lt;br /&gt;
20:Disp Ans&lt;br /&gt;
21:If K=45&lt;br /&gt;
22:1â†’X&lt;br /&gt;
23:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Explanation: Lines 1-2 are normal. Line 3 resets X if there was no key, which will loop back to the For( statement, or allow the routine to continue if there WAS a key. The answer from the getKey is in Ans, so if no key was pressed, Line 5 will be executed, which loops back to Line 1 without wasting any more time. http://www.meebo.com//skin/default/img/emoticons/smile.gif ... If a key was pressed, X is reset, which will cause the routine to loop back to the For( statement the next time it encounters an End statement. If the condition in Line 4 is not met, it automatically skips to Line 6. The string &amp;quot;-&amp;quot; is stored in Ans. We then go into a series of checks looking for any of the arrow keys, and changing Ans to reflect that. Line 8 is executed, and if the condition is not met, it skips to Line 10; if that condition is not met, it skips to Line 12; if that condition is not met, it skips to Line 14; if that condition is not met, it skips to Line 16; if that condition is not met, it skips to Line 18.  Then, it checks the Ans var.  If the Ans var is still unchanged, then none of the keys we are looking for have been found, so we End, which we've already said will loop back to the For( statement, essentially beginning the getKey loop once more. If Ans is different, then one of our keys was found, so we Disp the value in Ans (which is a String). We then check to see if it was the [CLEAR] key., and if it was, we set X so that the next End statement that is encountered will essentially close the loop and the routine will continue beyond this part of the code. We then End, which checks the value of X.  If X is 0, it loops back to the For( statement, recommencing the whole loop, but if X is 1, it &amp;quot;closes&amp;quot; the loop, forgets about it completely, and moves on with its life. Thus can you build in looping conditions into your programs without having to use Lbl or Goto statements. http://www.meebo.com//skin/default/img/emoticons/cool.gif&lt;br /&gt;
;Ans your answers:the Ans var is, IMHO, the most useful yet most unsafe var on the whole calculator because it can be so many different variable types (real, complex, list, matrix, string)... One way to reduce the number of varables you're using in your program is to carefully structure your program so that it stores as much information into the Ans var as possible. One way to do this is to setup Ans to be a list, say {3,1,4,2,5}. Doing Ans(4) is not going to multiply each value in the list by four, but rather going to give you the 4th value in the list:2. This happens because the OS will treat the Ans variable exactly the same as if it were L1 or any other list variable. I've already demonstrated that the Ans var can be used to keep track of whether one of the keys we were looking for was found or not, but there are other things you can do with the Ans var (as long as you're careful not to change the value in Ans unintentionally).  For instance, doing {Ans(2),Ans(4),Ans(1),Ans(3),Ans(5) will change Ans to be the list {1,2,3,4,5}... Note that the Ans var is changed AFTER the whole command has been executed.  There will probably be more examples of using Ans in a program at a later date.  Therefore, you can do something like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(50% tested)&lt;br /&gt;
(to convert from Pt coordinates to Pxl coordinates)&lt;br /&gt;
A is the X-coord&lt;br /&gt;
B is the Y-coord&lt;br /&gt;
&lt;br /&gt;
{63/(Ymax-Ymin),95/(Xmax-Xmin&lt;br /&gt;
&lt;br /&gt;
;{pixels per Y, pixels per X&lt;br /&gt;
&lt;br /&gt;
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1&lt;br /&gt;
&lt;br /&gt;
;{Y,X,int ppY,int ppX&lt;br /&gt;
;Ans(1)Ans(3) is now the Pxl-Y&lt;br /&gt;
;Ans(2)Ans(4) is now the Pxl-X&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from  James Matthew's Asmguru.hlp&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If 0&amp;lt;cos(9)&lt;br /&gt;
:Then&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Similarly, you can also use sin(&amp;amp;pi;), which only returns 0 if in radian mode, to do something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If sin(&amp;amp;pi;&lt;br /&gt;
:Then&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Ans as a list:It is possible to use the Ans variable as a list in replacement to using any of the real or complex variables.  The trick is knowing how to use the augment( and the seq( commands so that you won't be destroying Ans and inadvertedly converting it into something other than a list. '''NOTE: '''extensive usage of this, as in the case of replacing all variables from a program can/will slow down the program, as well as use up more memory than if you just used variables. A shellsort program using variables A,B,C,D,L,Z, and &amp;amp;theta; used up 143 bytes, while its variable-free counterpart used up 645 bytes and was significantly slower. However, this doesn't mean the technique is completely useless.&lt;br /&gt;
:*augment({1,2},{3,4}  will return {1,2,3,4}... it can only augment 2 lists at a time, so repeated usage will be necessary to maintain the Ans variable as a list&lt;br /&gt;
:*seq(formula,tempvar,start,end will return a list of what the formula evaluats to when the tempvar is (start-to-finish).  I think an example is necessary: seq(X^2,X,1,5 will For(X,1,5) evaluate X^2 and store that value to a list, thus producing {1,4,9,16,25}, without changing the value of X ;) &lt;br /&gt;
:We can therefore use seq(Ans(X),X,start,end as a list-equivalent to sub(String,start,len... using a sequence of augment( and seq( commands, we can therefore store values into specific Ans-list elements.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That returns the list {0,0,0,2,3,0,0,0}.&lt;br /&gt;
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;abs -1+1 would return 2 on a TI-82&lt;br /&gt;
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:and that one can therefore use the following to display whether the calc is an 82 or 83&lt;br /&gt;
 Text(0,0,&amp;quot;YOU HAVE A TI-&amp;quot;,83-.5(abs -1+1&lt;br /&gt;
==Miscellaneous==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have conditions built into your formulas:This will probably need a better explanation, but I have found it useful to build certain conditions into my formulas, instead of having to write all those If statements... for instance, for piece-wise graphing, you can do Y=(X^2)(X&amp;gt;0)+(2X)(X&amp;lt;1), which is the same as If X&amp;gt;0:Y=X^2:If X&amp;lt;1:Y=2X ...right now, I can't really say what you'll be saving by doing this (memory/speed/etc) because I don't remember, but I can assure you this come quite in handy because you can then have one formula solve a variety of different problems, without the hassle of dealing with a lot of If-Then statements.  For example, if you were to save that formula as Y1, then you'd only need to do Y1(number) to have it do the whole sequence of conditionals. I consider this one of the more complicated tricks to implement (because one can easily get confused as to how to build it as well as to what conditions one is looking for) but I have found it to be extremely useful.  For example, let us say you write a text editor program in BASIC that allows the user to edit Str1, as displayed on the homescreen using Output(1,1,Str1.  However, you run into a problem when Str1 is longer than the 96 chars that fit on the homescreen, so you can, using the sub( and length( functions, you could have one line of code something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:length(Str1&lt;br /&gt;
:Output(1,1,sub(Str1,1(Ans&amp;lt;96)+16frac(Ans/16)(Ans&amp;gt;95)+(16int(Ans/16)-80)(Ans&amp;gt;95),Ans+80-16int(Ans/16&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:should make the Output scroll up one line whenever the screen has been filled (untested, please verify).  What this line is saying is: give me from Str1, starting at the first byte if Str1 is smaller than 96 charachters, otherwise, calculate the beginning to be one &amp;quot;row&amp;quot; less than the total, and give me all the rest of the chars till the end.  If you could not follow that, don't worry, as that is what I meant when I said this is one of the harder tricks. If you did follow with what I was trying to do, Kudos to you!  Keep in mind that the conditions within the () can hold any of the condition-elements of If statements, i.e. and, not, or, =, â‰ , &amp;gt;, &amp;lt;, â‰¥, â‰¤.  BTW, this BASIC trick  does '''NOT''' work on the 89. I tried, but there I could not get the 89 to convert a binary operation into a numerical value, the way the z80s do. (I could be wrong about this working on all z80s... I've tested it on an 82 and an 83+)&lt;br /&gt;
;See program in MirageOS:If you want to see your program in a shell, like MirageOS, you must type the following code in the first line of the program:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;::&amp;quot;Description&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That will show the program name with the description you typed.&lt;br /&gt;
;User-friendly Error Messages:(brought to you by Kevtiva Inc.) Write an error message to the screen before calling any subroutine programs, and have the subroutines program erase the error message. This way, if the subroutine program is missing, the user will be informed about the specifics of the problem. Example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;PROGRAM:MYSHELL&lt;br /&gt;
:program code&lt;br /&gt;
:Output(1,1,&amp;quot;ERR:prgmMYSUB MISSING&lt;br /&gt;
:prgmMYSUB&lt;br /&gt;
:more program code&lt;br /&gt;
&lt;br /&gt;
PROGRAM:MYSUB&lt;br /&gt;
:Output(1,1,&amp;quot;                     &amp;quot;&lt;br /&gt;
:The rest of program MYSUB.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]&lt;br /&gt;
&lt;br /&gt;
'''TI-Basic Developer'''&lt;br /&gt;
[http://tibasicdev.wikidot.com]&lt;br /&gt;
&lt;br /&gt;
==Special Thanks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
Special thanks to:&lt;br /&gt;
&lt;br /&gt;
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* Â© 2000 Kevtiva Interactive]&lt;br /&gt;
&lt;br /&gt;
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright Â© 2000-2006 BASIC Guru Online. All Rights Reserved.]&lt;br /&gt;
&lt;br /&gt;
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ Â© 2000-2006 Detached Solutions]&lt;/div&gt;</summary>
		<author><name>Bfr</name></author>	</entry>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks</id>
		<title>83Plus:Basic:Tricks</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks"/>
				<updated>2009-01-02T19:33:13Z</updated>
		
		<summary type="html">&lt;p&gt;Bfr: Formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:83Plus:Basic|Tricks]]&lt;br /&gt;
[[Category:83Plus:Basic:Routines|Tricks]]&lt;br /&gt;
&lt;br /&gt;
There is a whole list of tricks that one can implement, once one is comfortable programming in TI-Basic which allow for a whole onslaught of capabilities, such as using less memory or making the program run faster.  There used to be a site called Kevtiva Inc. which had the largest list of TI-BASIC hacks I (Saibot84) have ever seen, including how to force a RAM reset (without the use of asm programs) but I've forgotten most of the meanest hacks. Here are some of the many tricks: (Please use common sense in deciding whether a &amp;quot;-&amp;quot; is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Memory==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
===Memory Management===&amp;lt;!-- â†’â‰ â‰¤â‰¥  --&amp;gt;&lt;br /&gt;
;Number values:In order to be able to save memory on the calculator, it helps to have a bit of an understanding as to how the calc manages the memory, especially in regards to numbers. Because TIOS is designed for school, and so is oriented for precision, it saves all real number values as 14-digits and an exponent of 10. In other words, it saves the number &amp;amp;pi; as 3.1415926535898 &amp;amp;times; 10&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;, but in memory, it is something more similar (not exact) to &amp;lt;code&amp;gt;0 31415926535898&amp;lt;/code&amp;gt; where the 0 tells TIOS what the exponent of 10 is that need to be applied to the 31415926535898.  However, this also applies to smaller values, such that a 13 is saved as &amp;lt;code&amp;gt;1 13000000000000&amp;lt;/code&amp;gt;.  For small, rational, terminating values, it can be seen that a good deal of memory is being wasted.  I've created the following formula which, when saved to Y0 (or any other Y function, works with numbers in the same way that the sub( function works with strings:&lt;br /&gt;
 int(10^(F)fPart(X/10^(int(2-A+log(X&lt;br /&gt;
:translated as a sub( statement, it would be the equivalent of sub(X,A,F) regardless of the position of the decimal point in X.  If you don't understand what the formula is doing, it's dividing X by 10&amp;lt;sup&amp;gt;value&amp;lt;/sup&amp;gt; so that the digit we're looking for (identified in A) is &amp;quot;moved&amp;quot; to be the first digit to the right of the decimal point, then ignores anything to the left or the decimal piont, then multiplies the value left over by 10&amp;lt;sup&amp;gt;F&amp;lt;/sup&amp;gt; and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).&lt;br /&gt;
;use more than 27 vars:If you need to use more than the 27 vars TIOS gives you with A-Z, other than using lists, matrices, strings, or Ans, you can go look in the [VARS] menu under Window.  Of these, being that the calculator is usually in function mode, you can use any of the window vars under T/theta (which are for parametric mode) and/or under U/V/W (which are for polar).  It is recommended that you prefer those under U/V/W because this mode is usually never used, whereas parametric has been used on more than one occasion by programs, such as for drawing X in terms of Y. You can also go into the Finance menu under [APPS] and go to Vars, but IIRC, some are read-only vars, so you will need to experiment to see if a var is accessible or not, but it is certain, that at least the '''N''' can be used problemlessly in your programs. You can also use the ''n'', which is found by going to the catalog and pressing &amp;quot;N&amp;quot; as a variable, as well as the sequential functions u,v, and w.&lt;br /&gt;
;Debugging:One of the easiest ways to help you debug your program is through the use of the Pause command.  You can use the Pause command to display the value of a var, or just to track the progress of your program.  During any of the Pause commands, you can press [ON] to break the program and choose Goto so that the calc will automatically bring you to the point in your program where it was Pause-ing when you interrupted it with the [ON] key. Some common bugs include using the Y var or the X var while drawing to the screen (TIOS tends to change the value of Y and/or X when doing certain things on the graph screen, so avoid using Y or X when working on the graph screen.&lt;br /&gt;
&lt;br /&gt;
===Memory Saving===&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Never write out closing ''')''' parentheses at the end of a line:You save '''1''' byte. The reason for this is that TIOS closes all still-open parentheses when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never write out closing '''&amp;quot;''' quotes at the end of a line: You save '''1''' byte. The reason for this is that TIOS closes any still-open quotes when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never use a Pause right after a Disp, unless the Pause has text:This is because both Disp and Pause can display text to the homescreen. Disp writes the text to the screen and then continues forward, but Pause waits for the [ENTER] key to be pressed.  When Pause is used with text, such as in&lt;br /&gt;
 :Pause &amp;quot;TEXT&amp;quot;&lt;br /&gt;
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].&lt;br /&gt;
;CAPITALIZE:For the most part, yes, it is nice to see that not EVERY character is in UPPERCASE on the calculator, but if you're looking to save space, don't use lower case letters.  Each lowercase letter takes up twice as much space as the uppercase ones.&lt;br /&gt;
;Read-Only Lists and Matrices:If you have a list or matrix that will be read-only, it behooves you to save it to a string or Y function (Y1-Y0). Instead of doing&lt;br /&gt;
 :{1,2,3,4,5,6,7,8,9â†’L1&lt;br /&gt;
 :L1(5 (to retrieve the 5th element of the list)&lt;br /&gt;
:try doing&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Str1&lt;br /&gt;
 :expr(Str1&lt;br /&gt;
 :Ans(5&lt;br /&gt;
:or&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Y1&lt;br /&gt;
 :Y1:Ans(5&lt;br /&gt;
:The benefit is that you are now no longer wasting the space, as explained in the [[83Plus:Basic:Tricks#Memory_Management|Number Values]].  When choosing between storing your list to a string and storing it to a function, keep in mind that string values are somewhat editable, while functions are completely read-only.  If you needed to edit something in the function, you'd have to convert it to a string first before editing, and then overwrite the original function.  It is therefore recommended that you save your lists to strings.&lt;br /&gt;
;No NewLine Required:The following commands do not require that you neither begin a new line, nor use a colon before the next command: Archive, Unarchive, DelVar. Example:&lt;br /&gt;
 Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1&lt;br /&gt;
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.&lt;br /&gt;
&lt;br /&gt;
==Speed Boosters==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use For( loops:In light of research I once read online, as well as through personal research and experimentation, it is fairly simple to see that For( loops are the fastest of the looping options.  To prove this, try running the following program on your calc, and see which one is the fastest:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Program:LOOPTEST&lt;br /&gt;
:Disp &amp;quot;FOR&lt;br /&gt;
:For(X,1,10000&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;FOR IS DONE&lt;br /&gt;
:1â†’X&lt;br /&gt;
:Disp &amp;quot;WHILE&lt;br /&gt;
:While X&amp;lt;10001&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;WHILE IS DONE&lt;br /&gt;
:0â†’X&lt;br /&gt;
:Disp &amp;quot;GOTO&lt;br /&gt;
:Lbl XX&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:If X&amp;lt;10001&lt;br /&gt;
:Goto XX&lt;br /&gt;
Pause &amp;quot;GOTO DONE&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:You will notice, especially if using a stopwatch, that the For( loop, IIRC, should even run a FEW SECONDS faster than the While loop, and/or the Goto loop. Therefore, see if you can't change your loops to use For( instead.  In the case of the While, change&lt;br /&gt;
 :While X&amp;lt;Y&lt;br /&gt;
:to&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
 :For(X,X,Y&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
:You most likely will be losing a few more bytes in memory, but it's very much worth it for the speed... and you've already saved much speed by doing the tricks above ;-)&lt;br /&gt;
;Get Returns on your IfThens, Fors, etc.:Each time you do an If-Then statement or a For( statement (among others), when the calc is &amp;quot;waiting&amp;quot; for an End statement, these conditions are taking up memory, which, after a while, slow down your BASIC programs. However, the benefit is that this is only the case, as long as your program is running... as soon as the calculator returns to the homescreen, these used memory is cleared again and you are ready to go at it again. The benefit of this is that when the calculator encounters a Return statement in a BASIC program, it &amp;quot;cancels&amp;quot; any conditions for its waiting for an End.&lt;br /&gt;
;Avoid storing to vars in a loop:Brandon Green writes in his BASIC Guru Online that his experiments have led to the conclusion that storing variables is a prime cause of slowdowns in TI-BASIC programs.  Therefore, try to restructure your code so as to avoid using the â†’ as much as possible.&lt;br /&gt;
&lt;br /&gt;
==Graphical Touches==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc.  Normally, you do something like this:&lt;br /&gt;
 :Text(15,10,&amp;quot;MY TEXT&lt;br /&gt;
:following this, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row, in the 10th column, in the small font... however, try adding a &amp;quot;-1&amp;quot; (without the quotation marks) as the first argument...&lt;br /&gt;
 :Text(-1,15,10,&amp;quot;MY TEXT&lt;br /&gt;
:This time, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row in the 10th column, in the LARGE font&lt;br /&gt;
;Write blank spaces to the graph screen when needing to erase stuff:as long as what you are trying to erase is at least 6 pixels high, it is srongly recommeded that you use the Text( command to write blank spaces to the screen instead of creating a Line(A,B,C,D,0 loop.  This is because to write a line, white or black, the calculator needs to do a lot of math to convert the X and Y coordinates into pixel coordinates, while writing text to the screen is almost at the same speed as it would take to draw a sprite to the screen in any asm program (since for the calc, text chars are just sprites) and so writing (blank) text to clear the screen is much faster.&lt;br /&gt;
;Try drawing graphics to the screen using text instead of lines: With access to the lowercase letters, as well as the Catalog menu, it is possible to draw graphics to the screen using text. For example, to draw a heart for a Zelda game would be much faster if you do something like the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:&amp;quot;vQ6Qv  &amp;quot;&lt;br /&gt;
:For(X,1,7&lt;br /&gt;
:Text(10,9+X,sub(Ans,X,1&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Another typical example is that of &amp;quot;drawing&amp;quot; a status bar to the screen using something such as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(P is the percent to be shaded in)&lt;br /&gt;
(L is the length of the bar in pixels)&lt;br /&gt;
(H is the horizontal position)&lt;br /&gt;
(V is the vertical position, using the top-left corner of the screen as point 0,0)&lt;br /&gt;
:Text(V,H,&amp;quot;(&lt;br /&gt;
:For(X,0,PL/100&lt;br /&gt;
:Text(V,H+X+1,&amp;quot;8&lt;br /&gt;
:End&lt;br /&gt;
:For(X,1,(100-P)L/100&lt;br /&gt;
:Text(V,H+PL/100+X,&amp;quot;)&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Using this technique, small graphics such as these can be drawn much faster than if we tried to draw them using lines and/or pixels and/or points.&lt;br /&gt;
;Simplify your Life:Save a GDB at the beginning of your program. &amp;quot;Graph Databases (GDBs) are useful storage centers of graph informaiton. This means that it saves not only the Zoom settings, but also Axes on/off, coord on/off, and the Y= equations. Using these can reduce the size of your program.&amp;quot; (quoted from http://web.archive.org/web/20021020121625/www.kevtiva.com/calc/gdb.htm) Turn off the axes with AxesOff, turn off functions with FuncOff, and set the Window to Xmin=0, Xmax=94, Xscl=8, Ymin=-62, Ymax=0, Yscl=8.  When your program is exiting, have it reset the previous GDB so that you don't mess up the gamer's graph settings.  &amp;lt;!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... --&amp;gt;While debugging your graphics, moving your cursor on the graph screen will now tell you both the pixel coordinates, as well as the point coordinates since you have synchronized them. http://www.meebo.com//skin/default/img/emoticons/big_smile.gif&lt;br /&gt;
;Convert Pts into Pxls:If you have not used the previous tip, it is important to know that the coordinates you give to any Pt command will be different from those you give to any Pxl command (if you want to use, say Pt-On/Pt-Off, with Pxl-Test).  The reason for this is that Pt commands take your window settings into account, while Pxl commands don't.Here is one set of formulas you can use to convert your Pt coordinates into Pxl coordinates:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;round(94X/(Xmax-Xmin)+47,0)-&amp;gt;A&lt;br /&gt;
round(-62Y/(Ymax-Ymin)+31,0)-&amp;gt;B&lt;br /&gt;
 -RobbieMc&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:With this formula, the Pxl command is Pxl-XX(B,A), where XX is On, Off, Test, or Change. Another formula can be found in the Ans your answers section of Cool Hacks. http://meebo.com/skin/default/img/emoticons/smile.gif&lt;br /&gt;
;Get rid of the &amp;quot;Done&amp;quot;:Use the following right before your program exits to avoid having the calc display the &amp;quot;Done&amp;quot; text on the homescreen&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:ClrHome&lt;br /&gt;
:&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:When used immediately before a &amp;quot;Stop&amp;quot; token, &amp;quot;Done&amp;quot; is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use &amp;lt;code&amp;gt;Output(1,1,&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;Get rid of the RunIndic:On the homescreen, do &amp;lt;code&amp;gt;Output(1,16,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. On the graph screen, do &amp;lt;code&amp;gt;Text(-1,0,90,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. (_ in this context refers to the space character.)&lt;br /&gt;
&lt;br /&gt;
==Cool Hacks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have &amp;quot; and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a &amp;quot; and the store arrow at the homescreen and press enter. An error message will appear; choose to Quit.  Press [Y=] and go to Y1. Press [2nd] [ENTER] to paste the previous homescreen entry into Y1. Press [2nd] [MODE] to {ESC}. At the homescreen, type Equ&amp;gt;Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the &amp;quot; quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif&lt;br /&gt;
;If condition&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;End:This will need a bigger explanation, but in short, you can have a conditional End statement that helps your loops run faster by only executing the End statement if needed. The reason this works is because you didn't use a Then statement: an If followed by a single non-Then statement is interpreted as an If with no Else clause and the single statement as the equivalent of the Then clause, even if the statement is End.  You can therefore also insert comments into your code (which is not recommended for BASIC unless you're still debugging it) by doing If 0:Whatever. For instance:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(untested...)(lines are numbered)&lt;br /&gt;
01:For(X,0,1&lt;br /&gt;
02:getKeyâ†’K&lt;br /&gt;
03:Kâ†’X&lt;br /&gt;
04:If not(Ans&lt;br /&gt;
05:End&lt;br /&gt;
06:0â†’X&lt;br /&gt;
07:&amp;quot;-&lt;br /&gt;
08:If K=25&lt;br /&gt;
09:&amp;quot;LEFT&lt;br /&gt;
10:If K=26&lt;br /&gt;
11:&amp;quot;UP&lt;br /&gt;
12:If K=27&lt;br /&gt;
13:&amp;quot;RIGHT&lt;br /&gt;
14:If K=34&lt;br /&gt;
15:&amp;quot;DOWN&lt;br /&gt;
16:If K=45&lt;br /&gt;
17:&amp;quot;CLEAR&lt;br /&gt;
18:If Ans=&amp;quot;-&lt;br /&gt;
19:End&lt;br /&gt;
20:Disp Ans&lt;br /&gt;
21:If K=45&lt;br /&gt;
22:1â†’X&lt;br /&gt;
23:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Explanation: Lines 1-2 are normal. Line 3 resets X if there was no key, which will loop back to the For( statement, or allow the routine to continue if there WAS a key. The answer from the getKey is in Ans, so if no key was pressed, Line 5 will be executed, which loops back to Line 1 without wasting any more time. http://www.meebo.com//skin/default/img/emoticons/smile.gif ... If a key was pressed, X is reset, which will cause the routine to loop back to the For( statement the next time it encounters an End statement. If the condition in Line 4 is not met, it automatically skips to Line 6. The string &amp;quot;-&amp;quot; is stored in Ans. We then go into a series of checks looking for any of the arrow keys, and changing Ans to reflect that. Line 8 is executed, and if the condition is not met, it skips to Line 10; if that condition is not met, it skips to Line 12; if that condition is not met, it skips to Line 14; if that condition is not met, it skips to Line 16; if that condition is not met, it skips to Line 18.  Then, it checks the Ans var.  If the Ans var is still unchanged, then none of the keys we are looking for have been found, so we End, which we've already said will loop back to the For( statement, essentially beginning the getKey loop once more. If Ans is different, then one of our keys was found, so we Disp the value in Ans (which is a String). We then check to see if it was the [CLEAR] key., and if it was, we set X so that the next End statement that is encountered will essentially close the loop and the routine will continue beyond this part of the code. We then End, which checks the value of X.  If X is 0, it loops back to the For( statement, recommencing the whole loop, but if X is 1, it &amp;quot;closes&amp;quot; the loop, forgets about it completely, and moves on with its life. Thus can you build in looping conditions into your programs without having to use Lbl or Goto statements. http://www.meebo.com//skin/default/img/emoticons/cool.gif&lt;br /&gt;
;Ans your answers:the Ans var is, IMHO, the most useful yet most unsafe var on the whole calculator because it can be so many different variable types (real, complex, list, matrix, string)... One way to reduce the number of varables you're using in your program is to carefully structure your program so that it stores as much information into the Ans var as possible. One way to do this is to setup Ans to be a list, say {3,1,4,2,5}. Doing Ans(4) is not going to multiply each value in the list by four, but rather going to give you the 4th value in the list:2. This happens because the OS will treat the Ans variable exactly the same as if it were L1 or any other list variable. I've already demonstrated that the Ans var can be used to keep track of whether one of the keys we were looking for was found or not, but there are other things you can do with the Ans var (as long as you're careful not to change the value in Ans unintentionally).  For instance, doing {Ans(2),Ans(4),Ans(1),Ans(3),Ans(5) will change Ans to be the list {1,2,3,4,5}... Note that the Ans var is changed AFTER the whole command has been executed.  There will probably be more examples of using Ans in a program at a later date.  Therefore, you can do something like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(50% tested)&lt;br /&gt;
(to convert from Pt coordinates to Pxl coordinates)&lt;br /&gt;
A is the X-coord&lt;br /&gt;
B is the Y-coord&lt;br /&gt;
&lt;br /&gt;
{63/(Ymax-Ymin),95/(Xmax-Xmin&lt;br /&gt;
&lt;br /&gt;
;{pixels per Y, pixels per X&lt;br /&gt;
&lt;br /&gt;
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1&lt;br /&gt;
&lt;br /&gt;
;{Y,X,int ppY,int ppX&lt;br /&gt;
;Ans(1)Ans(3) is now the Pxl-Y&lt;br /&gt;
;Ans(2)Ans(4) is now the Pxl-X&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from  James Matthew's Asmguru.hlp&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If 0&amp;lt;cos(9)&lt;br /&gt;
:Then&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Similarly, you can also use sin(&amp;amp;pi;), which only returns 0 if in radian mode, to do something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If sin(&amp;amp;pi;&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Ans as a list:It is possible to use the Ans variable as a list in replacement to using any of the real or complex variables.  The trick is knowing how to use the augment( and the seq( commands so that you won't be destroying Ans and inadvertedly converting it into something other than a list. '''NOTE: '''extensive usage of this, as in the case of replacing all variables from a program can/will slow down the program, as well as use up more memory than if you just used variables. A shellsort program using variables A,B,C,D,L,Z, and &amp;amp;theta; used up 143 bytes, while its variable-free counterpart used up 645 bytes and was significantly slower. However, this doesn't mean the technique is completely useless.&lt;br /&gt;
:*augment({1,2},{3,4}  will return {1,2,3,4}... it can only augment 2 lists at a time, so repeated usage will be necessary to maintain the Ans variable as a list&lt;br /&gt;
:*seq(formula,tempvar,start,end will return a list of what the formula evaluats to when the tempvar is (start-to-finish).  I think an example is necessary: seq(X^2,X,1,5 will For(X,1,5) evaluate X^2 and store that value to a list, thus producing {1,4,9,16,25}, without changing the value of X ;) &lt;br /&gt;
:We can therefore use seq(Ans(X),X,start,end as a list-equivalent to sub(String,start,len... using a sequence of augment( and seq( commands, we can therefore store values into specific Ans-list elements.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That returns the list {0,0,0,2,3,0,0,0}.&lt;br /&gt;
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;abs -1+1 would return 2 on a TI-82&lt;br /&gt;
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:and that one can therefore use the following to display whether the calc is an 82 or 83&lt;br /&gt;
 Text(0,0,&amp;quot;YOU HAVE A TI-&amp;quot;,83-.5(abs -1+1&lt;br /&gt;
==Miscellaneous==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have conditions built into your formulas:This will probably need a better explanation, but I have found it useful to build certain conditions into my formulas, instead of having to write all those If statements... for instance, for piece-wise graphing, you can do Y=(X^2)(X&amp;gt;0)+(2X)(X&amp;lt;1), which is the same as If X&amp;gt;0:Y=X^2:If X&amp;lt;1:Y=2X ...right now, I can't really say what you'll be saving by doing this (memory/speed/etc) because I don't remember, but I can assure you this come quite in handy because you can then have one formula solve a variety of different problems, without the hassle of dealing with a lot of If-Then statements.  For example, if you were to save that formula as Y1, then you'd only need to do Y1(number) to have it do the whole sequence of conditionals. I consider this one of the more complicated tricks to implement (because one can easily get confused as to how to build it as well as to what conditions one is looking for) but I have found it to be extremely useful.  For example, let us say you write a text editor program in BASIC that allows the user to edit Str1, as displayed on the homescreen using Output(1,1,Str1.  However, you run into a problem when Str1 is longer than the 96 chars that fit on the homescreen, so you can, using the sub( and length( functions, you could have one line of code something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:length(Str1&lt;br /&gt;
:Output(1,1,sub(Str1,1(Ans&amp;lt;96)+16frac(Ans/16)(Ans&amp;gt;95)+(16int(Ans/16)-80)(Ans&amp;gt;95),Ans+80-16int(Ans/16&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:should make the Output scroll up one line whenever the screen has been filled (untested, please verify).  What this line is saying is: give me from Str1, starting at the first byte if Str1 is smaller than 96 charachters, otherwise, calculate the beginning to be one &amp;quot;row&amp;quot; less than the total, and give me all the rest of the chars till the end.  If you could not follow that, don't worry, as that is what I meant when I said this is one of the harder tricks. If you did follow with what I was trying to do, Kudos to you!  Keep in mind that the conditions within the () can hold any of the condition-elements of If statements, i.e. and, not, or, =, â‰ , &amp;gt;, &amp;lt;, â‰¥, â‰¤.  BTW, this BASIC trick  does '''NOT''' work on the 89. I tried, but there I could not get the 89 to convert a binary operation into a numerical value, the way the z80s do. (I could be wrong about this working on all z80s... I've tested it on an 82 and an 83+)&lt;br /&gt;
;See program in MirageOS:If you want to see your program in a shell, like MirageOS, you must type the following code in the first line of the program:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;::&amp;quot;Description&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That will show the program name with the description you typed.&lt;br /&gt;
;User-friendly Error Messages:(brought to you by Kevtiva Inc.) Write an error message to the screen before calling any subroutine programs, and have the subroutines program erase the error message. This way, if the subroutine program is missing, the user will be informed about the specifics of the problem. Example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;PROGRAM:MYSHELL&lt;br /&gt;
:program code&lt;br /&gt;
:Output(1,1,&amp;quot;ERR:prgmMYSUB MISSING&lt;br /&gt;
:prgmMYSUB&lt;br /&gt;
:more program code&lt;br /&gt;
&lt;br /&gt;
PROGRAM:MYSUB&lt;br /&gt;
:Output(1,1,&amp;quot;                     &amp;quot;&lt;br /&gt;
:The rest of program MYSUB.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]&lt;br /&gt;
&lt;br /&gt;
'''TI-Basic Developer'''&lt;br /&gt;
[http://tibasicdev.wikidot.com]&lt;br /&gt;
&lt;br /&gt;
==Special Thanks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
Special thanks to:&lt;br /&gt;
&lt;br /&gt;
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* Â© 2000 Kevtiva Interactive]&lt;br /&gt;
&lt;br /&gt;
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright Â© 2000-2006 BASIC Guru Online. All Rights Reserved.]&lt;br /&gt;
&lt;br /&gt;
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ Â© 2000-2006 Detached Solutions]&lt;/div&gt;</summary>
		<author><name>Bfr</name></author>	</entry>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks</id>
		<title>83Plus:Basic:Tricks</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks"/>
				<updated>2009-01-02T19:30:41Z</updated>
		
		<summary type="html">&lt;p&gt;Bfr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:83Plus:Basic|Tricks]]&lt;br /&gt;
[[Category:83Plus:Basic:Routines|Tricks]]&lt;br /&gt;
&lt;br /&gt;
There is a whole list of tricks that one can implement, once one is comfortable programming in TI-Basic which allow for a whole onslaught of capabilities, such as using less memory or making the program run faster.  There used to be a site called Kevtiva Inc. which had the largest list of TI-BASIC hacks I (Saibot84) have ever seen, including how to force a RAM reset (without the use of asm programs) but I've forgotten most of the meanest hacks. Here are some of the many tricks: (Please use common sense in deciding whether a &amp;quot;-&amp;quot; is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Memory==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
===Memory Management===&amp;lt;!-- â†’â‰ â‰¤â‰¥  --&amp;gt;&lt;br /&gt;
;Number values:In order to be able to save memory on the calculator, it helps to have a bit of an understanding as to how the calc manages the memory, especially in regards to numbers. Because TIOS is designed for school, and so is oriented for precision, it saves all real number values as 14-digits and an exponent of 10. In other words, it saves the number &amp;amp;pi; as 3.1415926535898 &amp;amp;times; 10&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;, but in memory, it is something more similar (not exact) to &amp;lt;code&amp;gt;0 31415926535898&amp;lt;/code&amp;gt; where the 0 tells TIOS what the exponent of 10 is that need to be applied to the 31415926535898.  However, this also applies to smaller values, such that a 13 is saved as &amp;lt;code&amp;gt;1 13000000000000&amp;lt;/code&amp;gt;.  For small, rational, terminating values, it can be seen that a good deal of memory is being wasted.  I've created the following formula which, when saved to Y0 (or any other Y function, works with numbers in the same way that the sub( function works with strings:&lt;br /&gt;
 int(10^(F)fPart(X/10^(int(2-A+log(X&lt;br /&gt;
:translated as a sub( statement, it would be the equivalent of sub(X,A,F) regardless of the position of the decimal point in X.  If you don't understand what the formula is doing, it's dividing X by 10&amp;lt;sup&amp;gt;value&amp;lt;/sup&amp;gt; so that the digit we're looking for (identified in A) is &amp;quot;moved&amp;quot; to be the first digit to the right of the decimal point, then ignores anything to the left or the decimal piont, then multiplies the value left over by 10&amp;lt;sup&amp;gt;F&amp;lt;/sup&amp;gt; and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).&lt;br /&gt;
;use more than 27 vars:If you need to use more than the 27 vars TIOS gives you with A-Z, other than using lists, matrices, strings, or Ans, you can go look in the [VARS] menu under Window.  Of these, being that the calculator is usually in function mode, you can use any of the window vars under T/theta (which are for parametric mode) and/or under U/V/W (which are for polar).  It is recommended that you prefer those under U/V/W because this mode is usually never used, whereas parametric has been used on more than one occasion by programs, such as for drawing X in terms of Y. You can also go into the Finance menu under [APPS] and go to Vars, but IIRC, some are read-only vars, so you will need to experiment to see if a var is accessible or not, but it is certain, that at least the '''N''' can be used problemlessly in your programs. You can also use the ''n'', which is found by going to the catalog and pressing &amp;quot;N&amp;quot; as a variable, as well as the sequential functions u,v, and w.&lt;br /&gt;
;Debugging:One of the easiest ways to help you debug your program is through the use of the Pause command.  You can use the Pause command to display the value of a var, or just to track the progress of your program.  During any of the Pause commands, you can press [ON] to break the program and choose Goto so that the calc will automatically bring you to the point in your program where it was Pause-ing when you interrupted it with the [ON] key. Some common bugs include using the Y var or the X var while drawing to the screen (TIOS tends to change the value of Y and/or X when doing certain things on the graph screen, so avoid using Y or X when working on the graph screen.&lt;br /&gt;
&lt;br /&gt;
===Memory Saving===&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Never write out closing ''')''' parentheses at the end of a line:You save '''1''' byte. The reason for this is that TIOS closes all still-open parentheses when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never write out closing '''&amp;quot;''' quotes at the end of a line: You save '''1''' byte. The reason for this is that TIOS closes any still-open quotes when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never use a Pause right after a Disp, unless the Pause has text:This is because both Disp and Pause can display text to the homescreen. Disp writes the text to the screen and then continues forward, but Pause waits for the [ENTER] key to be pressed.  When Pause is used with text, such as in&lt;br /&gt;
 :Pause &amp;quot;TEXT&amp;quot;&lt;br /&gt;
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].&lt;br /&gt;
;CAPITALIZE:For the most part, yes, it is nice to see that not EVERY character is in UPPERCASE on the calculator, but if you're looking to save space, don't use lower case letters.  Each lowercase letter takes up twice as much space as the uppercase ones.&lt;br /&gt;
;Read-Only Lists and Matrices:If you have a list or matrix that will be read-only, it behooves you to save it to a string or Y function (Y1-Y0). Instead of doing&lt;br /&gt;
 :{1,2,3,4,5,6,7,8,9â†’L1&lt;br /&gt;
 :L1(5 (to retrieve the 5th element of the list)&lt;br /&gt;
:try doing&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Str1&lt;br /&gt;
 :expr(Str1&lt;br /&gt;
 :Ans(5&lt;br /&gt;
:or&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Y1&lt;br /&gt;
 :Y1:Ans(5&lt;br /&gt;
:The benefit is that you are now no longer wasting the space, as explained in the [[83Plus:Basic:Tricks#Memory_Management|Number Values]].  When choosing between storing your list to a string and storing it to a function, keep in mind that string values are somewhat editable, while functions are completely read-only.  If you needed to edit something in the function, you'd have to convert it to a string first before editing, and then overwrite the original function.  It is therefore recommended that you save your lists to strings.&lt;br /&gt;
;No NewLine Required:The following commands do not require that you neither begin a new line, nor use a colon before the next command: Archive, Unarchive, DelVar. Example:&lt;br /&gt;
 Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1&lt;br /&gt;
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.&lt;br /&gt;
&lt;br /&gt;
==Speed Boosters==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use For( loops:In light of research I once read online, as well as through personal research and experimentation, it is fairly simple to see that For( loops are the fastest of the looping options.  To prove this, try running the following program on your calc, and see which one is the fastest:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Program:LOOPTEST&lt;br /&gt;
:Disp &amp;quot;FOR&lt;br /&gt;
:For(X,1,10000&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;FOR IS DONE&lt;br /&gt;
:1â†’X&lt;br /&gt;
:Disp &amp;quot;WHILE&lt;br /&gt;
:While X&amp;lt;10001&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;WHILE IS DONE&lt;br /&gt;
:0â†’X&lt;br /&gt;
:Disp &amp;quot;GOTO&lt;br /&gt;
:Lbl XX&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:If X&amp;lt;10001&lt;br /&gt;
:Goto XX&lt;br /&gt;
Pause &amp;quot;GOTO DONE&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:You will notice, especially if using a stopwatch, that the For( loop, IIRC, should even run a FEW SECONDS faster than the While loop, and/or the Goto loop. Therefore, see if you can't change your loops to use For( instead.  In the case of the While, change&lt;br /&gt;
 :While X&amp;lt;Y&lt;br /&gt;
:to&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
 :For(X,X,Y&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
:You most likely will be losing a few more bytes in memory, but it's very much worth it for the speed... and you've already saved much speed by doing the tricks above ;-)&lt;br /&gt;
;Get Returns on your IfThens, Fors, etc.:Each time you do an If-Then statement or a For( statement (among others), when the calc is &amp;quot;waiting&amp;quot; for an End statement, these conditions are taking up memory, which, after a while, slow down your BASIC programs. However, the benefit is that this is only the case, as long as your program is running... as soon as the calculator returns to the homescreen, these used memory is cleared again and you are ready to go at it again. The benefit of this is that when the calculator encounters a Return statement in a BASIC program, it &amp;quot;cancels&amp;quot; any conditions for its waiting for an End.&lt;br /&gt;
;Avoid storing to vars in a loop:Brandon Green writes in his BASIC Guru Online that his experiments have led to the conclusion that storing variables is a prime cause of slowdowns in TI-BASIC programs.  Therefore, try to restructure your code so as to avoid using the â†’ as much as possible.&lt;br /&gt;
&lt;br /&gt;
==Graphical Touches==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc.  Normally, you do something like this:&lt;br /&gt;
 :Text(15,10,&amp;quot;MY TEXT&lt;br /&gt;
:following this, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row, in the 10th column, in the small font... however, try adding a &amp;quot;-1&amp;quot; (without the quotation marks) as the first argument...&lt;br /&gt;
 :Text(-1,15,10,&amp;quot;MY TEXT&lt;br /&gt;
:This time, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row in the 10th column, in the LARGE font&lt;br /&gt;
;Write blank spaces to the graph screen when needing to erase stuff:as long as what you are trying to erase is at least 6 pixels high, it is srongly recommeded that you use the Text( command to write blank spaces to the screen instead of creating a Line(A,B,C,D,0 loop.  This is because to write a line, white or black, the calculator needs to do a lot of math to convert the X and Y coordinates into pixel coordinates, while writing text to the screen is almost at the same speed as it would take to draw a sprite to the screen in any asm program (since for the calc, text chars are just sprites) and so writing (blank) text to clear the screen is much faster.&lt;br /&gt;
;Try drawing graphics to the screen using text instead of lines: With access to the lowercase letters, as well as the Catalog menu, it is possible to draw graphics to the screen using text. For example, to draw a heart for a Zelda game would be much faster if you do something like the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:&amp;quot;vQ6Qv  &amp;quot;&lt;br /&gt;
:For(X,1,7&lt;br /&gt;
:Text(10,9+X,sub(Ans,X,1&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Another typical example is that of &amp;quot;drawing&amp;quot; a status bar to the screen using something such as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(P is the percent to be shaded in)&lt;br /&gt;
(L is the length of the bar in pixels)&lt;br /&gt;
(H is the horizontal position)&lt;br /&gt;
(V is the vertical position, using the top-left corner of the screen as point 0,0)&lt;br /&gt;
:Text(V,H,&amp;quot;(&lt;br /&gt;
:For(X,0,PL/100&lt;br /&gt;
:Text(V,H+X+1,&amp;quot;8&lt;br /&gt;
:End&lt;br /&gt;
:For(X,1,(100-P)L/100&lt;br /&gt;
:Text(V,H+PL/100+X,&amp;quot;)&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Using this technique, small graphics such as these can be drawn much faster than if we tried to draw them using lines and/or pixels and/or points.&lt;br /&gt;
;Simplify your Life:Save a GDB at the beginning of your program. &amp;quot;Graph Databases (GDBs) are useful storage centers of graph informaiton. This means that it saves not only the Zoom settings, but also Axes on/off, coord on/off, and the Y= equations. Using these can reduce the size of your program.&amp;quot; (quoted from http://web.archive.org/web/20021020121625/www.kevtiva.com/calc/gdb.htm) Turn off the axes with AxesOff, turn off functions with FuncOff, and set the Window to Xmin=0, Xmax=94, Xscl=8, Ymin=-62, Ymax=0, Yscl=8.  When your program is exiting, have it reset the previous GDB so that you don't mess up the gamer's graph settings.  &amp;lt;!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... --&amp;gt;While debugging your graphics, moving your cursor on the graph screen will now tell you both the pixel coordinates, as well as the point coordinates since you have synchronized them. http://www.meebo.com//skin/default/img/emoticons/big_smile.gif&lt;br /&gt;
;Convert Pts into Pxls:If you have not used the previous tip, it is important to know that the coordinates you give to any Pt command will be different from those you give to any Pxl command (if you want to use, say Pt-On/Pt-Off, with Pxl-Test).  The reason for this is that Pt commands take your window settings into account, while Pxl commands don't.Here is one set of formulas you can use to convert your Pt coordinates into Pxl coordinates:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;round(94X/(Xmax-Xmin)+47,0)-&amp;gt;A&lt;br /&gt;
round(-62Y/(Ymax-Ymin)+31,0)-&amp;gt;B&lt;br /&gt;
 -RobbieMc&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:With this formula, the Pxl command is Pxl-XX(B,A), where XX is On, Off, Test, or Change. Another formula can be found in the Ans your answers section of Cool Hacks. http://meebo.com/skin/default/img/emoticons/smile.gif&lt;br /&gt;
;Get rid of the &amp;quot;Done&amp;quot;:Use the following right before your program exits to avoid having the calc display the &amp;quot;Done&amp;quot; text on the homescreen&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:ClrHome&lt;br /&gt;
:&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:When used immediately before a &amp;quot;Stop&amp;quot; token, &amp;quot;Done&amp;quot; is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use &amp;lt;code&amp;gt;Output(1,1,&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;Get rid of the RunIndic:On the homescreen, do &amp;lt;code&amp;gt;Output(1,16,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. On the graph screen, do &amp;lt;code&amp;gt;Text(-1,0,90,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. (_ in this context refers to the space character.)&lt;br /&gt;
&lt;br /&gt;
==Cool Hacks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have &amp;quot; and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a &amp;quot; and the store arrow at the homescreen and press enter. An error message will appear; choose to Quit.  Press [Y=] and go to Y1. Press [2nd] [ENTER] to paste the previous homescreen entry into Y1. Press [2nd] [MODE] to {ESC}. At the homescreen, type Equ&amp;gt;Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the &amp;quot; quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif&lt;br /&gt;
;If condition&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;End:This will need a bigger explanation, but in short, you can have a conditional End statement that helps your loops run faster by only executing the End statement if needed. The reason this works is because you didn't use a Then statement: an If followed by a single non-Then statement is interpreted as an If with no Else clause and the single statement as the equivalent of the Then clause, even if the statement is End.  You can therefore also insert comments into your code (which is not recommended for BASIC unless you're still debugging it) by doing If 0:Whatever. For instance:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(untested...)(lines are numbered)&lt;br /&gt;
01:For(X,0,1&lt;br /&gt;
02:getKeyâ†’K&lt;br /&gt;
03:Kâ†’X&lt;br /&gt;
04:If not(Ans&lt;br /&gt;
05:End&lt;br /&gt;
06:0â†’X&lt;br /&gt;
07:&amp;quot;-&lt;br /&gt;
08:If K=25&lt;br /&gt;
09:&amp;quot;LEFT&lt;br /&gt;
10:If K=26&lt;br /&gt;
11:&amp;quot;UP&lt;br /&gt;
12:If K=27&lt;br /&gt;
13:&amp;quot;RIGHT&lt;br /&gt;
14:If K=34&lt;br /&gt;
15:&amp;quot;DOWN&lt;br /&gt;
16:If K=45&lt;br /&gt;
17:&amp;quot;CLEAR&lt;br /&gt;
18:If Ans=&amp;quot;-&lt;br /&gt;
19:End&lt;br /&gt;
20:Disp Ans&lt;br /&gt;
21:If K=45&lt;br /&gt;
22:1â†’X&lt;br /&gt;
23:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Explanation: Lines 1-2 are normal. Line 3 resets X if there was no key, which will loop back to the For( statement, or allow the routine to continue if there WAS a key. The answer from the getKey is in Ans, so if no key was pressed, Line 5 will be executed, which loops back to Line 1 without wasting any more time. http://www.meebo.com//skin/default/img/emoticons/smile.gif ... If a key was pressed, X is reset, which will cause the routine to loop back to the For( statement the next time it encounters an End statement. If the condition in Line 4 is not met, it automatically skips to Line 6. The string &amp;quot;-&amp;quot; is stored in Ans. We then go into a series of checks looking for any of the arrow keys, and changing Ans to reflect that. Line 8 is executed, and if the condition is not met, it skips to Line 10; if that condition is not met, it skips to Line 12; if that condition is not met, it skips to Line 14; if that condition is not met, it skips to Line 16; if that condition is not met, it skips to Line 18.  Then, it checks the Ans var.  If the Ans var is still unchanged, then none of the keys we are looking for have been found, so we End, which we've already said will loop back to the For( statement, essentially beginning the getKey loop once more. If Ans is different, then one of our keys was found, so we Disp the value in Ans (which is a String). We then check to see if it was the [CLEAR] key., and if it was, we set X so that the next End statement that is encountered will essentially close the loop and the routine will continue beyond this part of the code. We then End, which checks the value of X.  If X is 0, it loops back to the For( statement, recommencing the whole loop, but if X is 1, it &amp;quot;closes&amp;quot; the loop, forgets about it completely, and moves on with its life. Thus can you build in looping conditions into your programs without having to use Lbl or Goto statements. http://www.meebo.com//skin/default/img/emoticons/cool.gif&lt;br /&gt;
;Ans your answers:the Ans var is, IMHO, the most useful yet most unsafe var on the whole calculator because it can be so many different variable types (real, complex, list, matrix, string)... One way to reduce the number of varables you're using in your program is to carefully structure your program so that it stores as much information into the Ans var as possible. One way to do this is to setup Ans to be a list, say {3,1,4,2,5}. Doing Ans(4) is not going to multiply each value in the list by four, but rather going to give you the 4th value in the list:2. This happens because the OS will treat the Ans variable exactly the same as if it were L1 or any other list variable. I've already demonstrated that the Ans var can be used to keep track of whether one of the keys we were looking for was found or not, but there are other things you can do with the Ans var (as long as you're careful not to change the value in Ans unintentionally).  For instance, doing {Ans(2),Ans(4),Ans(1),Ans(3),Ans(5) will change Ans to be the list {1,2,3,4,5}... Note that the Ans var is changed AFTER the whole command has been executed.  There will probably be more examples of using Ans in a program at a later date.  Therefore, you can do something like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(50% tested)&lt;br /&gt;
(to convert from Pt coordinates to Pxl coordinates)&lt;br /&gt;
A is the X-coord&lt;br /&gt;
B is the Y-coord&lt;br /&gt;
&lt;br /&gt;
{63/(Ymax-Ymin),95/(Xmax-Xmin&lt;br /&gt;
&lt;br /&gt;
;{pixels per Y, pixels per X&lt;br /&gt;
&lt;br /&gt;
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1&lt;br /&gt;
&lt;br /&gt;
;{Y,X,int ppY,int ppX&lt;br /&gt;
;Ans(1)Ans(3) is now the Pxl-Y&lt;br /&gt;
;Ans(2)Ans(4) is now the Pxl-X&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from  James Matthew's Asmguru.hlp&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If 0&amp;lt;cos(9)&lt;br /&gt;
:Then&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Similarly, you can also use sin(&amp;amp;pi;), which only returns 0 if in radian mode, to do something like&lt;br /&gt;
&amp;lt;nowiki&amp;gt;:If sin(&amp;amp;pi;&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Ans as a list:It is possible to use the Ans variable as a list in replacement to using any of the real or complex variables.  The trick is knowing how to use the augment( and the seq( commands so that you won't be destroying Ans and inadvertedly converting it into something other than a list. '''NOTE: '''extensive usage of this, as in the case of replacing all variables from a program can/will slow down the program, as well as use up more memory than if you just used variables. A shellsort program using variables A,B,C,D,L,Z, and &amp;amp;theta; used up 143 bytes, while its variable-free counterpart used up 645 bytes and was significantly slower. However, this doesn't mean the technique is completely useless.&lt;br /&gt;
:*augment({1,2},{3,4}  will return {1,2,3,4}... it can only augment 2 lists at a time, so repeated usage will be necessary to maintain the Ans variable as a list&lt;br /&gt;
:*seq(formula,tempvar,start,end will return a list of what the formula evaluats to when the tempvar is (start-to-finish).  I think an example is necessary: seq(X^2,X,1,5 will For(X,1,5) evaluate X^2 and store that value to a list, thus producing {1,4,9,16,25}, without changing the value of X ;) &lt;br /&gt;
:We can therefore use seq(Ans(X),X,start,end as a list-equivalent to sub(String,start,len... using a sequence of augment( and seq( commands, we can therefore store values into specific Ans-list elements.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That returns the list {0,0,0,2,3,0,0,0}.&lt;br /&gt;
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;abs -1+1 would return 2 on a TI-82&lt;br /&gt;
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:and that one can therefore use the following to display whether the calc is an 82 or 83&lt;br /&gt;
 Text(0,0,&amp;quot;YOU HAVE A TI-&amp;quot;,83-.5(abs -1+1&lt;br /&gt;
==Miscellaneous==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have conditions built into your formulas:This will probably need a better explanation, but I have found it useful to build certain conditions into my formulas, instead of having to write all those If statements... for instance, for piece-wise graphing, you can do Y=(X^2)(X&amp;gt;0)+(2X)(X&amp;lt;1), which is the same as If X&amp;gt;0:Y=X^2:If X&amp;lt;1:Y=2X ...right now, I can't really say what you'll be saving by doing this (memory/speed/etc) because I don't remember, but I can assure you this come quite in handy because you can then have one formula solve a variety of different problems, without the hassle of dealing with a lot of If-Then statements.  For example, if you were to save that formula as Y1, then you'd only need to do Y1(number) to have it do the whole sequence of conditionals. I consider this one of the more complicated tricks to implement (because one can easily get confused as to how to build it as well as to what conditions one is looking for) but I have found it to be extremely useful.  For example, let us say you write a text editor program in BASIC that allows the user to edit Str1, as displayed on the homescreen using Output(1,1,Str1.  However, you run into a problem when Str1 is longer than the 96 chars that fit on the homescreen, so you can, using the sub( and length( functions, you could have one line of code something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:length(Str1&lt;br /&gt;
:Output(1,1,sub(Str1,1(Ans&amp;lt;96)+16frac(Ans/16)(Ans&amp;gt;95)+(16int(Ans/16)-80)(Ans&amp;gt;95),Ans+80-16int(Ans/16&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:should make the Output scroll up one line whenever the screen has been filled (untested, please verify).  What this line is saying is: give me from Str1, starting at the first byte if Str1 is smaller than 96 charachters, otherwise, calculate the beginning to be one &amp;quot;row&amp;quot; less than the total, and give me all the rest of the chars till the end.  If you could not follow that, don't worry, as that is what I meant when I said this is one of the harder tricks. If you did follow with what I was trying to do, Kudos to you!  Keep in mind that the conditions within the () can hold any of the condition-elements of If statements, i.e. and, not, or, =, â‰ , &amp;gt;, &amp;lt;, â‰¥, â‰¤.  BTW, this BASIC trick  does '''NOT''' work on the 89. I tried, but there I could not get the 89 to convert a binary operation into a numerical value, the way the z80s do. (I could be wrong about this working on all z80s... I've tested it on an 82 and an 83+)&lt;br /&gt;
;See program in MirageOS:If you want to see your program in a shell, like MirageOS, you must type the following code in the first line of the program:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;::&amp;quot;Description&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That will show the program name with the description you typed.&lt;br /&gt;
;User-friendly Error Messages:(brought to you by Kevtiva Inc.) Write an error message to the screen before calling any subroutine programs, and have the subroutines program erase the error message. This way, if the subroutine program is missing, the user will be informed about the specifics of the problem. Example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;PROGRAM:MYSHELL&lt;br /&gt;
:program code&lt;br /&gt;
:Output(1,1,&amp;quot;ERR:prgmMYSUB MISSING&lt;br /&gt;
:prgmMYSUB&lt;br /&gt;
:more program code&lt;br /&gt;
&lt;br /&gt;
PROGRAM:MYSUB&lt;br /&gt;
:Output(1,1,&amp;quot;                     &amp;quot;&lt;br /&gt;
:The rest of program MYSUB.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]&lt;br /&gt;
&lt;br /&gt;
'''TI-Basic Developer'''&lt;br /&gt;
[http://tibasicdev.wikidot.com]&lt;br /&gt;
&lt;br /&gt;
==Special Thanks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
Special thanks to:&lt;br /&gt;
&lt;br /&gt;
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* Â© 2000 Kevtiva Interactive]&lt;br /&gt;
&lt;br /&gt;
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright Â© 2000-2006 BASIC Guru Online. All Rights Reserved.]&lt;br /&gt;
&lt;br /&gt;
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ Â© 2000-2006 Detached Solutions]&lt;/div&gt;</summary>
		<author><name>Bfr</name></author>	</entry>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks</id>
		<title>83Plus:Basic:Tricks</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks"/>
				<updated>2009-01-02T19:22:55Z</updated>
		
		<summary type="html">&lt;p&gt;Bfr: Another way to detect radian/degree mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:83Plus:Basic|Tricks]]&lt;br /&gt;
[[Category:83Plus:Basic:Routines|Tricks]]&lt;br /&gt;
&lt;br /&gt;
There is a whole list of tricks that one can implement, once one is comfortable programming in TI-Basic which allow for a whole onslaught of capabilities, such as using less memory or making the program run faster.  There used to be a site called Kevtiva Inc. which had the largest list of TI-BASIC hacks I (Saibot84) have ever seen, including how to force a RAM reset (without the use of asm programs) but I've forgotten most of the meanest hacks. Here are some of the many tricks: (Please use common sense in deciding whether a &amp;quot;-&amp;quot; is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Memory==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
===Memory Management===&amp;lt;!-- â†’â‰ â‰¤â‰¥  --&amp;gt;&lt;br /&gt;
;Number values:In order to be able to save memory on the calculator, it helps to have a bit of an understanding as to how the calc manages the memory, especially in regards to numbers. Because TIOS is designed for school, and so is oriented for precision, it saves all real number values as 14-digits and an exponent of 10. In other words, it saves the number &amp;amp;pi; as 3.1415926535898 &amp;amp;times; 10&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;, but in memory, it is something more similar (not exact) to &amp;lt;code&amp;gt;0 31415926535898&amp;lt;/code&amp;gt; where the 0 tells TIOS what the exponent of 10 is that need to be applied to the 31415926535898.  However, this also applies to smaller values, such that a 13 is saved as &amp;lt;code&amp;gt;1 13000000000000&amp;lt;/code&amp;gt;.  For small, rational, terminating values, it can be seen that a good deal of memory is being wasted.  I've created the following formula which, when saved to Y0 (or any other Y function, works with numbers in the same way that the sub( function works with strings:&lt;br /&gt;
 int(10^(F)fPart(X/10^(int(2-A+log(X&lt;br /&gt;
:translated as a sub( statement, it would be the equivalent of sub(X,A,F) regardless of the position of the decimal point in X.  If you don't understand what the formula is doing, it's dividing X by 10&amp;lt;sup&amp;gt;value&amp;lt;/sup&amp;gt; so that the digit we're looking for (identified in A) is &amp;quot;moved&amp;quot; to be the first digit to the right of the decimal point, then ignores anything to the left or the decimal piont, then multiplies the value left over by 10&amp;lt;sup&amp;gt;F&amp;lt;/sup&amp;gt; and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).&lt;br /&gt;
;use more than 27 vars:If you need to use more than the 27 vars TIOS gives you with A-Z, other than using lists, matrices, strings, or Ans, you can go look in the [VARS] menu under Window.  Of these, being that the calculator is usually in function mode, you can use any of the window vars under T/theta (which are for parametric mode) and/or under U/V/W (which are for polar).  It is recommended that you prefer those under U/V/W because this mode is usually never used, whereas parametric has been used on more than one occasion by programs, such as for drawing X in terms of Y. You can also go into the Finance menu under [APPS] and go to Vars, but IIRC, some are read-only vars, so you will need to experiment to see if a var is accessible or not, but it is certain, that at least the '''N''' can be used problemlessly in your programs. You can also use the ''n'', which is found by going to the catalog and pressing &amp;quot;N&amp;quot; as a variable, as well as the sequential functions u,v, and w.&lt;br /&gt;
;Debugging:One of the easiest ways to help you debug your program is through the use of the Pause command.  You can use the Pause command to display the value of a var, or just to track the progress of your program.  During any of the Pause commands, you can press [ON] to break the program and choose Goto so that the calc will automatically bring you to the point in your program where it was Pause-ing when you interrupted it with the [ON] key. Some common bugs include using the Y var or the X var while drawing to the screen (TIOS tends to change the value of Y and/or X when doing certain things on the graph screen, so avoid using Y or X when working on the graph screen.&lt;br /&gt;
&lt;br /&gt;
===Memory Saving===&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Never write out closing ''')''' parentheses at the end of a line:You save '''1''' byte. The reason for this is that TIOS closes all still-open parentheses when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never write out closing '''&amp;quot;''' quotes at the end of a line: You save '''1''' byte. The reason for this is that TIOS closes any still-open quotes when it encounters $3F, which is the new-line character that is input when you press enter in the Program Editor, or when it encounters the store arrow.&lt;br /&gt;
;Never use a Pause right after a Disp, unless the Pause has text:This is because both Disp and Pause can display text to the homescreen. Disp writes the text to the screen and then continues forward, but Pause waits for the [ENTER] key to be pressed.  When Pause is used with text, such as in&lt;br /&gt;
 :Pause &amp;quot;TEXT&amp;quot;&lt;br /&gt;
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].&lt;br /&gt;
;CAPITALIZE:For the most part, yes, it is nice to see that not EVERY character is in UPPERCASE on the calculator, but if you're looking to save space, don't use lower case letters.  Each lowercase letter takes up twice as much space as the uppercase ones.&lt;br /&gt;
;Read-Only Lists and Matrices:If you have a list or matrix that will be read-only, it behooves you to save it to a string or Y function (Y1-Y0). Instead of doing&lt;br /&gt;
 :{1,2,3,4,5,6,7,8,9â†’L1&lt;br /&gt;
 :L1(5 (to retrieve the 5th element of the list)&lt;br /&gt;
:try doing&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Str1&lt;br /&gt;
 :expr(Str1&lt;br /&gt;
 :Ans(5&lt;br /&gt;
:or&lt;br /&gt;
 :&amp;quot;{1,2,3,4,5,6,7,8,9â†’Y1&lt;br /&gt;
 :Y1:Ans(5&lt;br /&gt;
:The benefit is that you are now no longer wasting the space, as explained in the [[83Plus:Basic:Tricks#Memory_Management|Number Values]].  When choosing between storing your list to a string and storing it to a function, keep in mind that string values are somewhat editable, while functions are completely read-only.  If you needed to edit something in the function, you'd have to convert it to a string first before editing, and then overwrite the original function.  It is therefore recommended that you save your lists to strings.&lt;br /&gt;
;No NewLine Required:The following commands do not require that you neither begin a new line, nor use a colon before the next command: Archive, Unarchive, DelVar. Example:&lt;br /&gt;
 Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1&lt;br /&gt;
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.&lt;br /&gt;
&lt;br /&gt;
==Speed Boosters==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use For( loops:In light of research I once read online, as well as through personal research and experimentation, it is fairly simple to see that For( loops are the fastest of the looping options.  To prove this, try running the following program on your calc, and see which one is the fastest:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Program:LOOPTEST&lt;br /&gt;
:Disp &amp;quot;FOR&lt;br /&gt;
:For(X,1,10000&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;FOR IS DONE&lt;br /&gt;
:1â†’X&lt;br /&gt;
:Disp &amp;quot;WHILE&lt;br /&gt;
:While X&amp;lt;10001&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:End&lt;br /&gt;
:Pause &amp;quot;WHILE IS DONE&lt;br /&gt;
:0â†’X&lt;br /&gt;
:Disp &amp;quot;GOTO&lt;br /&gt;
:Lbl XX&lt;br /&gt;
:X+1â†’X&lt;br /&gt;
:If X&amp;lt;10001&lt;br /&gt;
:Goto XX&lt;br /&gt;
Pause &amp;quot;GOTO DONE&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:You will notice, especially if using a stopwatch, that the For( loop, IIRC, should even run a FEW SECONDS faster than the While loop, and/or the Goto loop. Therefore, see if you can't change your loops to use For( instead.  In the case of the While, change&lt;br /&gt;
 :While X&amp;lt;Y&lt;br /&gt;
:to&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
 :For(X,X,Y&lt;br /&gt;
 :X-1â†’X&lt;br /&gt;
:You most likely will be losing a few more bytes in memory, but it's very much worth it for the speed... and you've already saved much speed by doing the tricks above ;-)&lt;br /&gt;
;Get Returns on your IfThens, Fors, etc.:Each time you do an If-Then statement or a For( statement (among others), when the calc is &amp;quot;waiting&amp;quot; for an End statement, these conditions are taking up memory, which, after a while, slow down your BASIC programs. However, the benefit is that this is only the case, as long as your program is running... as soon as the calculator returns to the homescreen, these used memory is cleared again and you are ready to go at it again. The benefit of this is that when the calculator encounters a Return statement in a BASIC program, it &amp;quot;cancels&amp;quot; any conditions for its waiting for an End.&lt;br /&gt;
;Avoid storing to vars in a loop:Brandon Green writes in his BASIC Guru Online that his experiments have led to the conclusion that storing variables is a prime cause of slowdowns in TI-BASIC programs.  Therefore, try to restructure your code so as to avoid using the â†’ as much as possible.&lt;br /&gt;
&lt;br /&gt;
==Graphical Touches==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc.  Normally, you do something like this:&lt;br /&gt;
 :Text(15,10,&amp;quot;MY TEXT&lt;br /&gt;
:following this, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row, in the 10th column, in the small font... however, try adding a &amp;quot;-1&amp;quot; (without the quotation marks) as the first argument...&lt;br /&gt;
 :Text(-1,15,10,&amp;quot;MY TEXT&lt;br /&gt;
:This time, the text &amp;quot;MY TEXT&amp;quot; will be written on the 15th row in the 10th column, in the LARGE font&lt;br /&gt;
;Write blank spaces to the graph screen when needing to erase stuff:as long as what you are trying to erase is at least 6 pixels high, it is srongly recommeded that you use the Text( command to write blank spaces to the screen instead of creating a Line(A,B,C,D,0 loop.  This is because to write a line, white or black, the calculator needs to do a lot of math to convert the X and Y coordinates into pixel coordinates, while writing text to the screen is almost at the same speed as it would take to draw a sprite to the screen in any asm program (since for the calc, text chars are just sprites) and so writing (blank) text to clear the screen is much faster.&lt;br /&gt;
;Try drawing graphics to the screen using text instead of lines: With access to the lowercase letters, as well as the Catalog menu, it is possible to draw graphics to the screen using text. For example, to draw a heart for a Zelda game would be much faster if you do something like the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:&amp;quot;vQ6Qv  &amp;quot;&lt;br /&gt;
:For(X,1,7&lt;br /&gt;
:Text(10,9+X,sub(Ans,X,1&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Another typical example is that of &amp;quot;drawing&amp;quot; a status bar to the screen using something such as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(P is the percent to be shaded in)&lt;br /&gt;
(L is the length of the bar in pixels)&lt;br /&gt;
(H is the horizontal position)&lt;br /&gt;
(V is the vertical position, using the top-left corner of the screen as point 0,0)&lt;br /&gt;
:Text(V,H,&amp;quot;(&lt;br /&gt;
:For(X,0,PL/100&lt;br /&gt;
:Text(V,H+X+1,&amp;quot;8&lt;br /&gt;
:End&lt;br /&gt;
:For(X,1,(100-P)L/100&lt;br /&gt;
:Text(V,H+PL/100+X,&amp;quot;)&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Using this technique, small graphics such as these can be drawn much faster than if we tried to draw them using lines and/or pixels and/or points.&lt;br /&gt;
;Simplify your Life:Save a GDB at the beginning of your program. &amp;quot;Graph Databases (GDBs) are useful storage centers of graph informaiton. This means that it saves not only the Zoom settings, but also Axes on/off, coord on/off, and the Y= equations. Using these can reduce the size of your program.&amp;quot; (quoted from http://web.archive.org/web/20021020121625/www.kevtiva.com/calc/gdb.htm) Turn off the axes with AxesOff, turn off functions with FuncOff, and set the Window to Xmin=0, Xmax=94, Xscl=8, Ymin=-62, Ymax=0, Yscl=8.  When your program is exiting, have it reset the previous GDB so that you don't mess up the gamer's graph settings.  &amp;lt;!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... --&amp;gt;While debugging your graphics, moving your cursor on the graph screen will now tell you both the pixel coordinates, as well as the point coordinates since you have synchronized them. http://www.meebo.com//skin/default/img/emoticons/big_smile.gif&lt;br /&gt;
;Convert Pts into Pxls:If you have not used the previous tip, it is important to know that the coordinates you give to any Pt command will be different from those you give to any Pxl command (if you want to use, say Pt-On/Pt-Off, with Pxl-Test).  The reason for this is that Pt commands take your window settings into account, while Pxl commands don't.Here is one set of formulas you can use to convert your Pt coordinates into Pxl coordinates:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;round(94X/(Xmax-Xmin)+47,0)-&amp;gt;A&lt;br /&gt;
round(-62Y/(Ymax-Ymin)+31,0)-&amp;gt;B&lt;br /&gt;
 -RobbieMc&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:With this formula, the Pxl command is Pxl-XX(B,A), where XX is On, Off, Test, or Change. Another formula can be found in the Ans your answers section of Cool Hacks. http://meebo.com/skin/default/img/emoticons/smile.gif&lt;br /&gt;
;Get rid of the &amp;quot;Done&amp;quot;:Use the following right before your program exits to avoid having the calc display the &amp;quot;Done&amp;quot; text on the homescreen&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:ClrHome&lt;br /&gt;
:&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:When used immediately before a &amp;quot;Stop&amp;quot; token, &amp;quot;Done&amp;quot; is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use &amp;lt;code&amp;gt;Output(1,1,&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;Get rid of the RunIndic:On the homescreen, do &amp;lt;code&amp;gt;Output(1,16,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. On the graph screen, do &amp;lt;code&amp;gt;Text(-1,0,90,&amp;quot;_&amp;lt;/code&amp;gt; in the loop that is displaying the run indicator. (_ in this context refers to the space character.)&lt;br /&gt;
&lt;br /&gt;
==Cool Hacks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have &amp;quot; and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a &amp;quot; and the store arrow at the homescreen and press enter. An error message will appear; choose to Quit.  Press [Y=] and go to Y1. Press [2nd] [ENTER] to paste the previous homescreen entry into Y1. Press [2nd] [MODE] to {ESC}. At the homescreen, type Equ&amp;gt;Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the &amp;quot; quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif&lt;br /&gt;
;If condition&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;End:This will need a bigger explanation, but in short, you can have a conditional End statement that helps your loops run faster by only executing the End statement if needed. The reason this works is because you didn't use a Then statement: an If followed by a single non-Then statement is interpreted as an If with no Else clause and the single statement as the equivalent of the Then clause, even if the statement is End.  You can therefore also insert comments into your code (which is not recommended for BASIC unless you're still debugging it) by doing If 0:Whatever. For instance:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(untested...)(lines are numbered)&lt;br /&gt;
01:For(X,0,1&lt;br /&gt;
02:getKeyâ†’K&lt;br /&gt;
03:Kâ†’X&lt;br /&gt;
04:If not(Ans&lt;br /&gt;
05:End&lt;br /&gt;
06:0â†’X&lt;br /&gt;
07:&amp;quot;-&lt;br /&gt;
08:If K=25&lt;br /&gt;
09:&amp;quot;LEFT&lt;br /&gt;
10:If K=26&lt;br /&gt;
11:&amp;quot;UP&lt;br /&gt;
12:If K=27&lt;br /&gt;
13:&amp;quot;RIGHT&lt;br /&gt;
14:If K=34&lt;br /&gt;
15:&amp;quot;DOWN&lt;br /&gt;
16:If K=45&lt;br /&gt;
17:&amp;quot;CLEAR&lt;br /&gt;
18:If Ans=&amp;quot;-&lt;br /&gt;
19:End&lt;br /&gt;
20:Disp Ans&lt;br /&gt;
21:If K=45&lt;br /&gt;
22:1â†’X&lt;br /&gt;
23:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:Explanation: Lines 1-2 are normal. Line 3 resets X if there was no key, which will loop back to the For( statement, or allow the routine to continue if there WAS a key. The answer from the getKey is in Ans, so if no key was pressed, Line 5 will be executed, which loops back to Line 1 without wasting any more time. http://www.meebo.com//skin/default/img/emoticons/smile.gif ... If a key was pressed, X is reset, which will cause the routine to loop back to the For( statement the next time it encounters an End statement. If the condition in Line 4 is not met, it automatically skips to Line 6. The string &amp;quot;-&amp;quot; is stored in Ans. We then go into a series of checks looking for any of the arrow keys, and changing Ans to reflect that. Line 8 is executed, and if the condition is not met, it skips to Line 10; if that condition is not met, it skips to Line 12; if that condition is not met, it skips to Line 14; if that condition is not met, it skips to Line 16; if that condition is not met, it skips to Line 18.  Then, it checks the Ans var.  If the Ans var is still unchanged, then none of the keys we are looking for have been found, so we End, which we've already said will loop back to the For( statement, essentially beginning the getKey loop once more. If Ans is different, then one of our keys was found, so we Disp the value in Ans (which is a String). We then check to see if it was the [CLEAR] key., and if it was, we set X so that the next End statement that is encountered will essentially close the loop and the routine will continue beyond this part of the code. We then End, which checks the value of X.  If X is 0, it loops back to the For( statement, recommencing the whole loop, but if X is 1, it &amp;quot;closes&amp;quot; the loop, forgets about it completely, and moves on with its life. Thus can you build in looping conditions into your programs without having to use Lbl or Goto statements. http://www.meebo.com//skin/default/img/emoticons/cool.gif&lt;br /&gt;
;Ans your answers:the Ans var is, IMHO, the most useful yet most unsafe var on the whole calculator because it can be so many different variable types (real, complex, list, matrix, string)... One way to reduce the number of varables you're using in your program is to carefully structure your program so that it stores as much information into the Ans var as possible. One way to do this is to setup Ans to be a list, say {3,1,4,2,5}. Doing Ans(4) is not going to multiply each value in the list by four, but rather going to give you the 4th value in the list:2. This happens because the OS will treat the Ans variable exactly the same as if it were L1 or any other list variable. I've already demonstrated that the Ans var can be used to keep track of whether one of the keys we were looking for was found or not, but there are other things you can do with the Ans var (as long as you're careful not to change the value in Ans unintentionally).  For instance, doing {Ans(2),Ans(4),Ans(1),Ans(3),Ans(5) will change Ans to be the list {1,2,3,4,5}... Note that the Ans var is changed AFTER the whole command has been executed.  There will probably be more examples of using Ans in a program at a later date.  Therefore, you can do something like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(50% tested)&lt;br /&gt;
(to convert from Pt coordinates to Pxl coordinates)&lt;br /&gt;
A is the X-coord&lt;br /&gt;
B is the Y-coord&lt;br /&gt;
&lt;br /&gt;
{63/(Ymax-Ymin),95/(Xmax-Xmin&lt;br /&gt;
&lt;br /&gt;
;{pixels per Y, pixels per X&lt;br /&gt;
&lt;br /&gt;
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1&lt;br /&gt;
&lt;br /&gt;
;{Y,X,int ppY,int ppX&lt;br /&gt;
;Ans(1)Ans(3) is now the Pxl-Y&lt;br /&gt;
;Ans(2)Ans(4) is now the Pxl-X&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from  James Matthew's Asmguru.hlp&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:If 0&amp;lt;cos(9)&lt;br /&gt;
:Then&lt;br /&gt;
:Disp &amp;quot;Degree Mode&lt;br /&gt;
:Else&lt;br /&gt;
:Disp &amp;quot;Radian Mode&lt;br /&gt;
:End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Similarly, you can also use sin(&amp;amp;Pi;), which only returns 0 if in radian mode, to do something like:&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
If sin(&amp;amp;Pi;&lt;br /&gt;
Disp &amp;quot;Degree Mode&lt;br /&gt;
Else&lt;br /&gt;
Disp &amp;quot;Radian Mode&amp;quot;&lt;br /&gt;
End&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
;Ans as a list:It is possible to use the Ans variable as a list in replacement to using any of the real or complex variables.  The trick is knowing how to use the augment( and the seq( commands so that you won't be destroying Ans and inadvertedly converting it into something other than a list. '''NOTE: '''extensive usage of this, as in the case of replacing all variables from a program can/will slow down the program, as well as use up more memory than if you just used variables. A shellsort program using variables A,B,C,D,L,Z, and &amp;amp;theta; used up 143 bytes, while its variable-free counterpart used up 645 bytes and was significantly slower. However, this doesn't mean the technique is completely useless.&lt;br /&gt;
:*augment({1,2},{3,4}  will return {1,2,3,4}... it can only augment 2 lists at a time, so repeated usage will be necessary to maintain the Ans variable as a list&lt;br /&gt;
:*seq(formula,tempvar,start,end will return a list of what the formula evaluats to when the tempvar is (start-to-finish).  I think an example is necessary: seq(X^2,X,1,5 will For(X,1,5) evaluate X^2 and store that value to a list, thus producing {1,4,9,16,25}, without changing the value of X ;) &lt;br /&gt;
:We can therefore use seq(Ans(X),X,start,end as a list-equivalent to sub(String,start,len... using a sequence of augment( and seq( commands, we can therefore store values into specific Ans-list elements.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That returns the list {0,0,0,2,3,0,0,0}.&lt;br /&gt;
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;abs -1+1 would return 2 on a TI-82&lt;br /&gt;
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:and that one can therefore use the following to display whether the calc is an 82 or 83&lt;br /&gt;
 Text(0,0,&amp;quot;YOU HAVE A TI-&amp;quot;,83-.5(abs -1+1&lt;br /&gt;
==Miscellaneous==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
;Have conditions built into your formulas:This will probably need a better explanation, but I have found it useful to build certain conditions into my formulas, instead of having to write all those If statements... for instance, for piece-wise graphing, you can do Y=(X^2)(X&amp;gt;0)+(2X)(X&amp;lt;1), which is the same as If X&amp;gt;0:Y=X^2:If X&amp;lt;1:Y=2X ...right now, I can't really say what you'll be saving by doing this (memory/speed/etc) because I don't remember, but I can assure you this come quite in handy because you can then have one formula solve a variety of different problems, without the hassle of dealing with a lot of If-Then statements.  For example, if you were to save that formula as Y1, then you'd only need to do Y1(number) to have it do the whole sequence of conditionals. I consider this one of the more complicated tricks to implement (because one can easily get confused as to how to build it as well as to what conditions one is looking for) but I have found it to be extremely useful.  For example, let us say you write a text editor program in BASIC that allows the user to edit Str1, as displayed on the homescreen using Output(1,1,Str1.  However, you run into a problem when Str1 is longer than the 96 chars that fit on the homescreen, so you can, using the sub( and length( functions, you could have one line of code something like&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;:length(Str1&lt;br /&gt;
:Output(1,1,sub(Str1,1(Ans&amp;lt;96)+16frac(Ans/16)(Ans&amp;gt;95)+(16int(Ans/16)-80)(Ans&amp;gt;95),Ans+80-16int(Ans/16&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:should make the Output scroll up one line whenever the screen has been filled (untested, please verify).  What this line is saying is: give me from Str1, starting at the first byte if Str1 is smaller than 96 charachters, otherwise, calculate the beginning to be one &amp;quot;row&amp;quot; less than the total, and give me all the rest of the chars till the end.  If you could not follow that, don't worry, as that is what I meant when I said this is one of the harder tricks. If you did follow with what I was trying to do, Kudos to you!  Keep in mind that the conditions within the () can hold any of the condition-elements of If statements, i.e. and, not, or, =, â‰ , &amp;gt;, &amp;lt;, â‰¥, â‰¤.  BTW, this BASIC trick  does '''NOT''' work on the 89. I tried, but there I could not get the 89 to convert a binary operation into a numerical value, the way the z80s do. (I could be wrong about this working on all z80s... I've tested it on an 82 and an 83+)&lt;br /&gt;
;See program in MirageOS:If you want to see your program in a shell, like MirageOS, you must type the following code in the first line of the program:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;::&amp;quot;Description&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:That will show the program name with the description you typed.&lt;br /&gt;
;User-friendly Error Messages:(brought to you by Kevtiva Inc.) Write an error message to the screen before calling any subroutine programs, and have the subroutines program erase the error message. This way, if the subroutine program is missing, the user will be informed about the specifics of the problem. Example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;PROGRAM:MYSHELL&lt;br /&gt;
:program code&lt;br /&gt;
:Output(1,1,&amp;quot;ERR:prgmMYSUB MISSING&lt;br /&gt;
:prgmMYSUB&lt;br /&gt;
:more program code&lt;br /&gt;
&lt;br /&gt;
PROGRAM:MYSUB&lt;br /&gt;
:Output(1,1,&amp;quot;                     &amp;quot;&lt;br /&gt;
:The rest of program MYSUB.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]&lt;br /&gt;
&lt;br /&gt;
'''TI-Basic Developer'''&lt;br /&gt;
[http://tibasicdev.wikidot.com]&lt;br /&gt;
&lt;br /&gt;
==Special Thanks==&amp;lt;!-- â†’â‰ â‰¤â‰¥ --&amp;gt;&lt;br /&gt;
Special thanks to:&lt;br /&gt;
&lt;br /&gt;
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* Â© 2000 Kevtiva Interactive]&lt;br /&gt;
&lt;br /&gt;
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright Â© 2000-2006 BASIC Guru Online. All Rights Reserved.]&lt;br /&gt;
&lt;br /&gt;
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ Â© 2000-2006 Detached Solutions]&lt;/div&gt;</summary>
		<author><name>Bfr</name></author>	</entry>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=Programming_under_Unix-like_operating_systems</id>
		<title>Programming under Unix-like operating systems</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=Programming_under_Unix-like_operating_systems"/>
				<updated>2008-07-26T04:51:46Z</updated>
		
		<summary type="html">&lt;p&gt;Bfr: /* SPASM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here are the different tools at your disposal:&lt;br /&gt;
&lt;br /&gt;
= General Overviews =&lt;br /&gt;
&lt;br /&gt;
==Emulators==&lt;br /&gt;
* [http://lpg.ticalc.org/prj_tilem/ TilEm]&lt;br /&gt;
* VirtualTI through wine&lt;br /&gt;
* [[PindurTI]] through Wine&lt;br /&gt;
* [[PindurTI]] in non-interactive mode (with or without [http://kvince83.tengun.net/maxboard/viewtopic.php?t=2466 PTI frontend])&lt;br /&gt;
&lt;br /&gt;
==Syntax highlighting==&lt;br /&gt;
Several editors have native or extensional support for editing Z80 assembly code with syntax highlighting:&lt;br /&gt;
* Kwrite and Kate can be made to syntax-highlight Z80 assembly with [http://www.ticalc.org/archives/files/fileinfo/391/39178.html the appropriate definition file].  The file must be placed in /usr/share/apps/katepart/syntax .&lt;br /&gt;
* SciTE and Emacs both have native modes for assembly code.  For Emacs, one must make sure to turn on Font Lock mode as well.&lt;br /&gt;
* The [http://www.revsoft.org/phpBB2/viewforum.php?f=25 Z80 Assembly IDE] has simple syntax highlighting built-in.&lt;br /&gt;
* Users of Vim and WLA DX can use [http://sigma.unitedti.org/files/misc/z80.vim.bz2 this syntax file].&lt;br /&gt;
&lt;br /&gt;
== Assembling ==&lt;br /&gt;
&lt;br /&gt;
=== SPASM ===&lt;br /&gt;
&lt;br /&gt;
'''Author''': Spencer Putt&lt;br /&gt;
&lt;br /&gt;
'''Home Page''': [http://www.revsoft.org/phpBB2/viewforum.php?f=21 http://www.revsoft.org/phpBB2/viewforum.php?f=21]&lt;br /&gt;
&lt;br /&gt;
SPASM is a portable Z80 assembler released under the GPL.  Its distinguishing features are extremely fast assembly and powerful macro support.  The output is only available in binary form, however with the use of [http://www.revsoft.org/phpBB2/viewforum.php?f=23 Wabbitsign], written by James Montelongo and Spencer Putt, it can easily be converted to any desired program type.&lt;br /&gt;
&lt;br /&gt;
 assembler foo.asm foo.bin&lt;br /&gt;
 wabbit foo.bin foo.8xp&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SPASM and Wabbitsign are included in [http://www.ticalc.org/archives/files/fileinfo/390/39009.html Z80 Assembly IDE 1.32] by burntfuse&lt;br /&gt;
&lt;br /&gt;
=== tpasm ===&lt;br /&gt;
&lt;br /&gt;
'''Author''': Todd Squires&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://www.sqrt.com/ http://www.sqrt.com/]&lt;br /&gt;
&lt;br /&gt;
tpasm is a Free (GPL) assembler which supports the Z80 as well as the 6805, 6809, 68HC11, 6502, Sunplus, 8051, PIC, and AVR.  It uses syntax very similar to ZMASM.&lt;br /&gt;
&lt;br /&gt;
tpasm 1.2 does not support binary file output, but you can use ''objcopy'' (from the GNU binutils package) to convert its Intel Hex output into binary; e.g.&lt;br /&gt;
&lt;br /&gt;
 tpasm foo.asm -o intel foo.hex -l foo.lst&lt;br /&gt;
 objcopy -I ihex foo.hex -O binary foo.bin&lt;br /&gt;
&lt;br /&gt;
=== ASxxxx ===&lt;br /&gt;
&lt;br /&gt;
'''Author''': Alan R. Baldwin&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://shop-pdp.kent.edu/ashtml/asxxxx.htm http://shop-pdp.kent.edu/ashtml/asxxxx.htm]&lt;br /&gt;
&lt;br /&gt;
ASxxxx is a freeware assembler which supports the Z80 along with a large variety of other processors.  It more closely resembles a modern PC assembler than a typical Z80 assembler, as it assembles each file into a relocatable object format which can then be linked with other files to produce the complete program.  The linking is done by a separate program called ASlink (included with the package.)&lt;br /&gt;
&lt;br /&gt;
To assemble and link a simple program you might do something like&lt;br /&gt;
&lt;br /&gt;
 asz80 -plogff foo.asm&lt;br /&gt;
 aslink -u -b _CODE=0x9D95 -i foo.ihx foo.rel&lt;br /&gt;
 objcopy -I ihex foo.ihx -O binary foo.bin&lt;br /&gt;
&lt;br /&gt;
Note that the syntax is rather different from that of most Z80 assemblers.  The important differences are&lt;br /&gt;
* Immediate values are marked with #.&lt;br /&gt;
* Indexed memory access is written as N(ix) rather than (ix+N).&lt;br /&gt;
* Constants are written differently: 0xAA, 0hAA, or $$AA for hexadecimal; 0o252, 0q252, or $&amp;amp;252 for octal; 0b10101010 or $%10101010 for binary.&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
 ld hl,#str_hello&lt;br /&gt;
 add a,3(ix)&lt;br /&gt;
 xor #0x0f&lt;br /&gt;
&lt;br /&gt;
There is also a modified version of ASxxxx distributed with the [http://sdcc.sf.net/ Small Device C Compiler].  This version is, if anything, more confusing to use due to the poorly-documented changes made by the SDCC team.&lt;br /&gt;
&lt;br /&gt;
=== TASM ===&lt;br /&gt;
&lt;br /&gt;
'''Author''': Thomas N. Anderson&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://home.comcast.net/~tasm/ http://home.comcast.net/~tasm/]&lt;br /&gt;
&lt;br /&gt;
TASM is a shareware assembler which also supports a variety of processors.&lt;br /&gt;
&lt;br /&gt;
There are several ways that you can use tasm under Linux:&lt;br /&gt;
* The TASM 3.1 for Linux shareware release is still in the wild.  To use this you will need to enable &amp;quot;a.out&amp;quot; support in your kernel (it may be available as the module ''binfmt_aout''.)  You will also need to obtain the ancient Linux libc version 4 (''not'' glibc) which can be found [http://ftp.linux.org.uk/pub/linux/libc/ here].&lt;br /&gt;
* You can use TASM 3.2 for Windows with [http://www.winehq.com Wine].&lt;br /&gt;
* You can pay the $40 and compile it yourself on the platform of your choice.&lt;br /&gt;
&lt;br /&gt;
=== Brass ===&lt;br /&gt;
'''Author''': benryves&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://benryves.com/bin/brass/ http://benryves.com/bin/brass/]&lt;br /&gt;
&lt;br /&gt;
Brass runs under Linux thanks to Mono.&lt;br /&gt;
&lt;br /&gt;
=== Zasm ===&lt;br /&gt;
'''Author''': Steven Deprez&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://lpg.ticalc.org/prj_zasm/index.html http://lpg.ticalc.org/prj_zasm/index.html]&lt;br /&gt;
&lt;br /&gt;
Zasm is an open source assembler that is almost fully compatible with Tasm and ZDS.&lt;br /&gt;
&lt;br /&gt;
=== WLA DX ===&lt;br /&gt;
'''Author''': Ville Helin&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://www.villehelin.com/wla.html http://www.villehelin.com/wla.html]&lt;br /&gt;
&lt;br /&gt;
WLA DX is another open-source (GNU GPL) cross-assembler with a primary focus on targeting video game consoles. It is a high-powered assembler with a wide variety of features such as, e.g. separate compilation, POSIX-like file I/O, and code sectioning. However it is cumbersome when assembling small projects, and semantics are unorthodox compared to other assemblers. (~ is the XOR operator, macro arguments are passed by value, etc.).&lt;br /&gt;
&lt;br /&gt;
WLA DX has had an influence in the development of Brass.&lt;br /&gt;
&lt;br /&gt;
=== Pasmo ===&lt;br /&gt;
'''Author''': Juli&amp;amp;aacute;n Albo&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://www.arrakis.es/~ninsesabe/pasmo/ http://www.arrakis.es/~ninsesabe/pasmo/]&lt;br /&gt;
&lt;br /&gt;
Pasmo is another standalone Z80 cross-assembler with basic macro support, but without the ability to generate&lt;br /&gt;
relocatable object files.  It is licensed under the GNU GPL, and exists as the package &amp;lt;tt&amp;gt;pasmo&amp;lt;/tt&amp;gt; in the Debian pool.&lt;br /&gt;
&lt;br /&gt;
=== z80asm ===&lt;br /&gt;
'''Author''': Bas Wijnen&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://savannah.nongnu.org/projects/z80asm/ http://savannah.nongnu.org/projects/z80asm/]&lt;br /&gt;
&lt;br /&gt;
z80asm is a standalone Z80 cross-assembler similar in nature to Pasmo, in that it has macro support but cannot generate relocatable object files.  It too is licensed under the GNU GPL (version 2 or later), and exists as the package &amp;lt;tt&amp;gt;z80asm&amp;lt;/tt&amp;gt; in the Debian pool.&lt;br /&gt;
&lt;br /&gt;
=== GNU as ===&lt;br /&gt;
'''Author''': the GNU binutils team&lt;br /&gt;
&lt;br /&gt;
'''Home page''': [http://www.gnu.org/software/binutils/ http://www.gnu.org/software/binutils/]&lt;br /&gt;
&lt;br /&gt;
Starting from version 2.17, the GNU assembler, part of the binutils package, is capable of cross-assembling Z80 code when configured for it at compile-time, such as with &amp;lt;tt&amp;gt;--target=z80-unknown-coff&amp;lt;/tt&amp;gt;.  binutils includes a powerful assembler and linker both, along with various utilities for handling object files, such as objcopy and objdump; for Z80, COFF is used for relocatable objects, with raw binary and Intel hex formats also supported.  While this is probably one of the more powerful tools in the list for Z80 development, it also requires more work to start with, as the traditional way to get a cross-assembling binutils is to compile it oneself.  Being a GNU package, binutils is naturally licensed under the GNU GPL (version 2 or later).  Prepackaged binary versions of binutils are very common, but usually do not have cross-assembling capability.&lt;br /&gt;
&lt;br /&gt;
==Sending programs to the calc==&lt;br /&gt;
* [http://www.ticalc.org/archives/files/fileinfo/374/37480.html TiLP-II] (requires [http://www.ticalc.org/archives/files/fileinfo/374/37479.html tilibs])&lt;br /&gt;
* [http://www.ticalc.org/archives/files/fileinfo/75/7588.html titranz] : commandline tool, only works for TI-83/TI-83+&lt;br /&gt;
&lt;br /&gt;
= FreeBSD =&lt;br /&gt;
Much of the aforementioned software should compile independently without problem or with minor tweaking under FreeBSD, but it is best to utilize the ports collection whenever possible. Unfortunately, the current state of calculator-related software in the FreeBSD Ports Collection is lacking in variety.&lt;br /&gt;
&lt;br /&gt;
* Development&lt;br /&gt;
{| width=&amp;quot;75%&amp;quot; class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot;&lt;br /&gt;
!Port !! Current Version !! Location&lt;br /&gt;
|-&lt;br /&gt;
|tpasm || 1.2_1 || devel/tpasm&lt;br /&gt;
|-&lt;br /&gt;
|z80asm || 1.6_1 || devel/z80asm&lt;br /&gt;
|-&lt;br /&gt;
|z80-asm || 0.1_1 || devel/z80-asm&lt;br /&gt;
|-&lt;br /&gt;
|TI-GCC || 0.96.b8 || devel/tigcc&lt;br /&gt;
|-&lt;br /&gt;
|libtifiles2 || 1.0.1 || devel/libtifiles2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Communications&lt;br /&gt;
{| width=&amp;quot;75%&amp;quot; class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot;&lt;br /&gt;
!Port !! Current Version !! Location&lt;br /&gt;
|-&lt;br /&gt;
|TiLP-II || 1.01 || comms/tilp2&lt;br /&gt;
|-&lt;br /&gt;
|libticables2 || 1.0.2 || comms/libticables2&lt;br /&gt;
|-&lt;br /&gt;
|libticalcs2 || 1.0.1 || comms/libticalcs2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Converters&lt;br /&gt;
{| width=&amp;quot;75%&amp;quot; class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot;&lt;br /&gt;
!Port !! Current Version !! Location&lt;br /&gt;
|-&lt;br /&gt;
|libticonv || 1.0.0 || converters/libticonv&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Emulation&lt;br /&gt;
{| width=&amp;quot;75%&amp;quot; class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot;&lt;br /&gt;
!Port !! Current Version !! Location&lt;br /&gt;
|-&lt;br /&gt;
| TIEmu 2 || 2.08 || emulators/tiemu2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Mac OS X =&lt;br /&gt;
(Note that all of these assesments were made on a MacBook running 10.4.9 Intel. Mileage may vary on other versions and of course the Darwine stuff won't work on PPC.)&lt;br /&gt;
&lt;br /&gt;
TiLP-II is known to compile and work properly with SilverLink and Direct USB cables with the 83+, 84+SE, and 89Ti, so there is no reason to believe it will not work with the other calculators. TI Connect X works well enough on Intel Macs even though it is not officially supported, however it seems to be more strict with the format of .8xk files than TiLP or TI Connect (Windows).&lt;br /&gt;
&lt;br /&gt;
Brass works in Mono. Wabbitspasm compiles and works properly. ZDS works in Darwine.&lt;br /&gt;
&lt;br /&gt;
TilEm compiles but seems to have some issues with multiple ROM versions. It is unclear to me if this is a problem with the build or TilEm itself. PindurTI is somewhat usable in Darwine: You must use the send.exe utility to send the ROM image, then it will emulate properly. However, it makes extensive use of the F-keys, including the ExposÃ© ones. Remapping the ExposÃ© keys is the only solution. TI FLASH Debugger runs in Darwine but the calculator windows are unskinned: You must either use the keyboard or click blindly in the window. The display output is fine, and other debugger windows appear to function properly. VirtualTI (2.5) should run OK after putting the ROM files somewhere Darwine knows about (I was lazy).&lt;br /&gt;
&lt;br /&gt;
= Other Unixes =&lt;br /&gt;
&amp;lt;!--Replace with specific distributions as appropriate --&amp;gt;&lt;br /&gt;
This section is a stub. Please add it it.&lt;/div&gt;</summary>
		<author><name>Bfr</name></author>	</entry>

	</feed>