https://wikiti.brandonw.net/api.php?action=feedcontributions&user=Saibot84&feedformat=atom
WikiTI - User contributions [en]
2024-03-28T20:53:37Z
User contributions
MediaWiki 1.23.5
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2007-12-29T00:16:30Z
<p>Saibot84: minor updates</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://mcimino.reaktix.com Contact Me]<br />
<br />
=Projects Under Development=<br />
;Nostalgy, aka ReaktixOS, aka ReOS:new 3rd party operating system.<br />
:currently being rewritten for compilation with [http://www.revsoft.org/phpBB2/viewtopic.php?t=652 Wabbitspasm]<br />
:'''Current features:'''<br />
:*Version: 0.2.4-usi<br />
:*OS loader<br />
:*IM1<br />
::*poweroff/on<br />
::*[ON]-hotkey menu<br />
::*holding [ON] pauses the currently running routine/program until it is either released (which powersoff the calc) or until another key is pressed, which invokes that hotkey, if it exists.<br />
::*[ON]+[+] raises the contrast and [ON]+[-] lowers the contrast<br />
:*Task switching environment (tasks can be paused and resumed) (inspired by Radical Software's TSE, by Robin Kay, Michael Vincent)<br />
::*5 tasks are supported (2 system tasks + 3 user tasks) <br />
::*can continue a task from it's last PC or<br />
::*can return to an address provided by the task<br />
::*saves and restores registers for each task<br />
::*saves and restores the stack for each task<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*crude versions of a "run indicator"<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Mathematical system calls<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon receiving<br />
::*Networking: made capable by Timendus' CLAP<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
none<br />
<br />
=Abandoned Projects=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Ports:09
Talk:83Plus:Ports:09
2007-12-27T19:52:48Z
<p>Saibot84: question abt 84+SE</p>
<hr />
<div>==84+SE==<br />
According to the comments section, this port only exists on the 83+SE and 84+. Was the exclusion of the 84+SE intentional? If the answer is unknown, since I have an 84+SE, is there a way I can verify this with my calc w/o crashing it? [[User:Saibot84|Saibot84]] 11:52, 27 December 2007 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Ports:08
Talk:83Plus:Ports:08
2007-12-27T19:49:57Z
<p>Saibot84: </p>
<hr />
<div>==Interrupts==<br />
If the link assistant generates interrupts, does that mean that one needs to setup an IM2 interrupt routine to handle them or is there another way to use it? [[User:Saibot84|Saibot84]] 11:49, 27 December 2007 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:08
83Plus:Ports:08
2007-12-27T19:42:30Z
<p>Saibot84: contradiction with Interrupts section</p>
<hr />
<div>[[Category:83Plus:Ports:By_Address|08 - Link Assist Enable]] [[Category:83Plus:Ports:By_Name|Link Assist Enable]]<br />
== Synopsis ==<br />
'''Port Number:''' 08h<br />
<br />
'''Function:''' Link Assist Enable<br />
<br />
This port controls whether the hardware link assist is enabled. It also controls what interrupts the link assist will generate.<br />
<br />
=== Read Values ===<br />
* Bit 0: 1 if link assist will generate an interrupt when a byte is received. (Link assist must be enabled)<br />
* Bit 1: 1 if link assist will generate an interrupt when a byte can be sent. (Link assist must be enabled)<br />
* Bit 2: 1 if link assist will generate an interrupt when an error has occurred. (Link assist must be enabled)<br />
* Bit 7: 1 if the link assist is disabled.<br />
<br />
=== Write Values ===<br />
* Bit 0: Set to generate an interrupt when link assist receives a byte. (Link assist must be enabled)<br />
* Bit 1: Set to generate an interrupt when link assist is able to send byte. (Link assist must be enabled)<br />
* Bit 2: Set to generate an interrupt when an error occurs. (Link assist must be enabled)<br />
* Bit 7: 1 to disable the link assist.<br />
<br />
<br />
== Comments ==<br />
This port only exists on the 83+ SE and the 84+.<br />
<br />
Programs which directly control the link port should disable the hardware assist.<br />
<br />
The timeout for the link assist is ~2 seconds.<br />
<br />
<br />
===Interrupts===<br />
Link Assist hardware can generate an interrupt when a byte is received, when a byte can be sent or when an error in transmission occurs.<br />
<br />
<br />
To enable an interrupt when a byte is received write 01 to port 08. When a byte received and an interrupt is generated bit 0 of port 9 is set. Like all interrupts this one needs to be acknowledged, do this by reading the byte from port 0A.<br />
<br />
<br />
To enable an interrupt when a byte can be sent write 2 to port 08. When the the link assist is not busy it will generate an interrupt so you can send data. Bit 1 of port 9 is set when this interrupt generates. You acknowledge this interrupt by writing to port 0D.<br />
<br />
<br />
To enable an interrupt when an error occurs have bit 2 set when you write to port 08. It is not necessary to have the the other link assist interrupts enabled but you can. When this interrupt generates bit 2 of port 9 is set, and it is acknowledged by reading port 9.<br />
<br />
<br />
The biggest benefit from the link assist interrupts is that no time must wasted waiting, it could take millisecond to send or receive a byte. With interrupts that time can be put to more useful code. I don't believe that you should have both the send and receive interrupts enabled at the same. But really communication would dictate who is sending and receiving. Remember that TI-OS does not seem to handle these interrupts, disable them when you're through.<br />
<br />
== Credits and Contributions ==<br />
* '''Michael Vincent:''' Original documentation of the link assist<br />
* '''James Montelongo:''' Interrupt information</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Ports:01
Talk:83Plus:Ports:01
2007-06-02T04:48:28Z
<p>Saibot84: seeking confirmation</p>
<hr />
<div>==reset needed==<br />
From my experimentation with PindurTI, it seems to me that it is impossible to poll more than one group without reseting the keyport in betweeen. Being that I have never tested any direct key input routines. I know the directin routine from MirageOS resets before polling, and LearnAsm28d merely says that one "should" reset the port before switching groups. I hesitate to add this to the comments section without further confirmation. [[User:Saibot84|Saibot84]] 21:48, 1 June 2007 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:TIOS_Alternatives
83Plus:OS:TIOS Alternatives
2007-05-28T21:24:38Z
<p>Saibot84: updates</p>
<hr />
<div>[[Category:83Plus:OS_Information|TIOS Alternatives]]<br />
<br />
== Introduction ==<br />
<br />
The TIOS is the official, standard operating system for the<br />
TI-83+ series of calculators (including the TI-83+ and TI-84+ and the respective Silver<br />
Editions of each). The vast majority of programs for such calculators run on top of the<br />
TIOS, or on top of some subsidiary program that runs from the TIOS, and thereby implicitly<br />
depend on its functionality. However, some people have researched writing alternative<br />
operating system code and sending it to the calculator to replace the TIOS.<br />
Several such alternative operating systems are available on the Web, though most of them are<br />
not yet at a production stage of development.<br />
<br />
== List of alternative operating systems ==<br />
<br />
*[http://michaelv.org/programs/calcs/ceptic.php CEPTIC], by Michael Vincent: a Control and Execute Program for TI Calculators. The current version of CEPTIC only runs on the TI-83+ SE, but can be modified to run on the TI-83+. Assembly source is available, but actually using the OS in its present state is considered non-practical, and the project has been discontinued for various reasons.<br />
*[http://pongos.sourceforge.net/ PongOS], by FloppusMaximus: a simple, proof-of-concept system whose namesake feature is an embedded Pong game. Some other system utilities, mostly inspired by Dan Englender's Calcsys, are also available in PongOS, including a hex editor, memory mover (with flash capability), flash sector eraser, and port monitor. Link support is not provided.<br />
*[http://vera.sourceforge.net Vera], by several members of different programming groups: dubbed the "true calc lover's OS" on the website. Vera is intended to consist of a very basic kernel which can be easily extended to include desired features. Vera is still in the planning stage as of 2007-02-09, but seems to have been abandoned.<br />
*[http://www.ticalc.org/archives/files/fileinfo/349/34973.html CSX], by Sean McLaughlin: a command-line-based operating system with a screen layout similar to that of the TI-89 calculators. CSX provides a simple filesystem, send and receive of files over a link cable, hex editing of memory, and running of Z80 machine code programs.<br />
*[http://forum.reaktix.com/viewtopic.php?pid=11 Nostalgy], originally by [http://katpro.xiondigital.net/ XDG Kat-Productions], now developed by [http://reaktix.com/ Reaktix Software]: an unofficial project started by XDG Kat-Productions, abandoned when the two main developers became involved in other projects, and later resumed by [[User:Saibot84|Saibot84]]. A pre-alpha working demo is available. Development is still underway, albeit extremely slowly. It currently features a task-switching environment inspired by [http://www.radicalsoft.org/ Radical Software's] TSE, although linking and a file system are not yet implemented.<br />
*[http://lifos.sourceforge.net/ LIFOS], by Peter Marheine: a similar project to Vera, designed to offer minimal functionality (linking, memory management, and machine code execution) in its basic incarnation but meant to be easily extended into a near-seamless infrastructure of various functions. Currently (5-28-07) in early alpha stages. The name comes from the memory allocation system (LIFO OS, or LIFOs).<br />
*[http://www.ticalc.org/archives/files/fileinfo/398/39863.html BAOS], by Erik van 't Wout: Basic Assembly Operating System. (excerpt from the ReadMe:) Being developed "to be a real Operating System for TI-83+ based calculators. It should turn your calculator into a real computer, which can be used for mathematical purposes, but not as main target. Additional functionality should be easy to implement trough the use of libraries."</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Category:Z80_Routines:Memory
Category:Z80 Routines:Memory
2007-04-12T05:20:14Z
<p>Saibot84: this page was missing...</p>
<hr />
<div>{{stub}}<br />
<br />
[[Category:Z80 Routines|Memory]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Basic:Routines:DecToFrac
Talk:83Plus:Basic:Routines:DecToFrac
2007-04-11T13:50:26Z
<p>Saibot84: why not erase my code?</p>
<hr />
<div>== Salute ==<br />
@calc84maniac: Sweet routine. I salute your superior programming skills. I avoid using While loops, but your routine is definitely shorter and sweeter than mine. :-) --[[User:Saibot84|Saibot84]] 06:48, 11 April 2007 (PDT)<br />
<br />
== Question ==<br />
Anyone see any reason to keep my code here? --[[User:Saibot84|Saibot84]] 06:50, 11 April 2007 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Basic:Routines:DecToFrac
Talk:83Plus:Basic:Routines:DecToFrac
2007-04-11T13:48:45Z
<p>Saibot84: salute superior skillz</p>
<hr />
<div>== Salute ==<br />
@calc84maniac: Sweet routine. I salute your superior programming skills. I avoid using While loops, but your routine is definitely shorter and sweeter than mine. :-) --[[User:Saibot84|Saibot84]] 06:48, 11 April 2007 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Routines:DecToFrac
83Plus:Basic:Routines:DecToFrac
2007-04-11T13:40:38Z
<p>Saibot84: forgot an "End" in my slower, larger routine</p>
<hr />
<div>[[Category:83Plus:Basic|Decimal To Fraction Conversion]]<br />
[[Category:83Plus:Basic:Routines|Decimal To Fraction Conversion]]<br />
<!-- →≠≤≥ --><br />
Saibot84's routine:<br />
<nowiki>code ;comment<br />
<br />
;K can be any real value<br />
<br />
1&ne;round(fPart(K),9 ;check for calc thinking the fractional part=1<br />
K(Ans)+not(Ans)(1+int(K ;if fPart=1, then Ans=int(K)+1, else, Ans=K<br />
{Ans,1&rarr;L1 ;L1={numerator,denominator<br />
If fPart(L1(1 ;if there's a fPart to the numerator...<br />
Then<br />
{K&rarr;L1 ;leave just the numerator in L1<br />
For(C,0,1 ;initiate a loop<br />
If 1=round(fPart(L1(dim(L1))),9 ;if the fPart of the last element of L1=1...<br />
1+int(L1(dim(L1&rarr;L1(dim(L1 ;the last element of L1=int(last element of L1)+1<br />
augment(L1,{fPart(L1(dim(L1)))^(-1 ;append the inverse of the fPart(last element of L1) to L1<br />
0&rarr;C ;force the For loop to repeat upon next End<br />
If L1(dim(L1))=int(round(L1(dim(L1)),9 ;if the last element of L1 is an interger...<br />
1&rarr;C ;we do NOT want to repeat the loop<br />
End ;to loop or not to loop, that is the question<br />
For(C,0,dim(L1)-2 ;for each element of L1, except one...<br />
dim(L1)-C ;saving memory and preparing to do the work<br />
L1(Ans)L1(Ans-1)&rarr;L1(Ans-1 ;multiply the last two elements of L1 together<br />
End<br />
End<br />
;L1(1)=numerator, L1(2)=denominator</nowiki><br />
<br />
calc84maniac's routine:<br />
<nowiki>:{Ans,1,fpart(abs(Ans<br />
:While [e]-9<Ans(3 ;[e] is little scientific notation e<br />
:{Ans(1),Ans(3),Ans(3)fpart(Ans(2)/Ans(3<br />
:End<br />
:round({Ans(1),1}/Ans(2),0</nowiki></div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks
83Plus:Basic:Tricks
2007-04-10T19:32:53Z
<p>Saibot84: more memory efficient numerical sub( function</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks]]<br />
[[Category:83Plus:Basic:Routines|Tricks]]<br />
<br />
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 "-" is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)<br />
<br />
__TOC__<br />
<br />
==Memory==<!-- →≠≤≥ --><br />
===Memory Management===<!-- →≠≤≥ --><br />
;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 &pi; as 3.1415926535898 &times; 10<sup>0</sup>, but in memory, it is something more similar (not exact) to <code>0 31415926535898</code> 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 <code>1 13000000000000</code>. 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:<br />
int(10^(F)fPart(X/10^(int(2-A+log(X<br />
: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<sup>value</sup> so that the digit we're looking for (identified in A) is "moved" 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<sup>F</sup> and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).<br />
;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 "N" as a variable, as well as the sequential functions u,v, and w.<br />
;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.<br />
<br />
===Memory Saving===<!-- →≠≤≥ --><br />
;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.<br />
;Never write out closing '''"''' 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.<br />
;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<br />
:Pause "TEXT"<br />
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].<br />
;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.<br />
;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<br />
:{1,2,3,4,5,6,7,8,9→L1<br />
:L1(5 (to retrieve the 5th element of the list)<br />
:try doing<br />
:"{1,2,3,4,5,6,7,8,9→Str1<br />
:expr(Str1<br />
:Ans(5<br />
:or<br />
:"{1,2,3,4,5,6,7,8,9→Y1<br />
:Y1:Ans(5<br />
: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.<br />
;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:<br />
Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1<br />
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.<br />
<br />
==Speed Boosters==<!-- →≠≤≥ --><br />
;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:<br />
<nowiki>Program:LOOPTEST<br />
:Disp "FOR<br />
:For(X,1,10000<br />
:End<br />
:Pause "FOR IS DONE<br />
:1→X<br />
:Disp "WHILE<br />
:While X<10001<br />
:X+1→X<br />
:End<br />
:Pause "WHILE IS DONE<br />
:0→X<br />
:Disp "GOTO<br />
:Lbl XX<br />
:X+1→X<br />
:If X<10001<br />
:Goto XX<br />
Pause "GOTO DONE</nowiki><br />
: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<br />
:While X<Y<br />
:to<br />
:X-1→X<br />
:For(X,X,Y<br />
:X-1→X<br />
: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 ;-)<br />
;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 "waiting" 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 "cancels" any conditions for its waiting for an End.<br />
;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.<br />
<br />
==Graphical Touches==<!-- →≠≤≥ --><br />
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc. Normally, you do something like this:<br />
:Text(15,10,"MY TEXT<br />
:following this, the text "MY TEXT" will be written on the 15th row, in the 10th column, in the small font... however, try adding a "-1" (without the quotation marks) as the first argument...<br />
:Text(-1,15,10,"MY TEXT<br />
:This time, the text "MY TEXT" will be written on the 15th row in the 10th column, in the LARGE font<br />
;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.<br />
;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:<br />
<nowiki>:"vQ6Qv "<br />
:For(X,1,7<br />
:Text(10,9+X,sub(Ans,X,1<br />
:End</nowiki><br />
:Another typical example is that of "drawing" a status bar to the screen using something such as:<br />
<nowiki>(P is the percent to be shaded in)<br />
(L is the length of the bar in pixels)<br />
(H is the horizontal position)<br />
(V is the vertical position, using the top-left corner of the screen as point 0,0)<br />
:Text(V,H,"(<br />
:For(X,0,PL/100<br />
:Text(V,H+X+1,"8<br />
:End<br />
:For(X,1,(100-P)L/100<br />
:Text(V,H+PL/100+X,")<br />
:End</nowiki><br />
: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.<br />
;Simplify your Life:Save a GDB at the beginning of your program. "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." (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. <!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... -->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<br />
;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:<br />
<nowiki>round(94X/(Xmax-Xmin)+47,0)->A<br />
round(-62Y/(Ymax-Ymin)+31,0)->B<br />
-RobbieMc</nowiki><br />
: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<br />
;Get rid of the "Done":Use the following right before your program exits to avoid having the calc display the "Done" text on the homescreen<br />
<nowiki>:ClrHome<br />
:"</nowiki><br />
:When used immediately before a "Stop" token, "Done" is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use <code>Output(1,1,"</code>.<br />
;Get rid of the RunIndic:On the homescreen, do <code>Output(1,16,"_</code> in the loop that is displaying the run indicator. On the graph screen, do <code>Text(-1,0,90,"_</code> in the loop that is displaying the run indicator. (_ in this context refers to the space character.)<br />
<br />
==Cool Hacks==<!-- →≠≤≥ --><br />
;Have " and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a " 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>Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the " quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif<br />
;If condition<nowiki>:</nowiki>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:<br />
<nowiki>(untested...)(lines are numbered)<br />
01:For(X,0,1<br />
02:getKey→K<br />
03:K→X<br />
04:If not(Ans<br />
05:End<br />
06:0→X<br />
07:"-<br />
08:If K=25<br />
09:"LEFT<br />
10:If K=26<br />
11:"UP<br />
12:If K=27<br />
13:"RIGHT<br />
14:If K=34<br />
15:"DOWN<br />
16:If K=45<br />
17:"CLEAR<br />
18:If Ans="-<br />
19:End<br />
20:Disp Ans<br />
21:If K=45<br />
22:1→X<br />
23:End</nowiki><br />
: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 "-" 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 "closes" 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<br />
;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:<br />
<nowiki>(50% tested)<br />
(to convert from Pt coordinates to Pxl coordinates)<br />
A is the X-coord<br />
B is the Y-coord<br />
<br />
{63/(Ymax-Ymin),95/(Xmax-Xmin<br />
<br />
;{pixels per Y, pixels per X<br />
<br />
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1<br />
<br />
;{Y,X,int ppY,int ppX<br />
;Ans(1)Ans(3) is now the Pxl-Y<br />
;Ans(2)Ans(4) is now the Pxl-X</nowiki><br />
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from James Matthew's Asmguru.hlp<br />
<nowiki>:If 0<cos(9)<br />
:Then<br />
:Disp "Degree Mode<br />
:Else<br />
:Disp "Radian Mode<br />
:End</nowiki><br />
;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 &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.<br />
:*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<br />
:*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 ;) <br />
: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.<br />
<nowiki>{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8</nowiki><br />
:That returns the list {0,0,0,2,3,0,0,0}.<br />
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that <br />
<nowiki>abs -1+1 would return 2 on a TI-82<br />
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)</nowiki><br />
:and that one can therefore use the following to display whether the calc is an 82 or 83<br />
Text(0,0,"YOU HAVE A TI-",83-.5(abs -1+1<br />
==Miscellaneous==<!-- →≠≤≥ --><br />
;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>0)+(2X)(X<1), which is the same as If X>0:Y=X^2:If X<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<br />
<nowiki>:length(Str1<br />
:Output(1,1,sub(Str1,1(Ans<96)+16frac(Ans/16)(Ans>95)+(16int(Ans/16)-80)(Ans>95),Ans+80-16int(Ans/16</nowiki><br />
: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 "row" 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, =, ≠, >, <, ≥, ≤. 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+)<br />
;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:<br />
<nowiki>::"Description</nowiki><br />
:That will show the program name with the description you typed.<br />
;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:<br />
<nowiki>PROGRAM:MYSHELL<br />
:program code<br />
:Output(1,1,"ERR:prgmMYSUB MISSING<br />
:prgmMYSUB<br />
:more program code<br />
<br />
PROGRAM:MYSUB<br />
:Output(1,1," "<br />
:The rest of program MYSUB.</nowiki><br />
<br />
==Further Reading==<!-- →≠≤≥ --><br />
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]<br />
<br />
'''TI-Basic Developer'''<br />
[http://tibasicdev.wikidot.com]<br />
<br />
==Special Thanks==<!-- →≠≤≥ --><br />
Special thanks to:<br />
<br />
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* © 2000 Kevtiva Interactive]<br />
<br />
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright © 2000-2006 BASIC Guru Online. All Rights Reserved.]<br />
<br />
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ © 2000-2006 Detached Solutions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Routines:DecToFrac
83Plus:Basic:Routines:DecToFrac
2007-04-10T19:28:34Z
<p>Saibot84: added basic category</p>
<hr />
<div>[[Category:83Plus:Basic|Decimal To Fraction Conversion]]<br />
[[Category:83Plus:Basic:Routines|Decimal To Fraction Conversion]]<br />
<!-- →≠≤≥ --><br />
<nowiki>code ;comment<br />
<br />
;K can be any real value<br />
<br />
1&ne;round(fPart(K),9 ;check for calc thinking the fractional part=1<br />
K(Ans)+not(Ans)(1+int(K ;if fPart=1, then Ans=int(K)+1, else, Ans=K<br />
{Ans,1&rarr;L1 ;L1={numerator,denominator<br />
If fPart(L1(1 ;if there's a fPart to the numerator...<br />
Then<br />
{K&rarr;L1 ;leave just the numerator in L1<br />
For(C,0,1 ;initiate a loop<br />
If 1=round(fPart(L1(dim(L1))),9 ;if the fPart of the last element of L1=1...<br />
1+int(L1(dim(L1&rarr;L1(dim(L1 ;the last element of L1=int(last element of L1)+1<br />
augment(L1,{fPart(L1(dim(L1)))^(-1 ;append the inverse of the fPart(last element of L1) to L1<br />
0&rarr;C ;force the For loop to repeat upon next End<br />
If L1(dim(L1))=int(round(L1(dim(L1)),9 ;if the last element of L1 is an interger...<br />
1&rarr;C ;we do NOT want to repeat the loop<br />
End ;to loop or not to loop, that is the question<br />
For(C,0,dim(L1)-2 ;for each element of L1, except one...<br />
dim(L1)-C ;saving memory and preparing to do the work<br />
L1(Ans)L1(Ans-1)&rarr;L1(Ans-1 ;multiply the last two elements of L1 together<br />
End<br />
<br />
;L1(1)=numerator, L1(2)=denominator</nowiki></div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks_ExecAsm
83Plus:Basic:Tricks ExecAsm
2007-04-10T19:27:37Z
<p>Saibot84: added routines category</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks_ExecAsm]]<br />
[[Category:83Plus:Basic:Routines|Tricks_ExecAsm]]<br />
<br />
This is organized such that first comes the "name" of the routine, then the sequence of hexadecimal codes, and then (usually) comes the asm instructions that were used to get the sequence of hexadecimal codes, in case anyone wishes to attempt to edit anything in the routine. In order to use these, you can enter these as a string argument in Omnicalc's ExecAsm( function, or you can create a new program, put AsmPrgm (found in the Catalog) as the first instruction, type the hexadecimal code sequence, and then (VERY IMPORTANT) add C9 to the end of the hex code sequence. If you do this, you will have to do Asm(prgmYOURPRGM in order to run your program, replacing YOURPRGM with whatever you named the program in which you entered this sequence. You should also note that any routine ending with "BCALL _StoAns" will be saving something to the Ans variable.<br />
::FloppusMaximus wrote: Looks like the ExecAsm function *always* returns 1?! Probably the best thing to do in this case is change the StoAns to a StoX (EFBF4A → EFD14A) and read the result from X rather than Ans.If you really wanted to use Ans, you could also just reset the numOP1 flag yourself (FDCB0786).<br />
:::The code to reset the numOP1 flag should be put at the end of the sequence when using Omnicalc, if you still wish to use Ans. These changes can be ignored if putting the hexcode sequences in a separate program.<br />
::'''Warning'''<br />
:::You should ensure that you type in these hexcode sequences as ACCURATELY as possible as the alteration of a SINGLE character CAN and most likely WILL cause the calculator to CRASH. Use these at your own risk.<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==Screen==<!-- →≠≤≥ --><br />
===Shift===<!-- →≠≤≥ --><br />
;Shift screen right (no LCD update):2140930E40060CB7CB1E2310FB0D20F5<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki> 21 40 93 - ld hl,gbuf<br />
0E 40 - - ld c,64<br />
- - - - loop:<br />
06 0C - - ld b,12<br />
B7 - - - or a<br />
- - - - smalloop:<br />
CB 1E - - rr (hl)<br />
23 - - - inc hl<br />
10 FB - - djnz smalloop<br />
0D - - - dec c<br />
20 F5 - - jr nz,loop<br />
-Jim e</nowiki><br />
;Shift screen left (no LCD update):213F960E40060CB7CB162B10FB0D20F5<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki> 21 3F 96 - ld hl,gbuf+767<br />
0E 40 - - ld c,64<br />
- - - - loop2:<br />
06 0C - - ld b,12<br />
B7 - - - or a<br />
- - - - smalloop2:<br />
CB 16 - - rl (hl)<br />
2B - - - dec hl<br />
10 FB - - djnz smalloop2<br />
0D - - - dec c<br />
20 F5 - - jr nz,loop2<br />
-Jim e</nowiki><br />
;Shift screen up one line (no LCD update):214C9311409301F402EDB0EB010C00EF304C<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki>ld hl,plotSScreen+12 ; 214C93<br />
ld de,plotSScreen ; 114093<br />
ld bc,756 ; 01F402<br />
ldir ; EDB0<br />
ex de,hl ; EB<br />
ld bc,12 ; 010C00<br />
BCALL _MemClear ; EF304C<br />
-FloppusMaximus</nowiki><br />
;Shift screen down one line (no LCD update):213396113F9601F402EDB823010C00EF304C<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki>ld hl,plotSScreen+767-12 ; 213396<br />
ld de,plotSScreen+767 ; 113F96<br />
ld bc,756 ; 01F402<br />
lddr ; EDB8<br />
inc hl ; 23<br />
ld bc,12 ; 010C00<br />
BCALL _MemClear ; EF304C<br />
-FloppusMaximus</nowiki><br />
<br />
===Contrast===<!-- →≠≤≥ --><br />
;Increase the Contrast:2147847EC604FE28D077C6D8CD0B00D310<br />
<nowiki>ld hl,contrast ; 21478477C6D8CD0B00D310<br />
ld a,(hl) ; 7E<br />
add a,4 ; C604 (or whatever)<br />
cp 28h ; FE28<br />
ret nc ; D0<br />
ld (hl),a ; 77<br />
add a,D8h ; C6D8<br />
call 0bh ; CD0B00<br />
out (10h),a ; D310<br />
-FloppusMaximus</nowiki><br />
;Decrease the Contrast:2147847ED604D877C6D8CD0B00D310<br />
<nowiki>ld hl,contrast ; 214784<br />
ld a,(hl) ; 7E<br />
sub 4 ; D604 (or whatever)<br />
ret c ; D8<br />
ld (hl),a ; 77<br />
add a,D8h ; C6D8<br />
call 0bh ; CD0B00<br />
out (10h),a ; D310<br />
-FloppusMaximus</nowiki><br />
;X &rarr; temporary contrast (0 <=X <= 63):EFE04AEFEF4AC6C0CD0B00D310<br />
<nowiki>BCALL _RclX ; EFE04A<br />
BCALL _ConvOP1 ; EFEF4A<br />
add a,C0h ; C6C0<br />
call 0bh ; CD0B00<br />
out (10h),a ; D310</nowiki><br />
<br />
===Invert/Black/Clear===<!-- →≠≤≥ --><br />
;Black graph (no LCD update):2140930100033EFFEF334C<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki> ld hl,plotsscreen ;214093<br />
ld bc,768 ;010003<br />
ld a,$FF ;3EFF<br />
bcall(_memset) ;EF334C<br />
-RobbieMc</nowiki><br />
;Clear Graph (no LCD update):EFD04B<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki>B_CALL _GrBufClr ; EFD04B</nowiki><br />
;Invert HomeScreen:FDCB05DEEF7945FDCB059E<br />
<nowiki>set textInverse,(iy+textFlags) ; FDCB05DE<br />
B_CALL _RstrShadow ; EF7945<br />
res textInverse,(iy+textFlags) ; FDCB059E <br />
-FloppusMaximus</nowiki><br />
;Invert graph (no LCD update):2140930100037E2F77230B78B120F7<br />
:To update the LCD, add EF6A48 at the end (before adding C9 if in a prgm)<br />
<nowiki> ld hl,plotsscreen ;214093<br />
ld bc,768 ;010003<br />
ld a,(hl) ;7E<br />
cpl ;2F<br />
ld (hl),a ;77<br />
inc hl ;23<br />
dec bc ;0B<br />
ld a,b ;78<br />
or c ;B1<br />
jr nz,$-7 ;20F7<br />
-RobbieMc</nowiki><br />
;Invert Screen (Any):F33E20CD0B00D3103E80CD0B00D310060EC5063F2E7FCD0B00DB112C<br />
:CD0B00DB112FF57DCD0B00D311CD0B00DB11F1CD0B00D31110E5C110D8<br />
:Note: This should be one LONG sequence. The line-break is inserted for readability only.<br />
<nowiki> DI ;F3<br />
LD A, $20 ;3E20<br />
CALL $B ;CD0B00<br />
OUT ($10), A ;D310<br />
LD A, $80 ;3E80<br />
CALL $B ;CD0B00<br />
OUT ($10), A ;D310<br />
LD B, 14 ;060E<br />
loop:<br />
PUSH BC ;C5<br />
LD B, 63 ;063F<br />
LD L, $7F ;2E7F<br />
CALL $B ;CD0B00<br />
IN A, ($11) ;dummy read DB11<br />
loop1:<br />
INC L ;row counter 2C<br />
CALL $B ;CD0B00<br />
IN A, ($11) ;DB11<br />
CPL ;2F<br />
PUSH AF ;F5<br />
LD A, L ;reset the row 7D<br />
CALL $B ;CD0B00<br />
OUT ($11), A ;D311<br />
CALL $B ;CD0B00<br />
IN A, ($11) ;dummy read... DB11<br />
POP AF ;F1<br />
CALL $B ;CD0B00<br />
OUT ($11), A ;D311<br />
DJNZ loop1 ;10E5<br />
POP BC ;C1<br />
DJNZ loop ;10D8<br />
-Taricorp</nowiki><br />
<br />
===Miscellaneous===<!-- →≠≤≥ --><br />
;Enabling Fast Circles:FDCB3CE6<br />
set useFastCirc, (iy+plotFlag3) FD CB 3C E6<br />
-Michael Cimino<br />
;Toggle the Screen On and Off:DB10CB6F20053E03D310C93E02D310<br />
<nowiki> in a,(10h) ; DB10<br />
bit 5,a ; CB6F<br />
jr nz,turnoff ; 2005<br />
ld a,3 ; 3E03<br />
out (10h),a ; D310<br />
ret ; C9<br />
turnoff:<br />
ld a,2 ; 3E02<br />
out (10h),a ; D310<br />
-FloppusMaximus</nowiki><br />
<br />
==System==<!-- →≠≤≥ --><br />
===Flags===<!-- →≠≤≥ --><br />
;Enable Alpha Lock:FDCB12E6FDCB12F6<br />
<nowiki>set shiftAlpha,(iy+shiftFlags) ; FDCB12E6<br />
set shiftALock,(iy+shiftFlags) ; FDCB12F6<br />
-FloppusMaximus</nowiki><br />
;Toggling Lowercase:21148A3E08AE77<br />
<nowiki>ld hl,flags+appLwrCaseFlag ; 21148A<br />
ld a,8 ; 3E08<br />
xor (hl) ; AE<br />
ld (hl),a ; 77<br />
-FloppusMaximus</nowiki><br />
;Remove "Done":<br />
<nowiki>res donePrgm,(iy+doneFlags) ; FDCB00AE<br />
-FloppusMaximus</nowiki><br />
;Toggle Inverse Text:21F5893E08AE77<br />
<nowiki>ld hl,flags+textFlags<br />
ld a,8<br />
xor (hl)<br />
ld (hl),a</nowiki><br />
<br />
===Power===<!-- →≠≤≥ --><br />
;Automatic Power Down (APD):210101224884FDCB08DEFB76<br />
:Theoretically, this should return to your program after execution.<br />
<nowiki>ld hl,0101h ; 210101<br />
ld (apdSubTimer),hl ; 224884<br />
set apdRunning,(iy+apdFlags) ; FDCB08DE<br />
ei ; FB<br />
halt ; 76<br />
-FloppusMaximus</nowiki><br />
;X &rarr; APD Timers:EFE04AEFEF4AEB214884732372<br />
<nowiki>BCALL _RclX ; EFE04A<br />
BCALL _ConvOP1 ; EFEF4A<br />
ex de,hl ; EB<br />
ld hl,apdsubTimer ;214884<br />
ld (hl),e ; 73<br />
inc hl ; 23<br />
ld (hl),d ; 72<br />
-Saibot84</nowiki><br />
;Turn Off the Calc:3E01D30376FDCB09A6<br />
:This should return to your program after execution.<br />
<nowiki>ld a,1 ; 3E01<br />
out (3),a ; D303<br />
halt ; 76<br />
res onInterrupt,(iy+onFlags) ; FDCB09A6<br />
-FloppusMaximus</nowiki><br />
;Powerdown:EF0850<br />
:This routine should (theoretically) '''not''' return to your program.<br />
<nowiki>bcall(_PowerOff)</nowiki><br />
<br />
===Properties===<!-- →≠≤≥ --><br />
;Battery state (0 = good, 1 = bad):EFBF41EFB3502803EF9B41EFBF4A<br />
<nowiki> BCALL _OP1Set0 ; EFBF41<br />
BCALL _Chk_Batt_Low ; EFB350<br />
jr z,good ; 2803<br />
BCALL _OP1Set1 ; EF9B41<br />
good:<br />
BCALL _StoAns ; EFBF4A<br />
-FloppusMaximus</nowiki><br />
;Get Amount of Free Ram:EFE542EF9247EF5641EFBF4A<br />
<nowiki>BCALL _MemChk ; EFE542<br />
BCALL _SetXXXXOP2 ; EF9247<br />
BCALL _OP2ToOP1 ; EF5641<br />
BCALL _StoAns ; EFBF4A<br />
-FloppusMaximus</nowiki><br />
;OS Version:EF6F4CF578EF8C47EF6742EF6742F1EF8F47F7EFBF4A<br />
<nowiki>BCALL _GetBaseVer ; EF6F4C<br />
push af ; F5<br />
ld a,b ; 78<br />
BCALL _SetXXOP1 ; EF8C47<br />
BCALL _DecO1Exp ; EF6742<br />
BCALL _DecO1Exp ; EF6742<br />
pop af ; F1<br />
BCALL _SetXXOP2 ; EF8F47<br />
rst 30h ; F7<br />
BCALL _StoAns ; EFBF4A<br />
-FloppusMaximus</nowiki><br />
;Hardware Version:EFBA80EF8C47EFBF4A<br />
<nowiki>BCALL _GetHWVer ; EFBA80<br />
BCALL _SetXXOP1 ; EF8C47<br />
BCALL _StoAns ; EFBF4A<br />
-FloppusMaximus</nowiki><br />
;GetKey:EF7045FB76EF4447B728F8EF5641EFD14A<br />
<nowiki> B_CALL _RunIndicOff ; EF7045<br />
again:<br />
ei ; FB<br />
halt ; 76<br />
B_CALL _GetK ; EF4447<br />
or a ; B7<br />
jr z,again ; 28F8<br />
B_CALL _OP2ToOP1 ; EF5641<br />
B_CALL _StoX ; EFD14A<br />
-FloppusMaximus</nowiki><br />
;Amount of Free ROM → X<br />
:This routines is still being discussed in the Detached Solutions forum. The final version will be posted here as soon as all parties have come to an agreement.<br />
<!--EF1450219F8356235E2346234EC5EBEF9247EF5641210080EF9247EF8440EF6640E1EF9247F7EFBF4A<br />
<nowiki>BCALL 5014h ; EF1450<br />
ld hl,839Fh ; 219F83<br />
ld d,(hl) ; 56<br />
inc hl ; 23<br />
ld e,(hl) ; 5E<br />
inc hl ; 23<br />
ld b,(hl) ; 46<br />
inc hl ; 23<br />
ld c,(hl) ; 4E<br />
push bc ; C5<br />
ex de,hl ; EB<br />
BCALL _SetXXXXOP2 ; EF9247<br />
BCALL _OP2ToOP1 ; EF5641<br />
ld hl,32768 ; 210080<br />
BCALL _SetXXXXOP2 ; EF9247<br />
BCALL _FPMult ; EF8440<br />
BCALL _Times2 ; EF6640<br />
pop hl ; E1<br />
BCALL _SetXXXXOP2 ; EF9247<br />
rst 30h ; F7<br />
BCALL _StoAns ; EFBF4A<br />
-FloppusMaximus</nowiki><br />
:EF1450ED4B9F83ED437884ED4BA183ED437A84219584DB02CB7F20012B36002B0607<br />
:111000E5C5EFB180C1E13A8684C630772B10EDEF3E41EFD14A<br />
:Note: This should be one LONG sequence. The line-break is inserted for readability only.<br />
<nowiki> bcall(_arcchk) ;EF1450<br />
ld bc,($839F) ;ED4B9F83<br />
ld (op1),bc ;ED437884<br />
ld bc,($83A1) ;ED4BA183<br />
ld (op1+2),bc ;ED437A84<br />
ld hl,op3+7 ;219584<br />
in a,(2) ;DB02<br />
bit 7,a ;CB7F<br />
jr nz,$+3 ;2001<br />
dec hl ;2B<br />
ld (hl),0 ;3600<br />
dec hl ;2B<br />
ld b,7 ;0607<br />
loop:<br />
ld de,10 ;111000<br />
push hl ;E5<br />
push bc ;C5<br />
bcall(_div32by16) ;EFB180<br />
pop bc ;C1<br />
pop hl ;E1<br />
ld a,(op2+3) ;3A8684<br />
add a,$30 ;C630<br />
ld (hl),a ;77<br />
dec hl ;2B<br />
djnz loop ;10ED<br />
bcall(_op3toop1) ;EF3E41<br />
bcall(_stox) ;EFD14A<br />
-RobbieMc</nowiki>--><br />
;Toggle Archiving Privileges in Programs:21F8893E02AE77<br />
:You should run this directly before and directly after archiving/unarciving programs within a TI-BASIC program.<br />
<nowiki> ld hl,flags+apdFlags<br />
ld a,2<br />
xor (hl)<br />
ld (hl),a</nowiki></div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks
83Plus:Basic:Tricks
2007-04-10T19:26:16Z
<p>Saibot84: added routines category</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks]]<br />
[[Category:83Plus:Basic:Routines|Tricks]]<br />
<br />
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 "-" is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)<br />
<br />
__TOC__<br />
<br />
==Memory==<!-- →≠≤≥ --><br />
===Memory Management===<!-- →≠≤≥ --><br />
;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 &pi; as 3.1415926535898 &times; 10<sup>0</sup>, but in memory, it is something more similar (not exact) to <code>0 31415926535898</code> 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 <code>1 13000000000000</code>. 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:<br />
int(fPart(X/10^(int(2-A+log(X))))*10^(F))<br />
: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<sup>value</sup> so that the digit we're looking for (identified in A) is "moved" 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<sup>F</sup> and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).<br />
;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 "N" as a variable, as well as the sequential functions u,v, and w.<br />
;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.<br />
<br />
===Memory Saving===<!-- →≠≤≥ --><br />
;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.<br />
;Never write out closing '''"''' 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.<br />
;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<br />
:Pause "TEXT"<br />
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].<br />
;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.<br />
;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<br />
:{1,2,3,4,5,6,7,8,9→L1<br />
:L1(5 (to retrieve the 5th element of the list)<br />
:try doing<br />
:"{1,2,3,4,5,6,7,8,9→Str1<br />
:expr(Str1<br />
:Ans(5<br />
:or<br />
:"{1,2,3,4,5,6,7,8,9→Y1<br />
:Y1:Ans(5<br />
: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.<br />
;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:<br />
Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1<br />
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.<br />
<br />
==Speed Boosters==<!-- →≠≤≥ --><br />
;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:<br />
<nowiki>Program:LOOPTEST<br />
:Disp "FOR<br />
:For(X,1,10000<br />
:End<br />
:Pause "FOR IS DONE<br />
:1→X<br />
:Disp "WHILE<br />
:While X<10001<br />
:X+1→X<br />
:End<br />
:Pause "WHILE IS DONE<br />
:0→X<br />
:Disp "GOTO<br />
:Lbl XX<br />
:X+1→X<br />
:If X<10001<br />
:Goto XX<br />
Pause "GOTO DONE</nowiki><br />
: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<br />
:While X<Y<br />
:to<br />
:X-1→X<br />
:For(X,X,Y<br />
:X-1→X<br />
: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 ;-)<br />
;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 "waiting" 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 "cancels" any conditions for its waiting for an End.<br />
;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.<br />
<br />
==Graphical Touches==<!-- →≠≤≥ --><br />
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc. Normally, you do something like this:<br />
:Text(15,10,"MY TEXT<br />
:following this, the text "MY TEXT" will be written on the 15th row, in the 10th column, in the small font... however, try adding a "-1" (without the quotation marks) as the first argument...<br />
:Text(-1,15,10,"MY TEXT<br />
:This time, the text "MY TEXT" will be written on the 15th row in the 10th column, in the LARGE font<br />
;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.<br />
;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:<br />
<nowiki>:"vQ6Qv "<br />
:For(X,1,7<br />
:Text(10,9+X,sub(Ans,X,1<br />
:End</nowiki><br />
:Another typical example is that of "drawing" a status bar to the screen using something such as:<br />
<nowiki>(P is the percent to be shaded in)<br />
(L is the length of the bar in pixels)<br />
(H is the horizontal position)<br />
(V is the vertical position, using the top-left corner of the screen as point 0,0)<br />
:Text(V,H,"(<br />
:For(X,0,PL/100<br />
:Text(V,H+X+1,"8<br />
:End<br />
:For(X,1,(100-P)L/100<br />
:Text(V,H+PL/100+X,")<br />
:End</nowiki><br />
: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.<br />
;Simplify your Life:Save a GDB at the beginning of your program. "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." (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. <!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... -->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<br />
;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:<br />
<nowiki>round(94X/(Xmax-Xmin)+47,0)->A<br />
round(-62Y/(Ymax-Ymin)+31,0)->B<br />
-RobbieMc</nowiki><br />
: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<br />
;Get rid of the "Done":Use the following right before your program exits to avoid having the calc display the "Done" text on the homescreen<br />
<nowiki>:ClrHome<br />
:"</nowiki><br />
:When used immediately before a "Stop" token, "Done" is still displayed after the program quits. This also moves the cursor down one line before quitting. To avoid both these, use <code>Output(1,1,"</code>.<br />
;Get rid of the RunIndic:On the homescreen, do <code>Output(1,16,"_</code> in the loop that is displaying the run indicator. On the graph screen, do <code>Text(-1,0,90,"_</code> in the loop that is displaying the run indicator. (_ in this context refers to the space character.)<br />
<br />
==Cool Hacks==<!-- →≠≤≥ --><br />
;Have " and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a " 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>Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the " quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif<br />
;If condition<nowiki>:</nowiki>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:<br />
<nowiki>(untested...)(lines are numbered)<br />
01:For(X,0,1<br />
02:getKey→K<br />
03:K→X<br />
04:If not(Ans<br />
05:End<br />
06:0→X<br />
07:"-<br />
08:If K=25<br />
09:"LEFT<br />
10:If K=26<br />
11:"UP<br />
12:If K=27<br />
13:"RIGHT<br />
14:If K=34<br />
15:"DOWN<br />
16:If K=45<br />
17:"CLEAR<br />
18:If Ans="-<br />
19:End<br />
20:Disp Ans<br />
21:If K=45<br />
22:1→X<br />
23:End</nowiki><br />
: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 "-" 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 "closes" 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<br />
;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:<br />
<nowiki>(50% tested)<br />
(to convert from Pt coordinates to Pxl coordinates)<br />
A is the X-coord<br />
B is the Y-coord<br />
<br />
{63/(Ymax-Ymin),95/(Xmax-Xmin<br />
<br />
;{pixels per Y, pixels per X<br />
<br />
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1<br />
<br />
;{Y,X,int ppY,int ppX<br />
;Ans(1)Ans(3) is now the Pxl-Y<br />
;Ans(2)Ans(4) is now the Pxl-X</nowiki><br />
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from James Matthew's Asmguru.hlp<br />
<nowiki>:If 0<cos(9)<br />
:Then<br />
:Disp "Degree Mode<br />
:Else<br />
:Disp "Radian Mode<br />
:End</nowiki><br />
;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 &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.<br />
:*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<br />
:*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 ;) <br />
: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.<br />
<nowiki>{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8</nowiki><br />
:That returns the list {0,0,0,2,3,0,0,0}.<br />
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that <br />
<nowiki>abs -1+1 would return 2 on a TI-82<br />
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)</nowiki><br />
:and that one can therefore use the following to display whether the calc is an 82 or 83<br />
Text(0,0,"YOU HAVE A TI-",83-.5(abs -1+1<br />
==Miscellaneous==<!-- →≠≤≥ --><br />
;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>0)+(2X)(X<1), which is the same as If X>0:Y=X^2:If X<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<br />
<nowiki>:length(Str1<br />
:Output(1,1,sub(Str1,1(Ans<96)+16frac(Ans/16)(Ans>95)+(16int(Ans/16)-80)(Ans>95),Ans+80-16int(Ans/16</nowiki><br />
: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 "row" 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, =, ≠, >, <, ≥, ≤. 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+)<br />
;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:<br />
<nowiki>::"Description</nowiki><br />
:That will show the program name with the description you typed.<br />
;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:<br />
<nowiki>PROGRAM:MYSHELL<br />
:program code<br />
:Output(1,1,"ERR:prgmMYSUB MISSING<br />
:prgmMYSUB<br />
:more program code<br />
<br />
PROGRAM:MYSUB<br />
:Output(1,1," "<br />
:The rest of program MYSUB.</nowiki><br />
<br />
==Further Reading==<!-- →≠≤≥ --><br />
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]<br />
<br />
'''TI-Basic Developer'''<br />
[http://tibasicdev.wikidot.com]<br />
<br />
==Special Thanks==<!-- →≠≤≥ --><br />
Special thanks to:<br />
<br />
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* © 2000 Kevtiva Interactive]<br />
<br />
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright © 2000-2006 BASIC Guru Online. All Rights Reserved.]<br />
<br />
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ © 2000-2006 Detached Solutions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Category:83Plus:Basic:Routines
Category:83Plus:Basic:Routines
2007-04-10T19:23:26Z
<p>Saibot84: new category</p>
<hr />
<div>{{stub}}<br />
<br />
[[Category:83Plus:Basic|Routines]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Routines:DecToFrac
83Plus:Basic:Routines:DecToFrac
2007-04-10T19:20:04Z
<p>Saibot84: created routine</p>
<hr />
<div>[[Category:83Plus:Basic:Routines|Decimal To Fraction Conversion]]<br />
<!-- →≠≤≥ --><br />
<nowiki>code ;comment<br />
<br />
;K can be any real value<br />
<br />
1&ne;round(fPart(K),9 ;check for calc thinking the fractional part=1<br />
K(Ans)+not(Ans)(1+int(K ;if fPart=1, then Ans=int(K)+1, else, Ans=K<br />
{Ans,1&rarr;L1 ;L1={numerator,denominator<br />
If fPart(L1(1 ;if there's a fPart to the numerator...<br />
Then<br />
{K&rarr;L1 ;leave just the numerator in L1<br />
For(C,0,1 ;initiate a loop<br />
If 1=round(fPart(L1(dim(L1))),9 ;if the fPart of the last element of L1=1...<br />
1+int(L1(dim(L1&rarr;L1(dim(L1 ;the last element of L1=int(last element of L1)+1<br />
augment(L1,{fPart(L1(dim(L1)))^(-1 ;append the inverse of the fPart(last element of L1) to L1<br />
0&rarr;C ;force the For loop to repeat upon next End<br />
If L1(dim(L1))=int(round(L1(dim(L1)),9 ;if the last element of L1 is an interger...<br />
1&rarr;C ;we do NOT want to repeat the loop<br />
End ;to loop or not to loop, that is the question<br />
For(C,0,dim(L1)-2 ;for each element of L1, except one...<br />
dim(L1)-C ;saving memory and preparing to do the work<br />
L1(Ans)L1(Ans-1)&rarr;L1(Ans-1 ;multiply the last two elements of L1 together<br />
End<br />
<br />
;L1(1)=numerator, L1(2)=denominator</nowiki></div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2007-03-22T16:48:39Z
<p>Saibot84: changed website</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://host98.ipowerweb.com/~xiondigi/xdg/mcimino/ Contact Me]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://forum.reaktix.com/viewtopic.php?id=3 Reaktix Software Forum>Nostalgy>Introduction]<br />
:'''Current features:'''<br />
:*Version: 0.2.4-usi<br />
:*OS loader<br />
:*IM1<br />
::*poweroff/on<br />
::*[ON]-hotkey menu<br />
::*holding [ON] pauses the currently running routine/program until it is either released (which powersoff the calc) or until another key is pressed, which invokes that hotkey, if it exists.<br />
::*[ON]+[+] raises the contrast and [ON]+[-] lowers the contrast<br />
:*Task switching environment (tasks can be paused and resumed) (inspired by Radical Software's TSE, by Robin Kay, Michael Vincent)<br />
::*5 tasks are supported (2 system tasks + 3 user tasks) <br />
::*can continue a task from it's last PC or<br />
::*can return to an address provided by the task<br />
::*saves and restores registers for each task<br />
::*saves and restores the stack for each task<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*crude versions of a "run indicator"<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Mathematical system calls<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon receiving<br />
::*Networking: made capable by Timendus' CLAP<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2007-03-22T16:42:11Z
<p>Saibot84: removed link to never-updated blog ;)</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://forum.reaktix.com/viewtopic.php?id=3 Reaktix Software Forum>Nostalgy>Introduction]<br />
:'''Current features:'''<br />
:*Version: 0.2.4-usi<br />
:*OS loader<br />
:*IM1<br />
::*poweroff/on<br />
::*[ON]-hotkey menu<br />
::*holding [ON] pauses the currently running routine/program until it is either released (which powersoff the calc) or until another key is pressed, which invokes that hotkey, if it exists.<br />
::*[ON]+[+] raises the contrast and [ON]+[-] lowers the contrast<br />
:*Task switching environment (tasks can be paused and resumed) (inspired by Radical Software's TSE, by Robin Kay, Michael Vincent)<br />
::*5 tasks are supported (2 system tasks + 3 user tasks) <br />
::*can continue a task from it's last PC or<br />
::*can return to an address provided by the task<br />
::*saves and restores registers for each task<br />
::*saves and restores the stack for each task<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*crude versions of a "run indicator"<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Mathematical system calls<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon receiving<br />
::*Networking: made capable by Timendus' CLAP<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Experiments
Experiments
2007-03-22T16:41:13Z
<p>Saibot84: added link for LCD RAM -> Nostalgy</p>
<hr />
<div>Here is a place for experiments, proof of concepts, surprising stuff made on TI-83(+):<br />
<br />
* [http://www.ticalc.org/archives/files/fileinfo/368/36889.html QuadPlayer - Four channel sound] by Benryves : stereo sound with 4 tracks on TI-83(+)<br />
* [http://www.revsoft.org/phpBB2/viewtopic.php?t=200 8bit/32khz sound] by Jim E on 84+SE.<br />
* [http://www.ticalc.org/archives/files/fileinfo/341/34172.html 7-level greyscale]<br />
* [http://clap.timendus.com/ CLAP - Linking more than two calculators]<br />
* [[3D engines]]<br />
* [http://wikiti.denglend.net/index.php?title=User:Saibot84 using LCD RAM as temporary RAM (in Nostalgy)]<br />
* upgrading Calculator RAM<br />
{{stub}}</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:Calculator_Documentation
Talk:Calculator Documentation
2007-02-15T14:03:02Z
<p>Saibot84: +suggestion</p>
<hr />
<div>I changed some headings and moved stuff around a bit. I think it's more logical this way, but I don't mind if you change it back. [[User:Jib|Jib]] 02:37, 5 November 2006 (PST)<br />
: The only thing that bugs me about it is that there's a "software" heading that includes both PC software (emulators) and calculator software (TIOS Alternatives), not to mention that software documentation is listed under a different heading. What do you think about:<br />
Z80 Calculators<br />
TI-83<br />
Programming<br />
Ports<br />
RAM Areas<br />
B_CALLs<br />
etc<br />
Software<br />
Calculator Software<br />
Emulators<br />
Linking Software<br />
TIOS Alternatives<br />
TI-83 Plus Family<br />
Programming<br />
etc...<br />
Software<br />
etc...<br />
General Z80 Info<br />
Instruction Set<br />
etc.<br />
<br />
68k Calculators<br />
TI-89/92+<br />
Programming<br />
etc.<br />
Software<br />
etc.<br />
TI-92<br />
etc.<br />
General 68k Info<br />
Instruction Set<br />
etc.<br />
<br />
TI Community<br />
History<br />
Programming Teams<br />
etc.<br />
<br />
For example, in that organization, the TI-83 Emulators page would basically just be a list of the emulators compatible with the 83, each of which would have their own separate page. So the VTI page might be linked from the TI-83 emulators page, the TI-85 emulators page, the TI-89 emulators page, etc. I like this organization because it makes it clear what calculators everything is applicable to, and it decreases the number of top-level categories. But maybe it's too complicated or has too many levels. Thoughts? --[[User:Dan Englender|Dan Englender]] 09:11, 5 November 2006 (PST)<br />
:Yeah, it seems like a good idea to me. [[User:Jib|Jib]] 12:35, 5 November 2006 (PST)<br />
<br />
== Descriptions ==<br />
<br />
I was just made aware that searching doesn't always work so well when looking for certain things. I think adding little descriptions after each link may help with new user finding things that aren't easy to find using search. I would do this however I have the grammar and spelling skills of a jar of mayonaise.<br />
<br />
Also right now the Wiki isn't very friendly to new comers. Perhaps brain storming some ways to improve ease of use is in order.--[[User:Jim e|Jim e]] 23:03, 13 February 2007 (PST)<br />
<br />
:Maybe I'm "thinking divergently", but from the very beginning, I thought the WikiTI might be a bit more useful if one could export the contents directly to a "wikiti.inc" file or something, where we can select which information we need exported (choose a calc model, choose whether you want all the bcalls, the port info, flags, and/or the RAM addresses, with or without their accompanying documentation). Maybe, since ti83plus.inc has recently been added, a script or something could use it as a basis, adding documentation as comments such that one can simply export the necessary WikiTI data to a file, and include it directly in one's source. [[User:Saibot84|Saibot84]] 06:03, 15 February 2007 (PST)<br />
<br />
If you type up descriptions, I'll be more than happy to make sure the grammar and spelling is clear and correct. [[User:Threefingeredguy|threefingeredguy]] 02:36, 14 February 2007 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-12-31T09:45:42Z
<p>Saibot84: /* Projects Under Development */</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://nostalgy-os-journal.blogspot.com/ Nostalgy Development Journal] [http://forum.reaktix.com/viewtopic.php?id=3 Reaktix Software Forum>Nostalgy>Introduction]<br />
:'''Current features:'''<br />
:*Version: 0.2.4-usi<br />
:*OS loader<br />
:*IM1<br />
::*poweroff/on<br />
::*[ON]-hotkey menu<br />
::*holding [ON] pauses the currently running routine/program until it is either released (which powersoff the calc) or until another key is pressed, which invokes that hotkey, if it exists.<br />
::*[ON]+[+] raises the contrast and [ON]+[-] lowers the contrast<br />
:*Task switching environment (tasks can be paused and resumed) (inspired by Radical Software's TSE, by Robin Kay, Michael Vincent)<br />
::*5 tasks are supported (2 system tasks + 3 user tasks) <br />
::*can continue a task from it's last PC or<br />
::*can return to an address provided by the task<br />
::*saves and restores registers for each task<br />
::*saves and restores the stack for each task<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*crude versions of a "run indicator"<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Mathematical system calls<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon receiving<br />
::*Networking: made capable by Timendus' CLAP<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:Z80_Good_Programming_Practices
Talk:Z80 Good Programming Practices
2006-12-31T09:00:06Z
<p>Saibot84: </p>
<hr />
<div>To be honest this article is questionable in its function, as "good practices" is relative per situation. The examples given are bad examples when to do what is suggested. Further there isn't much substance here and it's poorly defined what would belong here. A programming guide would be a better idea than this. --[[User:Jim e|Jim e]] 12:20, 20 September 2006 (PDT)<br />
:Well I agree that the title may be misleading, but I think that for the most part the content would be ok for a sort of "programming tips" section of a larger programming guide. In any case, feel free to add/change as you see fit. --[[User:Dan Englender|Dan Englender]] 12:56, 20 September 2006 (PDT)<br />
::Yeah, some of the stuff (like the section on lookup tables) should say when it's more efficient to use it and when it's not (with only a few options and sequential numbers, dec a / jp z,X / dec a / jp z,Y... would be more efficient), but the idea is good. --[[User:Burntfuse|burntfuse]] 11:30, 24 September 2006 (PDT)<br />
<br />
::I took out the ix think because it was VERY wrong, I don't know why I didn't notice it before. Opcodes were used that didn't exist, the situation for ix usage was poor and less optimized. Now without that there is only the LUT thing, I still think this page is pointless.--[[User:Jim e|Jim e]] 00:29, 27 December 2006 (PST)<br />
:::Anyone want to be in charge of making an AfD system? >_> <_< -[[User:AndyJ|Andy Janata]] 20:01, 27 December 2006 (PST)<br />
::::I'm sorry to have to ask, but what is an AfD system? [[User:Saibot84|Saibot84]] 01:00, 31 December 2006 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:BCALLs:50B3
Talk:83Plus:BCALLs:50B3
2006-11-06T23:25:16Z
<p>Saibot84: </p>
<hr />
<div>==Working Code==<br />
I know this is probably trivial, but I was wondering if someone could please post a simple working example of what this BCALL does (meaning, not exactly a disassembly of the original TIOS code, but an example nonetheless) for those of us who feel BCALLing TIOS routine should be avoided whenever possible. ;^) [[User:Saibot84|Saibot84]] 09:38, 6 November 2006 (PST)<br />
<br />
:Something like this:<br />
''(on some versions, monkey with port [[83Plus:Ports:3A|3A]])''<br />
''(monkey with port [[83Plus:Ports:04|4]])''<br />
''(delay a bit)''<br />
in a,(2)<br />
and 1<br />
jr nz,BatteryGood<br />
res 5,([[83Plus:Flags:18|iy+$18]])<br />
jr Done<br />
BatteryGood:<br />
set 5,(iy+$18)<br />
Done:<br />
''(restore port 4 and/or 3A)''<br />
bit 5,(iy+$18)<br />
ret<br />
:The different versions do different things to port 4; I have no idea what this means.<br />
:On another note: I think these routines should be split up into separate pages. As it is it's not clear that 50B3 is the one that's documented (and has the official name Chk_Batt_Low) and is thus presumably the one TI recommends programmers use. It also needs to be pointed out that the boot code versions are only available on HW version 2 and above!<br />
:[[User:FloppusMaximus|FloppusMaximus]] 14:40, 6 November 2006 (PST)<br />
::I may have misunderstood what this BCALL actually does. I was under the impression that it might be possible to find the state of the batteries doing something other than "in a,(2) / and 1". Someone, please correct me if I'm wrong, but wouldn't it be possible (on any z80 calc) to compare the hardware interrupt speed with other things, such as maybe the link speed, the refresh counter, the LCD speed, LCD contrast, and or the Write-to-Flash speed to try to determine the state of the batteries? (such as if one were trying to determine the battery level more specifically than just Good/Bad) [[User:Saibot84|Saibot84]] 15:25, 6 November 2006 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:BCALLs:50B3
Talk:83Plus:BCALLs:50B3
2006-11-06T17:38:51Z
<p>Saibot84: request</p>
<hr />
<div>==Working Code==<br />
I know this is probably trivial, but I was wondering if someone could please post a simple working example of what this BCALL does (meaning, not exactly a disassembly of the original TIOS code, but an example nonetheless) for those of us who feel BCALLing TIOS routine should be avoided whenever possible. ;^) [[User:Saibot84|Saibot84]] 09:38, 6 November 2006 (PST)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks
83Plus:Basic:Tricks
2006-10-21T16:15:23Z
<p>Saibot84: +(Kevtiva User-Friendly Error Messages)</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks]]<br />
<br />
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 "-" is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)<br />
<br />
__TOC__<br />
<br />
==Memory==<!-- →≠≤≥ --><br />
===Memory Management===<!-- →≠≤≥ --><br />
;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 &pi; as 3.1415926535898 &times; 10<sup>0</sup>, but in memory, it is something more similar (not exact) to <code>0 31415926535898</code> 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 <code>1 13000000000000</code>. 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:<br />
int(fPart(X/10^(int(2-A+log(X))))*10^(F))<br />
: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<sup>value</sup> so that the digit we're looking for (identified in A) is "moved" 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<sup>F</sup> and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).<br />
;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 "N" as a variable, as well as the sequential functions u,v, and w.<br />
;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.<br />
<br />
===Memory Saving===<!-- →≠≤≥ --><br />
;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.<br />
;Never write out closing '''"''' 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.<br />
;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<br />
:Pause "TEXT"<br />
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].<br />
;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.<br />
;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<br />
:{1,2,3,4,5,6,7,8,9→L1<br />
:L1(5 (to retrieve the 5th element of the list)<br />
:try doing<br />
:"{1,2,3,4,5,6,7,8,9→Str1<br />
:expr(Str1<br />
:Ans(5<br />
:or<br />
:"{1,2,3,4,5,6,7,8,9→Y1<br />
:Y1:Ans(5<br />
: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.<br />
;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:<br />
Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1<br />
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.<br />
<br />
==Speed Boosters==<!-- →≠≤≥ --><br />
;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:<br />
<nowiki>Program:LOOPTEST<br />
:Disp "FOR<br />
:For(X,1,10000<br />
:End<br />
:Pause "FOR IS DONE<br />
:1→X<br />
:Disp "WHILE<br />
:While X<10001<br />
:X+1→X<br />
:End<br />
:Pause "WHILE IS DONE<br />
:0→X<br />
:Disp "GOTO<br />
:Lbl XX<br />
:X+1→X<br />
:If X<10001<br />
:Goto XX<br />
Pause "GOTO DONE</nowiki><br />
: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<br />
:While X<Y<br />
:to<br />
:X-1→X<br />
:For(X,X,Y<br />
:X-1→X<br />
: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 ;-)<br />
;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 "waiting" 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 "cancels" any conditions for its waiting for an End.<br />
;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.<br />
<br />
==Graphical Touches==<!-- →≠≤≥ --><br />
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc. Normally, you do something like this:<br />
:Text(15,10,"MY TEXT<br />
:following this, the text "MY TEXT" will be written on the 15th row, in the 10th column, in the small font... however, try adding a "-1" (without the quotation marks) as the first argument...<br />
:Text(-1,15,10,"MY TEXT<br />
:This time, the text "MY TEXT" will be written on the 15th row in the 10th column, in the LARGE font<br />
;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.<br />
;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:<br />
<nowiki>:"vQ6Qv "<br />
:For(X,1,7<br />
:Text(10,9+X,sub(Ans,X,1<br />
:End</nowiki><br />
:Another typical example is that of "drawing" a status bar to the screen using something such as:<br />
<nowiki>(P is the percent to be shaded in)<br />
(L is the length of the bar in pixels)<br />
(H is the horizontal position)<br />
(V is the vertical position, using the top-left corner of the screen as point 0,0)<br />
:Text(V,H,"(<br />
:For(X,0,PL/100<br />
:Text(V,H+X+1,"8<br />
:End<br />
:For(X,1,(100-P)L/100<br />
:Text(V,H+PL/100+X,")<br />
:End</nowiki><br />
: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.<br />
;Simplify your Life:Save a GDB at the beginning of your program. "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." (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. <!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... -->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<br />
;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:<br />
<nowiki>round(94X/(Xmax-Xmin)+47,0)->A<br />
round(-62Y/(Ymax-Ymin)+31,0)->B<br />
-RobbieMc</nowiki><br />
: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<br />
;Get rid of the "Done":use the following right before your program exits to avoid having the calc display the "Done" text on the homescreen<br />
<nowiki>:ClrHome<br />
:"</nowiki><br />
;Get rid of the RunIndic:On the homescreen, do <code>Output(1,16,"_</code> in the loop that is displaying the run indicator. On the graph screen, do <code>Text(-1,0,90,"_</code> in the loop that is displaying the run indicator. (_ in this context refers to the space character.)<br />
<br />
==Cool Hacks==<!-- →≠≤≥ --><br />
;Have " and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a " 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>Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the " quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif<br />
;If condition<nowiki>:</nowiki>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:<br />
<nowiki>(untested...)(lines are numbered)<br />
01:For(X,0,1<br />
02:getKey→K<br />
03:K→X<br />
04:If not(Ans<br />
05:End<br />
06:0→X<br />
07:"-<br />
08:If K=25<br />
09:"LEFT<br />
10:If K=26<br />
11:"UP<br />
12:If K=27<br />
13:"RIGHT<br />
14:If K=34<br />
15:"DOWN<br />
16:If K=45<br />
17:"CLEAR<br />
18:If Ans="-<br />
19:End<br />
20:Disp Ans<br />
21:If K=45<br />
22:1→X<br />
23:End</nowiki><br />
: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 "-" 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 "closes" 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<br />
;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:<br />
<nowiki>(50% tested)<br />
(to convert from Pt coordinates to Pxl coordinates)<br />
A is the X-coord<br />
B is the Y-coord<br />
<br />
{63/(Ymax-Ymin),95/(Xmax-Xmin<br />
<br />
;{pixels per Y, pixels per X<br />
<br />
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1<br />
<br />
;{Y,X,int ppY,int ppX<br />
;Ans(1)Ans(3) is now the Pxl-Y<br />
;Ans(2)Ans(4) is now the Pxl-X</nowiki><br />
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from James Matthew's Asmguru.hlp<br />
<nowiki>:If 0<cos(9)<br />
:Then<br />
:Disp "Degree Mode<br />
:Else<br />
:Disp "Radian Mode<br />
:End</nowiki><br />
;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 &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.<br />
:*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<br />
:*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 ;) <br />
: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.<br />
<nowiki>{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8</nowiki><br />
:That returns the list {0,0,0,2,3,0,0,0}.<br />
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that <br />
<nowiki>abs -1+1 would return 2 on a TI-82<br />
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)</nowiki><br />
:and that one can therefore use the following to display whether the calc is an 82 or 83<br />
Text(0,0,"YOU HAVE A TI-",83-.5(abs -1+1<br />
==Miscellaneous==<!-- →≠≤≥ --><br />
;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>0)+(2X)(X<1), which is the same as If X>0:Y=X^2:If X<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<br />
<nowiki>:length(Str1<br />
:Output(1,1,sub(Str1,1(Ans<96)+16frac(Ans/16)(Ans>95)+(16int(Ans/16)-80)(Ans>95),Ans+80-16int(Ans/16</nowiki><br />
: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 "row" 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, =, ≠, >, <, ≥, ≤. 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+)<br />
;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:<br />
<nowiki>::"Description</nowiki><br />
:That will show the program name with the description you typed.<br />
;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:<br />
<nowiki>PROGRAM:MYSHELL<br />
:program code<br />
:Output(1,1,"ERR:prgmMYSUB MISSING<br />
:prgmMYSUB<br />
:more program code<br />
<br />
PROGRAM:MYSUB<br />
:Output(1,1," "<br />
:The rest of program MYSUB.</nowiki><br />
<br />
==Further Reading==<!-- →≠≤≥ --><br />
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' [http://www.ticalc.org/archives/files/fileinfo/145/14542.html]<br />
<br />
==Special Thanks==<!-- →≠≤≥ --><br />
Special thanks to:<br />
<br />
'''Kevtiva Inc.''' [http://web.archive.org/web/*sr_1nr_315/http://kevtiva.com/* © 2000 Kevtiva Interactive]<br />
<br />
'''BASIC Guru Online''' [http://bgo.netfirms.com/ Copyright © 2000-2006 BASIC Guru Online. All Rights Reserved.]<br />
<br />
'''Detached Solutions''' [http://www.detachedsolutions.com/forum/ © 2000-2006 Detached Solutions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-09-09T19:54:31Z
<p>Saibot84: /* Projects Under Development */</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://nostalgy-os-journal.blogspot.com/ Nostalgy Development Journal] [http://forum.reaktix.com/viewtopic.php?id=3 Reaktix Software Forum>Nostalgy>Introduction]<br />
:'''Current features:'''<br />
:*OS loader<br />
:*Mathematical system calls<br />
:*IM1 poweroff/on<br />
:*IM1 [ON]-hotkey menu<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-09-09T19:53:22Z
<p>Saibot84: /* Projects Under Development */ Nostalgy</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://nostalgy-os-journal.blogspot.com/ Nostalgy Development Journal]<br />
:'''Current features:'''<br />
:*OS loader<br />
:*Mathematical system calls<br />
:*IM1 poweroff/on<br />
:*IM1 [ON]-hotkey menu<br />
:*system information screen: displays OS version, calc type, Boot Code version, Battery state<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:*Sprite:<br />
::*OR-ing<br />
::*XOR-ing<br />
::*clipping<br />
::*masking<br />
:'''Features already implemented, but not yet included:'''<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: scaling<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:ByROMPage
83Plus:OS:ByROMPage
2006-09-09T19:09:28Z
<p>Saibot84: added 1F, 34, 35, 36, 37</p>
<hr />
<div>[[Category:83Plus:OS Information|ByROMPage]]<br />
__TOC__<br />
<br />
=ROM Page 1B / 3B / 7B=<br />
This page contains at the start a list of 3-byte vectors for ROM calls. This is then used by the B_CALL routine to determine what address on what page each ROM call resides. This is page 1B for the TI-83 Plus, 3B for the TI-84 Plus and 7B for the TI-83 Plus Silver Edition & the TI-84 Plus Silver Edition.<br />
<br />
==Structure==<br />
<br />
Each 3-byte vector contains an address and a page number. The address comes first, stored in little-endian format, followed by the page number.<br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|+Example Vector Table<br />
|-<br />
! Address !! Common Name !! LSB Addr. Ptr. !! MSB Addr. Ptr. !! Page Number<br />
|-<br />
! 4000 <br />
| [[83Plus:BCALLs:4000|JErrorNo]] || C7 || 25 || 00<br />
|-<br />
! 4003<br />
| [[83Plus:BCALLs:4003|FontHook]] || A3 || 77 || 7B<br />
|-<br />
! 4006<br />
| [[83Plus:BCALLs:4006|LocalizeHook]] || 44 || 77 || 7B<br />
|}<br />
''Note: The preceding values were obtained from TI-OS v1.15. Values on other OSs are most likely to differ.''<br />
<br />
In this manner, TI can change the address pointer and page of the actual routine on a different OS version (e.g. they needed to update a section of code) and the B_CALL routine would still point to the correct page and address.<br />
<br />
==See Also==<br />
* [[83Plus:OS:How BCALLs work|How BCALLs work]]<br />
<br />
=ROM Page 1F / 3F / 7F=<br />
Boot Code page. Hardware-specific. Currently know Boot Code page versions are 1.00 and 1.02. <br />
* This page contains a list of 3-byte vectors for ROM calls, starting at $4018. <br />
* There appears to be a partial Large Font table starting at 1.00:$6D81 / 1.02:$7184 (Boot Code version:address) containing $F1 characters, excluding the null. (Meaning that at that address, you will find the character whose ASCII code is $01 instead of $00). Each table entry (which corresponds with each character sprite) is in the form: width, 7-byte right-aligned sprite.<br />
* A null-terminated string representation of the current Boot Code version is at $400F. E.g. "1.02 "<br />
* The vector at address $4084 points to the following pseudocode routine:<br />
<nowiki> ld hl,0<br />
ld (844B),hl<br />
ld hl,pointer->.db "BOOT Code ",0<br />
call PutS<br />
ld hl,pointer->.db "1.0X ",0<br />
call PutS<br />
ret</nowiki><br />
:Knowing this, you can find the pointer to the string "BOOT Code ", which is the first entry of the following series of null-terminated strings:<br />
:"BOOT Code ", "FLASH", "RAM", "ID", "OK", " FAILED", "Testing flash", "Waiting...", "Please Install", "operating", "system now."<br />
:You can also find the pointer to the Boot Code's version of PutS.<br />
* 1.00:$5EB3 / 1.02:$5EF7 contains the following series of null-terminated strings:<br />
:"Receiving...", "Operating", "System", "ERROR!", "Press any key to", "turn unit off.", "Then turn unit", "back on.", "Validation Error", "Validating...", "your batteries", "are low.", "Battery", "change is", "required."<br />
:In version 1.02, this series is immediately followed by the null-terminated string "Version Error ".<br />
<br />
=ROM Page 34 / 74=<br />
Contains exclusively USB-related routines.<br />
<br />
=ROM Page 35 / 75=<br />
(highly likely) also contains USB-related routines.<br />
<br />
=ROM Page 36 / 76=<br />
Is the bulk of the DUSB protocol code.<br />
<br />
=ROM Page 37 / 77=<br />
Contains a bunch of app related utility routines (like the ones to parse for the openlib/usb app headers) and had about 6KB of free space in 2.30<br />
<br />
=Sources=<br />
* [http://www.detachedsolutions.com/forum/mv/msg/2939/0/0/ Differences between 84P OS versions]<br />
<br />
=Special Thanks=<br />
* [[User:Dan Englender|Dan Englender]]<br />
* [[User:FloppusMaximus|FloppusMaximus]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:ByROMPage
83Plus:OS:ByROMPage
2006-09-09T18:10:34Z
<p>Saibot84: 83Plus:OS:ROMPage1B moved to 83Plus:OS:ByROMPage</p>
<hr />
<div>[[Category:83Plus:OS Information|ROM Page 1B]]<br />
<br />
This page contains at the start a list of 3-byte vectors for ROM calls. This is then used by the B_CALL routine to determine what address on what page each ROM call resides. This is page 1B for the TI-83 Plus, 3B for the TI-84 Plus and 7B for the TI-83 Plus Silver Edition & the TI-84 Plus Silver Edition.<br />
<br />
==Structure==<br />
<br />
Each 3-byte vector contains an address and a page number. The address comes first, stored in little-endian format, followed by the page number.<br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|+Example Vector Table<br />
|-<br />
! Address !! Common Name !! LSB Addr. Ptr. !! MSB Addr. Ptr. !! Page Number<br />
|-<br />
! 4000 <br />
| [[83Plus:BCALLs:4000|JErrorNo]] || C7 || 25 || 00<br />
|-<br />
! 4003<br />
| [[83Plus:BCALLs:4003|FontHook]] || A3 || 77 || 7B<br />
|-<br />
! 4006<br />
| [[83Plus:BCALLs:4006|LocalizeHook]] || 44 || 77 || 7B<br />
|}<br />
''Note: The preceding values were obtained from TI-OS v1.15. Values on other OSs are most likely to differ.''<br />
<br />
<br />
In this manner, TI can change the address pointer and page of the actual routine on a different OS version (e.g. they needed to update a section of code) and the B_CALL routine would still point to the correct page and address.<br />
<br />
==See Also==<br />
* [[83Plus:OS:How BCALLs work|How BCALLs work]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:ROMPage1B
83Plus:OS:ROMPage1B
2006-09-09T18:10:34Z
<p>Saibot84: 83Plus:OS:ROMPage1B moved to 83Plus:OS:ByROMPage: this page is small, and I think can be more useful if it lists info about more than just one ROM page at a time, unless we're willing to have ROMPage00, ROMPage01, ROMPage02, etc.</p>
<hr />
<div>#redirect [[83Plus:OS:ByROMPage]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:OS:ByROMPage
Talk:83Plus:OS:ByROMPage
2006-09-09T18:10:34Z
<p>Saibot84: Talk:83Plus:OS:ROMPage1B moved to Talk:83Plus:OS:ByROMPage</p>
<hr />
<div>Does the 83- really have this? Shouldn't this be 83Plus:OS:blabla? --[[User:AndyJ|Andy Janata]] 06:31, 10 Sep 2005 (PDT)<br />
:The 83 has 16 rom pages, so yes, this is probably something for the 83Plus section. There isn't any rom page on the 83 that starts with a 3-byte vector table either. --[[User:Kalimero|Kalimero]] 08:11, 10 Sep 2005 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:OS:ROMPage1B
Talk:83Plus:OS:ROMPage1B
2006-09-09T18:10:34Z
<p>Saibot84: Talk:83Plus:OS:ROMPage1B moved to Talk:83Plus:OS:ByROMPage: this page is small, and I think can be more useful if it lists info about more than just one ROM page at a time, unless we're willing to have ROMPage00, ROMPage01, ROMPage02, etc.</p>
<hr />
<div>#redirect [[Talk:83Plus:OS:ByROMPage]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:VersionDifferences
83Plus:OS:VersionDifferences
2006-09-09T17:56:09Z
<p>Saibot84: 83Plus:OS:TIOS VersionDifferences moved to 83Plus:OS:VersionDifferences</p>
<hr />
<div>[[Category:83Plus:OS_Information|VersionDifferences]]<br />
<br />
__TOC__<br />
<br />
<br />
=TIOS 2.21= <!-- --><br />
Released March 2004. This is the first TIOS version that appeared in the TI-84 Plus family of calculators. It maintained all features of the TI-83 Plus family. The following '''new''' features were added:<br />
* real-time clock with timer functions<br />
* USB connectivity support<br />
** calc-to-calc<br />
** calc-to-computer<br />
** calc-to-supported peripheral<br />
* increased Flash ROM support <br />
* "library functions" support <br />
* new TI-BASIC commands:<br />
** setDate(<br />
** setTime(<br />
** CheckTmr(<br />
** SetDtFmt(<br />
** SetTmFmt(<br />
** timeCnv(<br />
** dayOfWk(<br />
** GetDtStr(<br />
** GetTmStr(<br />
** GetDate<br />
** GetTime<br />
** StartTmr<br />
** GetDtFmt<br />
** GetTmFmt<br />
** isClockOn<br />
** ClockOff<br />
** ClockOn<br />
** OpenLib(<br />
** ExecLib<br />
<br />
=TIOS 2.22=<br />
Released August 2004. Added no new "user" features. Modified no "user" features. (Probably fixed some previous bugs.)<br />
<br />
=TIOS 2.30=<br />
Released December 2004. The following '''new''' features were added:<br />
* updated Graph-Table (G-T) Split-Screen mode<br />
* "manual-line fit" - draws data points, as well as a “best fit lineâ€. Allows the user to modify the parameters of a linear function, at the same time seeing the resulting graph.\<br />
* improved graphing of funtions with discontinuities when Xres=1<br />
* new statistics features:<br />
** chi-square goodness of fit test<br />
** confidence interval for slope<br />
** inverse student T<br />
* "plug-and-play" for specific TI-approved peripheral support:<br />
** CBR 2â„¢<br />
** EasyTempâ„¢<br />
* new TI-BASIC commands:<br />
** Manual-Fit<br />
<br />
=TIOS 2.40=<br />
Released November 2005. The following '''new''' features were added:<br />
* extended "plug-and-play" to ~25 sensors (when connected via EasyLinkâ„¢ by Vernier Software & Technology)<br />
* Press-to-Test = pressing Left+Right when turning the calculator on will temporarily disable applications and programs while students are taking an exam. To re-enable applications and programs, send any variable to the disabled calculator.<br />
* TestGuard 2.0 support<br />
* SmartPadâ„¢ support = enables a TI-84 Plus family calculator to provide key inputs to TI-SmartViewâ„¢ emulation and presentation computer software<br />
* updated language localization support<br />
* Write-to-Flash = enables TI-Navigatorâ„¢ Apps to write apps and appvars directly to Flash ROM.<br />
* 31 new B_CALLs added (52CF to 5329)<br />
<br />
=TIOS 2.41=<br />
Release date unknown.<br />
* no new bcalls added<br />
<br />
=Sources=<br />
* [http://www.fayar.net/east/teacher.web/Math/young/dwd/workshops/TI/New%20OS%20Jan%202006/TI-84%20Plus%20family_OS%20versions.doc TI-84 Plus / TI-84 Plus Silver Edition Operating System (OS) Versions]<br />
* [http://www.detachedsolutions.com/forum/mv/msg/2939/0/0/ Differences between 84P OS versions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:TIOS_VersionDifferences
83Plus:OS:TIOS VersionDifferences
2006-09-09T17:56:09Z
<p>Saibot84: 83Plus:OS:TIOS VersionDifferences moved to 83Plus:OS:VersionDifferences: I realized all 83Plus:OS pages, default to TIOS so there's no need to repeat it in the title.</p>
<hr />
<div>#redirect [[83Plus:OS:VersionDifferences]]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:VersionDifferences
83Plus:OS:VersionDifferences
2006-09-09T17:55:12Z
<p>Saibot84: attempt to change title from TIOS_VersionDifferences to VersionDifferences</p>
<hr />
<div>[[Category:83Plus:OS_Information|VersionDifferences]]<br />
<br />
__TOC__<br />
<br />
<br />
=TIOS 2.21= <!-- --><br />
Released March 2004. This is the first TIOS version that appeared in the TI-84 Plus family of calculators. It maintained all features of the TI-83 Plus family. The following '''new''' features were added:<br />
* real-time clock with timer functions<br />
* USB connectivity support<br />
** calc-to-calc<br />
** calc-to-computer<br />
** calc-to-supported peripheral<br />
* increased Flash ROM support <br />
* "library functions" support <br />
* new TI-BASIC commands:<br />
** setDate(<br />
** setTime(<br />
** CheckTmr(<br />
** SetDtFmt(<br />
** SetTmFmt(<br />
** timeCnv(<br />
** dayOfWk(<br />
** GetDtStr(<br />
** GetTmStr(<br />
** GetDate<br />
** GetTime<br />
** StartTmr<br />
** GetDtFmt<br />
** GetTmFmt<br />
** isClockOn<br />
** ClockOff<br />
** ClockOn<br />
** OpenLib(<br />
** ExecLib<br />
<br />
=TIOS 2.22=<br />
Released August 2004. Added no new "user" features. Modified no "user" features. (Probably fixed some previous bugs.)<br />
<br />
=TIOS 2.30=<br />
Released December 2004. The following '''new''' features were added:<br />
* updated Graph-Table (G-T) Split-Screen mode<br />
* "manual-line fit" - draws data points, as well as a “best fit lineâ€. Allows the user to modify the parameters of a linear function, at the same time seeing the resulting graph.\<br />
* improved graphing of funtions with discontinuities when Xres=1<br />
* new statistics features:<br />
** chi-square goodness of fit test<br />
** confidence interval for slope<br />
** inverse student T<br />
* "plug-and-play" for specific TI-approved peripheral support:<br />
** CBR 2â„¢<br />
** EasyTempâ„¢<br />
* new TI-BASIC commands:<br />
** Manual-Fit<br />
<br />
=TIOS 2.40=<br />
Released November 2005. The following '''new''' features were added:<br />
* extended "plug-and-play" to ~25 sensors (when connected via EasyLinkâ„¢ by Vernier Software & Technology)<br />
* Press-to-Test = pressing Left+Right when turning the calculator on will temporarily disable applications and programs while students are taking an exam. To re-enable applications and programs, send any variable to the disabled calculator.<br />
* TestGuard 2.0 support<br />
* SmartPadâ„¢ support = enables a TI-84 Plus family calculator to provide key inputs to TI-SmartViewâ„¢ emulation and presentation computer software<br />
* updated language localization support<br />
* Write-to-Flash = enables TI-Navigatorâ„¢ Apps to write apps and appvars directly to Flash ROM.<br />
* 31 new B_CALLs added (52CF to 5329)<br />
<br />
=TIOS 2.41=<br />
Release date unknown.<br />
* no new bcalls added<br />
<br />
=Sources=<br />
* [http://www.fayar.net/east/teacher.web/Math/young/dwd/workshops/TI/New%20OS%20Jan%202006/TI-84%20Plus%20family_OS%20versions.doc TI-84 Plus / TI-84 Plus Silver Edition Operating System (OS) Versions]<br />
* [http://www.detachedsolutions.com/forum/mv/msg/2939/0/0/ Differences between 84P OS versions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:VersionDifferences
83Plus:OS:VersionDifferences
2006-09-09T17:50:15Z
<p>Saibot84: previous edit I pressed enter and saved before I was finished</p>
<hr />
<div>[[Category:83Plus:OS_Information|TIOS VersionDifferences]]<br />
<br />
__TOC__<br />
<br />
<br />
=TIOS 2.21= <!-- --><br />
Released March 2004. This is the first TIOS version that appeared in the TI-84 Plus family of calculators. It maintained all features of the TI-83 Plus family. The following '''new''' features were added:<br />
* real-time clock with timer functions<br />
* USB connectivity support<br />
** calc-to-calc<br />
** calc-to-computer<br />
** calc-to-supported peripheral<br />
* increased Flash ROM support <br />
* "library functions" support <br />
* new TI-BASIC commands:<br />
** setDate(<br />
** setTime(<br />
** CheckTmr(<br />
** SetDtFmt(<br />
** SetTmFmt(<br />
** timeCnv(<br />
** dayOfWk(<br />
** GetDtStr(<br />
** GetTmStr(<br />
** GetDate<br />
** GetTime<br />
** StartTmr<br />
** GetDtFmt<br />
** GetTmFmt<br />
** isClockOn<br />
** ClockOff<br />
** ClockOn<br />
** OpenLib(<br />
** ExecLib<br />
<br />
=TIOS 2.22=<br />
Released August 2004. Added no new "user" features. Modified no "user" features. (Probably fixed some previous bugs.)<br />
<br />
=TIOS 2.30=<br />
Released December 2004. The following '''new''' features were added:<br />
* updated Graph-Table (G-T) Split-Screen mode<br />
* "manual-line fit" - draws data points, as well as a “best fit lineâ€. Allows the user to modify the parameters of a linear function, at the same time seeing the resulting graph.\<br />
* improved graphing of funtions with discontinuities when Xres=1<br />
* new statistics features:<br />
** chi-square goodness of fit test<br />
** confidence interval for slope<br />
** inverse student T<br />
* "plug-and-play" for specific TI-approved peripheral support:<br />
** CBR 2â„¢<br />
** EasyTempâ„¢<br />
* new TI-BASIC commands:<br />
** Manual-Fit<br />
<br />
=TIOS 2.40=<br />
Released November 2005. The following '''new''' features were added:<br />
* extended "plug-and-play" to ~25 sensors (when connected via EasyLinkâ„¢ by Vernier Software & Technology)<br />
* Press-to-Test = pressing Left+Right when turning the calculator on will temporarily disable applications and programs while students are taking an exam. To re-enable applications and programs, send any variable to the disabled calculator.<br />
* TestGuard 2.0 support<br />
* SmartPadâ„¢ support = enables a TI-84 Plus family calculator to provide key inputs to TI-SmartViewâ„¢ emulation and presentation computer software<br />
* updated language localization support<br />
* Write-to-Flash = enables TI-Navigatorâ„¢ Apps to write apps and appvars directly to Flash ROM.<br />
* 31 new B_CALLs added (52CF to 5329)<br />
<br />
=TIOS 2.41=<br />
Release date unknown.<br />
* no new bcalls added<br />
<br />
=Sources=<br />
* [http://www.fayar.net/east/teacher.web/Math/young/dwd/workshops/TI/New%20OS%20Jan%202006/TI-84%20Plus%20family_OS%20versions.doc TI-84 Plus / TI-84 Plus Silver Edition Operating System (OS) Versions]<br />
* [http://www.detachedsolutions.com/forum/mv/msg/2939/0/0/ Differences between 84P OS versions]</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:OS:VersionDifferences
83Plus:OS:VersionDifferences
2006-09-09T16:43:41Z
<p>Saibot84: documenting TI's document ;)</p>
<hr />
<div>[[Category:83Plus:OS_Information|TIOS VersionDifferences]]<br />
<br />
__TOC__<br />
<br />
<br />
=OS 2.21= Released March 2004, this is</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:83Plus:Ports:3A
Talk:83Plus:Ports:3A
2006-09-08T23:17:31Z
<p>Saibot84: theoretical possibility?</p>
<hr />
<div>Hi guys,<br />
<br />
Does anyone have even the faintest clue what this port is about? I've been having some issues with usb8x working on my 84P Black and not working on my 84P Silver. One of the few differences between the two is that my 84P Black has boot version 1.02 (as opposed to 1.00). There's some USB code (in the 1.02 boot) that checks port 3A and branches depending on the value of bit 3, which is 1 on my 84P Silver and 0 on the Black. I'm trying to figure out if this is a software issue or a hardware issue. Any insights would make you a hero.<br />
<br />
Also, does anyone have an 84P Black with boot other than 1.02 or 84P Silver with boot other than 1.00? If so, what is the value read from port 3A?<br />
<br />
Thanks --[[User:Dan Englender|Dan Englender]] 15:01, 7 September 2006 (PDT)<br />
: Someone with an 84P Silver calc with 1.02 boot just tested and the value of port 3A is 0 on his calculator as well. So either there's a hardware difference (which I'm guessing is the most likely explanation) which 1.02 was meant to handle, or the boot code does something differently on 1.02 which causes the different value on port 3A. Either way, I still have no idea what it means. --[[User:Dan Englender|Dan Englender]] 15:20, 7 September 2006 (PDT)<br />
<br />
The differences between boot 1.00 and 1.02 (I think this is all of them):<br />
* Boot 1.02 on the BE correctly reports the size of the archive (boot 1.00 reports that it has 1504k rather than 480k.)<br />
* Some page numbers used on the BE are changed from 7F to 3F.<br />
* At 6F:4C6E in boot 1.00, an OS has been validated, it's sent the 0006 packet to acknowledge it, and it's just about to boot the newly-loaded OS. It calls 592A (B_CALL 8105). In boot 1.02, it calls 5933 (B_CALL 810E). The only difference between these two routines is that the latter outputs 0 to port 4C.<br />
* At 7F:5B2F in boot 1.00, the boot code is getting ready to receive an OS, and it needs to decide whether to use DBUS or USB, so it polls port 4D. If bits 5 and 6 are both set, it B_CALLs 8108 followed by 810B. These two B_CALLs, located at 5B43, are NOPed out in boot 1.02.<br />
* Curiously, the ''battery checking'' routines are changed. In 1.02, they set bit 7 of port 3A when they start, and clear bit 7 when they finish.<br />
I don't think any of these changes affect routines that are called by the OS, though (or any code that's run in a normal startup.) So I think you're probably looking at changed hardware.<br />
[[User:FloppusMaximus|FloppusMaximus]] 18:28, 7 September 2006 (PDT)<br />
: So perhaps port 3A has something to do with power. Maybe it either disables the USB port (so accurate battery level will be obtained) or determines how much current can be drawn by the USB port (you don't want a USB device killing the batteries). Or something completely different. --[[User:Dan Englender|Dan Englender]] 10:48, 8 September 2006 (PDT)<br />
::Maybe this is a stupid idea, but (theoretically) if it is possible for the USB port to power other devices, isn't it possible for outside sources to power the calc through the USB port? If this is possible, then maybe the battery checking routines are changed so that they won't be thrown off by an external power supply. (then again, I've no idea about USB). [[User:Saibot84|Saibot84]] 16:17, 8 September 2006 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:04
83Plus:Ports:04
2006-09-02T07:12:47Z
<p>Saibot84: /* Synopsis */ added how to clear an int after it's called</p>
<hr />
<div>[[Category:83Plus:Ports:By_Address|04 - Memory Map / Interrupt]] [[Category:83Plus:Ports:By_Name|Memory Map / Interrupt]]<br />
== Synopsis ==<br />
'''Port Number:''' 04h<br />
<br />
'''Function:''' Interrupting Device Identification and Memory Map Control<br />
<br />
This port serves two purposes. When read it indicates the device that triggered an interrupt. When written it sets the memory map mode and hardware timer speed. When an interrupt is triggered, it should be cleared by reseting the corresponding bit in [[83Plus:Ports:03|port 3]]. Otherwise, it will continously call the interrupt code once interrupts are reenabled with ei.<br />
<br />
=== Read Values ===<br />
* Bits 0~2 and 4~7 are set according to which device triggered the running interrupt.<br />
** Bit 0: Set if pressing the ON Key triggered the interrupt.<br />
** Bit 1: Set if the first hardware timer triggered the interrupt.<br />
** Bit 2: Set if the second hardware timer triggered the interrupt.<br />
** Bit 4: Link activity generated an interrupt.<br />
** '''83+SE / 84+ only:''' Bit 5: First crystal timer has expired.<br />
** '''83+SE / 84+ only:''' Bit 6: Second crystal timer has expired.<br />
** '''83+SE / 84+ only:''' Bit 7: Third crystal timer has expired.<br />
* Bit 3 is reset if the ON key is being pressed, set otherwise.<br />
<br />
=== Write Values ===<br />
* Bit 0 reset to select memory map mode 0. In mode 0 the RAM and ROM is mapped to CPU memory as follows:<br />
** Address 0000h ~ 3FFFh: ROM Page 0<br />
** Address 4000h ~ 7FFFh: Memory Bank A (Page selected in [[83Plus:Ports:06|Port 06h]])<br />
** Address 8000h ~ BFFFh: Memory Bank B (Page selected in [[83Plus:Ports:07|Port 07h]])<br />
** '''83+ Basic''': Address C000h ~ FFFFh: RAM Page 0<br />
** '''Everything else''': Address C000h ~ FFFFh: Page selected in [[83Plus:Ports:05|Port 05h]]<br />
* Bit 0 set to select memory map mode 1. In mode 1 the RAM and ROM is mapped to CPU memory as follows:<br />
** Address 0000h ~ 3FFFh: ROM Page 0<br />
** Address 4000h ~ 7FFFh: RAM Page 0<br />
** Address 8000h ~ BFFFh: Memory Bank A (Page selected in [[83Plus:Ports:06|Port 06h]])<br />
** Address C000h ~ FFFFh: Memory Bank B (Page selected in [[83Plus:Ports:07|Port 07h]])<br />
* Bits 1 and 2 control the hardware timer frequency. Setting both 0 sets the timer to the fastest speed, and both 1 is the slowest speed. The normal speed is with both bits 1.<br />
{| width="90%" border="1" cellpadding="2" cellspacing="0" align="center" style="text-align: center"<br />
|+Frequency (Hz)<br />
|-<br />
!&nbsp;<br />
!colspan="2"|first timer<br />
!colspan="2"|second timer<br />
!colspan="2"|both enabled<br />
|-<br />
!value<br />
!width="15%"|83+<br />
!width="15%"|83+SE 84+(SE)<br />
!width="15%"|83+<br />
!width="15%"|83+SE 84+(SE)<br />
!width="15%"|83+<br />
!width="15%"|83+SE 84+(SE)<br />
|-<br />
!00<br />
|560||512||1120||1024||1680||1536<br />
|-<br />
!01<br />
|248||227||497||455||746||682<br />
|-<br />
!10<br />
|170||156||344||315||517||473<br />
|-<br />
!11<br />
|118||108||236||216||353||323<br />
|}<br />
* Bits 4~6 should be 1 on the 83+ and 83+SE, and 0 on the 84+ and 84+SE.<br />
<br />
== Comments ==<br />
The calculator uses mode 0 for normal operation. If you change the memory map mode be sure to change it back before returning control.<br />
Also, do not switch from mode 0 to mode 1 inside the 4000h ~ 7FFFh range, as it will basically crash the calculator because RAM Page 0 will take over that section and RAM Page 0 cannot execute code.<br />
<br />
Interrupt timers seem to be independant of the CPU speed, so setting an SE calculator to 15mhz will not increase the timer frequency.<br />
<br />
== Example ==<br />
This example shows successful use of this port, switching to mode 1 and back. Mode 1 is the only way to execute code beyond address C000h on the 83+ Basic. (Assumes code is running from 4000h (i.e. an application))<br />
<nowiki> in a, (7) ;Save current Bank B page because we'll trash it.<br />
push af<br />
in a,(6) ;Put this app's page into 8000<br />
out (7), a<br />
jp $ + 4003h ;This will actually jump to the next statement, but in Bank B.<br />
ld a, 77h ;Select mode 1 and keep the timer speed at normal...<br />
out (4), a ;Now we're in mode 1.<br />
;We're still at 8000h here but we are back in Bank A.<br />
;Now to go back.<br />
ld a, 76h ;I could dec a for this example, but...<br />
out (4), a ;Back in mode 0 and bank B.<br />
jp $ - 3FFDh ;Jump back to bank A.<br />
pop af<br />
out (7), a ;Restore bank B.</nowiki><br />
<br />
== Credits and Contributions ==<br />
* '''Dan Englender''': Originally documented memory map modes [http://www.detachedsolutions.com/forum/viewtopic.php?p=21593#21593 here]<br />
* '''Michael Vincent''': For his docs [http://www.michaelv.org/programs/calcs/ports/port4.html here], which helped me figure out the interrupt device bits.<br />
* '''James Montelongo''': For his docs [http://www.geocities.com/jimm09876/calc/port4.html here] on the hardware timer.</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:03
83Plus:Ports:03
2006-09-02T07:09:48Z
<p>Saibot84: added bit about needing to clear ints</p>
<hr />
<div>[[Category:83Plus:Ports:By_Address|03 - Interrupt Mask]] [[Category:83Plus:Ports:By_Name|Interrupt Mask]]<br />
== Synopsis ==<br />
'''Port Number:''' 03h<br />
<br />
'''Function:''' Interrupt Masking Port<br />
<br />
This port controls what devices will be allowed to trigger interrupts. When an interrupt is triggered, it should be cleared by reseting the corresponding bit. Otherwise, it will continously call the interrupt code once interrupts are reenabled with ei.<br />
<br />
=== Read Values ===<br />
* Bit 0: Set if pressing the ON key will generate an interrupt.<br />
* Bit 1: Set if the first hardware timer will generate an interrupt (range: 108Hz-512Hz).<br />
* Bit 2: Set if the second hardware timer will generate an interrupt (range: 216Hz-1024Hz).<br />
* Bit 4: Set if the linkport will generate an interrupt.<br />
<br />
=== Write Values ===<br />
* Bit 0: Set 1 to enable the ON key. Set 0 to disable it.<br />
* Bit 1: Set 1 to enable the first hardware timer. Set 0 to disable it.<br />
* Bit 2: Set 1 to enable the second hardware timer. Set 0 to disable it.<br />
* Bit 3: Set 0 to put the calculator in low power mode if and only if the Z80 cpu enters the halt state (during the executing of a halt instruction). Set 1 to keep the calculator powered.<br />
* Bit 4: Set 1 to enable the linkport interrupt. Set 0 to disable it. (Does not completely disable the linkport.)<br />
<br />
== Comments ==<br />
* For normal operation, write 0B (00001011) to this port.<br />
* In low power mode it is known that at least the lcd driver enters standby mode and that the timer hardware has been disabled.<br />
<br />
== Example ==<br />
This example shows how to do a soft powerdown (similar to the auto powerdown) on the calculator.<br />
This may or may not wipe the LCD screen, so you should first copy it's contents to a buffer like saveSScreen and then copy it back afterwards.<br />
<nowiki> push af<br />
ld a, 11h ;Enable linkport, ON key. Disable timer.<br />
;Set low power mode.<br />
out (3), a<br />
halt ;Enter low power mode (disabling various devices)<br />
;and wait for an interrupt (either ON key or<br />
;link activity) which will enable all hardware<br />
;devices again.<br />
ld a, 0Bh ;Enable ON key, timer. Disable linkport.<br />
;Keep calculator powered.<br />
out (3), a<br />
pop af</nowiki><br />
<br />
== Credits and Contributions ==<br />
*'''Michael Vincent''': For documenting [http://www.michaelv.org/programs/calcs/ports/port3.html here] on the interrupt bits.<br />
*'''James Montelongo''': For documenting [http://www.geocities.com/jimm09876/calc/port3.html here] on the interrupt bits.</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-09-01T23:46:11Z
<p>Saibot84: /* Projects Under Development */ link to Nostalgy Development Journal ;)</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system. [http://nostalgy-os-journal.blogspot.com/ Nostalgy Development Journal]<br />
:'''Current features:'''<br />
:*OS loader<br />
:*Mathematical system calls<br />
:*unfinished IM1 poweroff/on<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:'''Features already implemented, but not yet included:'''<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: OR-drawing, XOR-drawing, AND-drawing, scaling, clipping, masking<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-09-01T23:35:59Z
<p>Saibot84: project updates</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;Nostalgy:new 3rd party operating system.<br />
:'''Current features:'''<br />
:*OS loader<br />
:*Mathematical system calls<br />
:*unfinished IM1 poweroff/on<br />
:*beginnings of a CLI, but no commands/input currently implemented<br />
:*Font:<br />
::*4x5 fized-width font<br />
::Styles:<br />
::*inverting<br />
::*clipping<br />
:'''Features already implemented, but not yet included:'''<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: OR-drawing, XOR-drawing, AND-drawing, scaling, clipping, masking<br />
:'''Planned features:'''<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*grayscale<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse<br />
<br />
=Projects Left to Simmer=<br />
;MZip:On-calc data/program compression utility.<br />
:'''Current functional algorithms include:'''<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:'''Future algorithms:'''<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:'''Other Algorithms'''<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
:*HeapSort<br />
<br />
=Abandoned Projects=<br />
;Harry Potter game:Game where the main character is unknown (the main char is '''not''' Harry Potter) and you must decide to fight for the forces of good or to side with Voldemort.<br />
;SysHook:hook chaining manager</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User_talk:AndyJ
User talk:AndyJ
2006-09-01T23:24:12Z
<p>Saibot84: thanks</p>
<hr />
<div>==Thank You==<br />
Thank you for noting that my edit was not minor. I'm sorry, I tend to think that if something is "unimportant" or that probably "no one will care" about it, that it should be marked as minor, but this is not the first time that something I've contributed as minor is later marked as major. Regardless of whether this is the first time you've done this for me, thank you and I'm sorry for not knowing well the difference between a major and minor contribution to WikiTI. -[[User:Saibot84|Saibot84]] 16:24, 1 September 2006 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks
83Plus:Basic:Tricks
2006-09-01T19:08:14Z
<p>Saibot84: Ans as list, added a few : for layout consistency</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks]]<br />
<br />
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 "-" is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)<br />
<br />
__TOC__<br />
<br />
==Memory==<!-- →≠≤≥ --><br />
===Memory Management===<!-- →≠≤≥ --><br />
;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 &pi; as 3.1415926535898 &times; 10<sup>0</sup>, but in memory, it is something more similar (not exact) to <code>0 31415926535898</code> 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 <code>1 13000000000000</code>. 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:<br />
int(fPart(X/10^(int(2-A+log(X))))*10^(F))<br />
: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<sup>value</sup> so that the digit we're looking for (identified in A) is "moved" 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<sup>F</sup> and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).<br />
;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 "N" as a variable, as well as the sequential functions u,v, and w.<br />
;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.<br />
<br />
===Memory Saving===<!-- →≠≤≥ --><br />
;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.<br />
;Never write out closing '''"''' 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.<br />
;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<br />
:Pause "TEXT"<br />
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].<br />
;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.<br />
;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<br />
:{1,2,3,4,5,6,7,8,9→L1<br />
:L1(5 (to retrieve the 5th element of the list)<br />
:try doing<br />
:"{1,2,3,4,5,6,7,8,9→Str1<br />
:expr(Str1<br />
:Ans(5<br />
:or<br />
:"{1,2,3,4,5,6,7,8,9→Y1<br />
:Y1:Ans(5<br />
: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.<br />
;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:<br />
Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1<br />
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.<br />
<br />
==Speed Boosters==<!-- →≠≤≥ --><br />
;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:<br />
<nowiki>Program:LOOPTEST<br />
:Disp "FOR<br />
:For(X,1,10000<br />
:End<br />
:Pause "FOR IS DONE<br />
:1→X<br />
:Disp "WHILE<br />
:While X<10001<br />
:X+1→X<br />
:End<br />
:Pause "WHILE IS DONE<br />
:0→X<br />
:Disp "GOTO<br />
:Lbl XX<br />
:X+1→X<br />
:If X<10001<br />
:Goto XX<br />
Pause "GOTO DONE</nowiki><br />
: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<br />
:While X<Y<br />
:to<br />
:X-1→X<br />
:For(X,X,Y<br />
:X-1→X<br />
: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 ;-)<br />
;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 "waiting" 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 "cancels" any conditions for its waiting for an End.<br />
;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.<br />
<br />
==Graphical Touches==<!-- →≠≤≥ --><br />
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc. Normally, you do something like this:<br />
:Text(15,10,"MY TEXT<br />
:following this, the text "MY TEXT" will be written on the 15th row, in the 10th column, in the small font... however, try adding a "-1" (without the quotation marks) as the first argument...<br />
:Text(-1,15,10,"MY TEXT<br />
:This time, the text "MY TEXT" will be written on the 15th row in the 10th column, in the LARGE font<br />
;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.<br />
;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:<br />
<nowiki>:"vQ6Qv "<br />
:For(X,1,7<br />
:Text(10,9+X,sub(Ans,X,1<br />
:End</nowiki><br />
:Another typical example is that of "drawing" a status bar to the screen using something such as:<br />
<nowiki>(P is the percent to be shaded in)<br />
(L is the length of the bar in pixels)<br />
(H is the horizontal position)<br />
(V is the vertical position, using the top-left corner of the screen as point 0,0)<br />
:Text(V,H,"(<br />
:For(X,0,PL/100<br />
:Text(V,H+X+1,"8<br />
:End<br />
:For(X,1,(100-P)L/100<br />
:Text(V,H+PL/100+X,")<br />
:End</nowiki><br />
: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.<br />
;Simplify your Life:Save a GDB at the beginning of your program. "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." (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. <!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... -->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<br />
;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:<br />
<nowiki>round(94X/(Xmax-Xmin)+47,0)->A<br />
round(-62Y/(Ymax-Ymin)+31,0)->B<br />
-RobbieMc</nowiki><br />
: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<br />
;Get rid of the "Done":use the following right before your program exits to avoid having the calc display the "Done" text on the homescreen<br />
<nowiki>:ClrHome<br />
:Output(1,1,"</nowiki><br />
;Get rid of the RunIndic:On the homescreen, do <code>Output(1,16,"_</code> in the loop that is displaying the run indicator. On the graph screen, do <code>Text(-1,0,90,"_</code> in the loop that is displaying the run indicator. (_ in this context refers to the space character.)<br />
<br />
==Cool Hacks==<!-- →≠≤≥ --><br />
;Have " and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a " 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>Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the " quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif<br />
;If condition<nowiki>:</nowiki>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:<br />
<nowiki>(untested...)(lines are numbered)<br />
01:For(X,0,1<br />
02:getKey→K<br />
03:K→X<br />
04:If not(Ans<br />
05:End<br />
06:0→X<br />
07:"-<br />
08:If K=25<br />
09:"LEFT<br />
10:If K=26<br />
11:"UP<br />
12:If K=27<br />
13:"RIGHT<br />
14:If K=34<br />
15:"DOWN<br />
16:If K=45<br />
17:"CLEAR<br />
18:If Ans="-<br />
19:End<br />
20:Disp Ans<br />
21:If K=45<br />
22:1→X<br />
23:End</nowiki><br />
: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 "-" 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 "closes" 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<br />
;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:<br />
<nowiki>(50% tested)<br />
(to convert from Pt coordinates to Pxl coordinates)<br />
A is the X-coord<br />
B is the Y-coord<br />
<br />
{63/(Ymax-Ymin),95/(Xmax-Xmin<br />
<br />
;{pixels per Y, pixels per X<br />
<br />
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1<br />
<br />
;{Y,X,int ppY,int ppX<br />
;Ans(1)Ans(3) is now the Pxl-Y<br />
;Ans(2)Ans(4) is now the Pxl-X</nowiki><br />
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from James Matthew's Asmguru.hlp<br />
<nowiki>:If 0<cos(9)<br />
:Then<br />
:Disp "Degree Mode<br />
:Else<br />
:Disp "Radian Mode<br />
:End</nowiki><br />
;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 &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.<br />
:*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<br />
:*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 ;) <br />
: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.<br />
<nowiki>{0,0,0,0,0,0,0,0}:augment(seq(Ans(X),X,1,3),augment({2,3},seq(Ans(X),X,6,8</nowiki><br />
:That returns the list {0,0,0,2,3,0,0,0}.<br />
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that <br />
<nowiki>abs -1+1 would return 2 on a TI-82<br />
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)</nowiki><br />
:and that one can therefore use the following to display whether the calc is an 82 or 83<br />
Text(0,0,"YOU HAVE A TI-",83-.5(abs -1+1<br />
==Miscellaneous==<!-- →≠≤≥ --><br />
;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>0)+(2X)(X<1), which is the same as If X>0:Y=X^2:If X<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<br />
<nowiki>:length(Str1<br />
:Output(1,1,sub(Str1,1(Ans<96)+16frac(Ans/16)(Ans>95)+(16int(Ans/16)-80)(Ans>95),Ans+80-16int(Ans/16</nowiki><br />
: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 "row" 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, =, ≠, >, <, ≥, ≤. 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+)<br />
;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:<br />
<nowiki>::"Description</nowiki><br />
:That will show the program name with the description you typed.<br />
<br />
==Further Reading==<!-- →≠≤≥ --><br />
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' http://www.ticalc.org/archives/files/fileinfo/145/14542.html<br />
<br />
==Special Thanks==<!-- →≠≤≥ --><br />
Special thanks to:<br />
<br />
'''Kevtiva Inc.''' http://web.archive.org/web/20021010114152/www.kevtiva.com/calc/index.html © 2000 Kevtiva Interactive<br />
<br />
'''BASIC Guru Online''' http://bgo.netfirms.com/ Copyright © 2000-2006 BASIC Guru Online. All Rights Reserved.<br />
<br />
'''Detached Solutions''' http://www.detachedsolutions.com/forum/ © 2000-2006 Detached Solutions</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:Z80_Routines:Other:IonCompress
Talk:Z80 Routines:Other:IonCompress
2006-07-20T22:04:55Z
<p>Saibot84: sorry</p>
<hr />
<div>Just a small note of no importance to programming. Metaphysics hasn't got anything to do with physics, it's a branch of philosophy. It happens to be called metaphysics because the it is about the writings of Aristotle that come after (meta) his writings about physics. [[User:Mmartin|Mmartin]] 05:08, 20 July 2006 (PDT)<br />
:Sorry, I admit I didn't know that. I assumed metaphysics govern physics and didn't even think about the Greek origins of the words. [[User:Saibot84|Saibot84]] 15:04, 20 July 2006 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=Talk:History_of_the_TI_Z80_community
Talk:History of the TI Z80 community
2006-07-15T16:16:17Z
<p>Saibot84: I<3DS ;)</p>
<hr />
<div>* I've added DS's history <offtopic love of DS>because I consider their products to be leaps and bounds above other programs/apps. They documented A LOT of BCALLS, hooks, etc. when barely anyone knew about them. They've revolutionized programming for the TI-83 Plus</offtopic>. It is because of them that this wiki exists. [[User:Saibot84|Saibot84]] 09:16, 15 July 2006 (PDT)</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=History_of_the_TI_Z80_community
History of the TI Z80 community
2006-07-15T16:10:17Z
<p>Saibot84: added DS history (according to DS news archive)</p>
<hr />
<div>==1996==<br />
:;June: 21: Birth of Ticalc.org<br />
==1998==<br />
==1999==<br />
==2000==<br />
:;May: 01: Detached Solutions Formed<br />
:;July: 14: Detached Solutions IRC Channel Open<br />
::25: MirageOS v1.0 Released (DS)<br />
:;Nov: 07: MirageOS v1.1 Released (DS)<br />
==2001==<br />
:;Jan: 08: CalcSys v1.2 Released (DS)<br />
:;May: 13: PuzzPack Version 2.0 Released (DS)<br />
::25: Michael Vincent joins Detached Solutions Staff<br />
:;July: 27: Birth of MaxCoderz<br />
:;Aug: 18: Virtual Calc v1.0 Released (DS)<br />
::21: Calcsys v1.3 Released (DS)<br />
:;Dec: 14: Symbolic v1.0 Released (DS)<br />
==2002==<br />
:;Apr:11: Omnicalc v1.0 Released (DS)<br />
:;Aug: 11: Kirk Meyer joins Detached Solutions staff <br />
:: 15: Graph³ v1.0 Released (DS)<br />
:: 27: Greg Dietsche joins Detached Solutions staff<br />
:;Oct: 28: DAWG v1.0 Released (DS)<br />
==2003==<br />
:;Mar: 19: Krolypto v1.0 Released (DS)<br />
:;June: 30: Krolypto v1.01 Released (DS)<br />
:;Nov: 16: Krolypto 1.1 Update (DS)<br />
==2004==<br />
:;Feb: 22: Cabamap v1.0 Released (DS)<br />
:;May: 12: MirageOS v1.2 Released (DS)<br />
:;June: 01: OurWorld v1.0 Released (DS)<br />
:;July: 31: Omnicalc v1.2 Released (DS)<br />
:;Aug: 19: Krolypto Updated to v1.3 (DS)<br />
==2005==<br />
:;Oct: 29: Emu8x Released (DS)<br />
==2006==</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=83Plus:Basic:Tricks
83Plus:Basic:Tricks
2006-07-14T19:11:21Z
<p>Saibot84: added link to the Complete TI83 BASIC Optimization Guide under Further Reading</p>
<hr />
<div>[[Category:83Plus:Basic|Tricks]]<br />
<br />
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 "-" is a minus or a negative sign. When the use is un-common-sense-ical or possibly confusing, it will be specified.)<br />
<br />
__TOC__<br />
<br />
==Memory==<!-- →≠≤≥ --><br />
===Memory Management===<!-- →≠≤≥ --><br />
;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 &pi; as 3.1415926535898 &times; 10<sup>0</sup>, but in memory, it is something more similar (not exact) to <code>0 31415926535898</code> 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 <code>1 13000000000000</code>. 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:<br />
int(fPart(X/10^(int(2-A+log(X))))*10^(F))<br />
: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<sup>value</sup> so that the digit we're looking for (identified in A) is "moved" 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<sup>F</sup> and ignores anything to the right of the decimal point, thus providing the sub(X,A,F).<br />
;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 "N" as a variable, as well as the sequential functions u,v, and w.<br />
;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.<br />
<br />
===Memory Saving===<!-- →≠≤≥ --><br />
;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.<br />
;Never write out closing '''"''' 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.<br />
;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<br />
:Pause "TEXT"<br />
:then it writes the text to the homescreen first, and then waits for the user to press [ENTER].<br />
;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.<br />
;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<br />
:{1,2,3,4,5,6,7,8,9→L1<br />
:L1(5 (to retrieve the 5th element of the list)<br />
:try doing<br />
:"{1,2,3,4,5,6,7,8,9→Str1<br />
:expr(Str1<br />
:Ans(5<br />
:or<br />
:"{1,2,3,4,5,6,7,8,9→Y1<br />
:Y1:Ans(5<br />
: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.<br />
;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:<br />
Archive XArchive YArchive ZUnarchive ZUnarchive TDelVar ADelVar BFor(X,0,1<br />
:this doesn't work with Lists, or labels, and presumably neither with the prgm token.<br />
<br />
==Speed Boosters==<!-- →≠≤≥ --><br />
;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:<br />
<nowiki>Program:LOOPTEST<br />
:Disp "FOR<br />
:For(X,1,10000<br />
:End<br />
:Pause "FOR IS DONE<br />
:1→X<br />
:Disp "WHILE<br />
:While X<10001<br />
:X+1→X<br />
:End<br />
:Pause "WHILE IS DONE<br />
:0→X<br />
:Disp "GOTO<br />
:Lbl XX<br />
:X+1→X<br />
:If X<10001<br />
:Goto XX<br />
Pause "GOTO DONE</nowiki><br />
: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<br />
:While X<Y<br />
:to<br />
:X-1→X<br />
:For(X,X,Y<br />
:X-1→X<br />
: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 ;-)<br />
;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 "waiting" 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 "cancels" any conditions for its waiting for an End.<br />
;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.<br />
<br />
==Graphical Touches==<!-- →≠≤≥ --><br />
;Use Text(-1,X,Y,value or text:I learned this from Kevtiva Inc. Normally, you do something like this:<br />
:Text(15,10,"MY TEXT<br />
:following this, the text "MY TEXT" will be written on the 15th row, in the 10th column, in the small font... however, try adding a "-1" (without the quotation marks) as the first argument...<br />
:Text(-1,15,10,"MY TEXT<br />
:This time, the text "MY TEXT" will be written on the 15th row in the 10th column, in the LARGE font<br />
;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.<br />
;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:<br />
<nowiki>:"vQ6Qv "<br />
:For(X,1,7<br />
:Text(10,9+X,sub(Ans,X,1<br />
:End</nowiki><br />
:Another typical example is that of "drawing" a status bar to the screen using something such as:<br />
<nowiki>(P is the percent to be shaded in)<br />
(L is the length of the bar in pixels)<br />
(H is the horizontal position)<br />
(V is the vertical position, using the top-left corner of the screen as point 0,0)<br />
:Text(V,H,"(<br />
:For(X,0,PL/100<br />
:Text(V,H+X+1,"8<br />
:End<br />
:For(X,1,(100-P)L/100<br />
:Text(V,H+PL/100+X,")<br />
:End</nowiki><br />
: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.<br />
;Simplify your Life:Save a GDB at the beginning of your program. "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." (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. <!--You might have to turn the axes back on. but at 5:22 in the morning, I don't remember anymore... -->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<br />
;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:<br />
<nowiki>round(94X/(Xmax-Xmin)+47,0)->A<br />
round(-62Y/(Ymax-Ymin)+31,0)->B<br />
-RobbieMc</nowiki><br />
: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<br />
;Get rid of the "Done":use the following right before your program exits to avoid having the calc display the "Done" text on the homescreen<br />
<nowiki>:ClrHome<br />
:Output(1,1,"</nowiki><br />
;Get rid of the RunIndic:On the homescreen, do <code>Output(1,16,"_</code> in the loop that is displaying the run indicator. On the graph screen, do <code>Text(-1,0,90,"_</code> in the loop that is displaying the run indicator. (_ in this context refers to the space character.)<br />
<br />
==Cool Hacks==<!-- →≠≤≥ --><br />
;Have " and the store arrow in a string:(IIRC, brought to you by Kevtiva Inc.) Type a " 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>Str(Y1,Str1 (or whatever Str you want to store it to and press [ENTER]. You now have the " quote and the store arrow in your string. http://www.meebo.com//skin/default/img/emoticons/wink.gif<br />
;If condition<nowiki>:</nowiki>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:<br />
<nowiki>(untested...)(lines are numbered)<br />
01:For(X,0,1<br />
02:getKey→K<br />
03:K→X<br />
04:If not(Ans<br />
05:End<br />
06:0→X<br />
07:"-<br />
08:If K=25<br />
09:"LEFT<br />
10:If K=26<br />
11:"UP<br />
12:If K=27<br />
13:"RIGHT<br />
14:If K=34<br />
15:"DOWN<br />
16:If K=45<br />
17:"CLEAR<br />
18:If Ans="-<br />
19:End<br />
20:Disp Ans<br />
21:If K=45<br />
22:1→X<br />
23:End</nowiki><br />
: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 "-" 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 "closes" 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<br />
;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:<br />
<nowiki>(50% tested)<br />
(to convert from Pt coordinates to Pxl coordinates)<br />
A is the X-coord<br />
B is the Y-coord<br />
<br />
{63/(Ymax-Ymin),95/(Xmax-Xmin<br />
<br />
;{pixels per Y, pixels per X<br />
<br />
{abs(Ymax-B),abs(Xmin+A),int(Ans(2))+(0=fPart(Ans(2))),int(Ans(1))+(0=fPart(Ans(1<br />
<br />
;{Y,X,int ppY,int ppX<br />
;Ans(1)Ans(3) is now the Pxl-Y<br />
;Ans(2)Ans(4) is now the Pxl-X</nowiki><br />
;Autodetect Degree or Radian Mode:Robert Maresh states that this is one thing he learned from James Matthew's Asmguru.hlp<br />
<nowiki>:If 0<cos(9)<br />
:Then<br />
:Disp "Degree Mode<br />
:Else<br />
:Disp "Radian Mode<br />
:End</nowiki><br />
;Autodetect if the Calculator is an 82 or 83/+:Robert Maresh states that <br />
<nowiki>abs -1+1 would return 2 on a TI-82<br />
abs(-1+1 would return 0 on a TI-83 (this is because the abs is followed by a parenthese)</nowiki><br />
and that one can therefore use the following to display whether the calc is an 82 or 83<br />
Text(0,0,"YOU HAVE A TI-",83-.5(abs -1+1<br />
<br />
==Miscellaneous==<!-- →≠≤≥ --><br />
;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>0)+(2X)(X<1), which is the same as If X>0:Y=X^2:If X<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<br />
<nowiki>:length(Str1<br />
:Output(1,1,sub(Str1,1(Ans<96)+16frac(Ans/16)(Ans>95)+(16int(Ans/16)-80)(Ans>95),Ans+80-16int(Ans/16</nowiki><br />
: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 "row" 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, =, ≠, >, <, ≥, ≤. 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+)<br />
;See program in MirageOS<br />
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:<br />
<nowiki>::"Description</nowiki><br />
That will show the program name with the description you typed.<br />
<br />
==Further Reading==<!-- →≠≤≥ --><br />
'''The Complete TI-83 BASIC Optimization Guide, Version 2''' http://www.ticalc.org/archives/files/fileinfo/145/14542.html<br />
<br />
==Special Thanks==<!-- →≠≤≥ --><br />
Special thanks to:<br />
<br />
'''Kevtiva Inc.''' http://web.archive.org/web/20021010114152/www.kevtiva.com/calc/index.html © 2000 Kevtiva Interactive<br />
<br />
'''BASIC Guru Online''' http://bgo.netfirms.com/ Copyright © 2000-2006 BASIC Guru Online. All Rights Reserved.<br />
<br />
'''Detached Solutions''' http://www.detachedsolutions.com/forum/ © 2000-2006 Detached Solutions</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-05-28T16:54:10Z
<p>Saibot84: /* Abandoned Projects */ not even under slow dev</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;MZip:On-calc data/program compression utility.<br />
:Current functional algorithms include:<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:Future algorithms:<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:Other Algorithms<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
<br />
=Abandoned Projects=<br />
;Nostalgy:new 3rd party operating system.<br />
:Current features:<br />
:*OS loader<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*Mathematical system calls<br />
:Features already implemented, but not yet included:<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: OR-drawing, XOR-drawing, AND-drawing, scaling, clipping, masking<br />
:*Font:<br />
::*4x5 fized-width font<br />
:Planned features:<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*inverting<br />
::*grayscale<br />
::*clipping<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse</div>
Saibot84
https://wikiti.brandonw.net/index.php?title=User:Saibot84
User:Saibot84
2006-05-28T16:51:48Z
<p>Saibot84: updates on projects, and links</p>
<hr />
<div>Name: Michael<br />
<br />
Date-of-Birth: 1-02-1984<br />
<br />
Occupation: Student at Saint Peter's College in Jersey City, NJ<br />
<br />
Area of Study: Philosophy and Elementary Education<br />
<br />
Website: [http://katpro.xiondigital.net/staff/profiles/michael.php Summary]<br />
<br />
=Projects Under Development=<br />
;MZip:On-calc data/program compression utility.<br />
:Current functional algorithms include:<br />
:*Fibonacci encoding/decoding [http://en.wikipedia.org/wiki/Fibonacci_coding]<br />
:*Elias gamma encoding/decoding [http://en.wikipedia.org/wiki/Elias_gamma_coding]<br />
:*Elias delta encoding/decoding [http://en.wikipedia.org/wiki/Elias_delta_coding]<br />
:Future algorithms:<br />
:*Static Huffman [http://en.wikipedia.org/wiki/Huffman_coding]<br />
:*Adaptive Huffman [http://en.wikipedia.org/wiki/Adaptive_Huffman_coding]<br />
:*PuCrunch [http://www.cs.tut.fi/~albert/Dev/pucrunch/]<br />
:*Ion [http://wikiti.denglend.net/index.php?title=Z80_Routines:Other:IonCompress]<br />
:*Burrows-Wheeler Transformation [http://en.wikipedia.org/wiki/Burrows-wheeler]<br />
:*BSTW Algorithm [http://en.wikipedia.org/wiki/Algorithm_BSTW]<br />
:*LS77 [http://en.wikipedia.org/wiki/LZ77_%28algorithm%29] or LZSS [http://en.wikipedia.org/wiki/LZSS]<br />
:Other Algorithms<br />
:*ShellSort [http://en.wikipedia.org/wiki/Shellsort]<br />
<br />
=Abandoned Projects=<br />
;Nostalgy:new 3rd party operating system currently under very slow development.<br />
:Current features:<br />
:*OS loader<br />
:*RAM integrity verification and erasure upon non-integrity detection<br />
:*Mathematical system calls<br />
:Features already implemented, but not yet included:<br />
:*Grayscale: built-in 3,or 4-level grayscale support (based on Duck's grayscale programming package)<br />
:*Audio<br />
::*PlayWAV: built-in WAV playing capabilities<br />
::*PlaySound: built-in sound effects<br />
:*Media: <br />
::*Sprites: OR-drawing, XOR-drawing, AND-drawing, scaling, clipping, masking<br />
:*Font:<br />
::*4x5 fized-width font<br />
:Planned features:<br />
:*User interface: user-selected<br />
::*TIOS Homepage-style command line interface<br />
::*graphical user interface<br />
:*Linking:<br />
::*TIOS: TIOS-compatible routines<br />
::*non-TIOS: non-TIOS compatible routines, which allow for faster connections due to data compression before sending, and decompression upon reciving<br />
:*Compression/Decompression: built-in on-calc data compression/decompression routines with an assortment of different algorithms.<br />
:*Grayscale:<br />
::*user-adjustable interrupt speed (based on Duck's grayscale programming package, but the interrupt speed would be more acutely adjustable)<br />
:*RAM<br />
::*Executable RAM: user RAM programs would begin @ $8200, and thus allows for more executable RAM<br />
::*Stack Space: 3KB reserved stack space<br />
::*Data Management Table: VAT-like system for file management<br />
::*Folder support: the user can create and manage folders both in RAM and ROM<br />
::*Registry: System registry to allow for hook chaining<br />
::*Multi-tasking(?): allow up to three programs to be running simultaneously on RAM page 1<br />
:*ROM<br />
::*Apps: Flash space would be allocated in 4K or 8KB sectors, depending on the user's choice. This would be made possible by having all APPS use only relative jumps/calls<br />
:*Interrupts<br />
::*IM 1 hook: system-supported, chainable<br />
::*IM 2: system-supported, chainable routine<br />
:*Media: <br />
::*Video (like animated gifs?)<br />
::*Video-Audio sync-ing (AVIs?)<br />
:*Font:<br />
::*4x5 variable-width font<br />
::Styles:<br />
::*inverting<br />
::*grayscale<br />
::*clipping<br />
::*centering<br />
::*word-wrap<br />
::*bold<br />
::*underline<br />
:*Keypad-Input<br />
::*"normal" keypad<br />
::*qwerty-style keypad<br />
::*user-remappable<br />
:*External Hardware Drivers<br />
::*PS/2 Keyboard Driver<br />
::*PS/2 Mouse</div>
Saibot84