The Ultimate TI Calculator FAQ - General information on assembly programs

by Patrick Davidson ( pad@ocf.berkeley.edu) - Return to FAQ index - Return to my main page - Twitter - YouTube
  1. What are the best games?
  2. Do I need to worry about programs crashing? Can a program permanently destroy my calculator?
  3. Do I need to worry about viruses or other malicious programs?
  4. Why is it impractical or impossible to type in assembly programs?
  5. Why are additional programs sometimes needed to run assembly programs?
  6. What should I do if a program doesn't seem to work?
  7. How do I report a bug in a program?
  8. What is grayscale?

What are the best games?

There are many games available, and which ones are best is largely a matter of opinion. Not to mention that I have released many such games myself and might not have an unbiased opinion.

One place to look for guidance is the information provided in the archives of ticalc.org. Each file has a description after it. However, the quality of information in these descriptions varies; sometimes low-quality programs have descriptions claiming they are much better than they are. The archives also include screenshots for some programs, which may be informative, but keep in mind that they are only still images (in most cases) that don't reveal how gameplay is. Even animated screenshots often don't realistically show gameplay, as they are only sampled at a limited rate, are from running the program on an emulator (which doesn't usually have quite the same feel to it as running on the actual calculator) and only show what happens for one specific sequence of playing.

The ticalc.org archives include reviews with some programs, and there are many other sites out there which have reviews. There are quite a few web sites that include only selected games (look in the Other Sites section of ticalc.org to find them; in the future, I might put a small list here) and have brief but useful descriptions. However, when examining any type of feedback, descriptions, reviews, or ratings, keep the following in mind:

Archive statistics from ticalc.org tell you how many times a program has been downloaded, both in the current week and for all time. This can help you figure out which programs are more popular, but note the following flaws in using this information:


Do I need to worry about programs crashing? Can a program permanently destroy my calculator?

Short answer: It can happen but shouldn't be a major worry. Read on for some details.

Introduction

A 'crash' is a serious failure of an asm program. This occurs when a program causes the calculator to stop working, or corrupts the memory of the calculator. This includes 'locking up' (when a program suddenly stops functioning, and will not respond to any input, include EXIT or similar keys), when the display fills with garbage and then locks up, when the calculator turns off and won't turn back on (for reasons other than batteries being dead), when a program resets the calculator, etc. Clearly, this is a bad thing.

Even if you are able to recover from a lockup using an escape mechanism from your shell or kernel, it's still considered a crash. Also, on the TI-89 and above, you may be able to escape a crash due to an exception handler in the program, kernel, or shell; in this case the program will suddenly go to a dialog (or exit to the home screen adn give you the message in status text) and display a message like 'Illegal Instruction', 'Address Error', 'Line 1010 Emulator', 'Privilege Violation', etc., or possibly even a debugging screen with 'Exception ## at ######' and a display of register contents. In this case, you can probably survive (by pressing ESC or whatever exit key it mentions) and your data is likely to be intact. This is still a crash, though, and be sure to see the recommendations in the data protect part of this answer about replacing files anyway.

Basic programmers sometimes point to the possibility of crashing as a reason to stick to only using basic programs, but generally speaking, most assembly programs are stable in most cases, and if you test programs a few times and get rid of the ones that crash, you will be mostly if not completely free of future crashes. The worst that is likely to ever happen is that your memory will be erased, which can be easily fixed by re-sending all the files you had on your calculator before (of course, it should go without saying that you need to regularly back up any new files you create on the calculator).

Is permanent damage possible?

First, it is very unlikely, if not impossible, that a program will permanently damage the calculator. The worst thing that can happen is usually that your memory will be erased, or (in very rare cases on the calculators with flash ROM) you may need to resend the operating system to the calculator.

As evidence of this, first note that (in the course of exploring hardware features) programmers have tried writing virtually every possible value to every hardware port of the calculator, but yet have not reported anything causing permanent damage. Additional evidence comes from the fact that programmers themselves don't ruin their calculators this way. In the course of testing my own programs, for example, I experience far more crashes than any user would (because I'm the first one to test it, I notice almost all bugs in a program, which are fixed before any users see the program) on many of the calculators and never experienced any permanent harm caused by a program (though I have worn out a link port by connecting and disconnecting it many times). For this reason I can say that the chance of a program ruining the calculator is very remote, at the most.

While I have received a substantial number of reports of bugs in my programs, occassionally including crashes (which I always fix promptly if the report is detailed enough), nobody has reported that one of these crashes permanently damaged the calculator. Several people have said that that happened, but it has always turned out that the calculator wasn't really ruined. Quite recently, one person wrote me E-Mail complaining that a program I wrote ruined the calculator, but the problem actually turned out to be that the batteries were dead!

On the TI-89, TI-89 Titanium, TI-92 Plus, and Voyage 200, the operating system is stored in flash ROM which is normally protected against modification. The system was designed so that only ROM code, not user programs, can deactivate the protection. However, a method of circumventing this has been discovered so it is possible for programs to modify the ROM. However, the technique for this is very complicated so it's virtually impossible that a buggy program would do it by accident.

How do I recover from a crash?

If the program locks up, the first thing to try is any escape mechanism your shell or kernel might have, such as pressing ON or ESC+ON. This might allow you to exit the program, possibly with all of your data intact.

If the calculator crashes and becomes unusable, you only need to reset it to get it to work again. On the TI-82 through TI-86, usually you can do this by removing one of the main batteries, and pressing ON as you re-insert it. On the TI-89, TI-92, and TI-92+, you can fix many crashes by pressing 2nd + hand + on (TI-92/92+) or 2nd + left + right + on (TI-89). If these measures fail, you will then have to remove all of the batteries, including the lithium backup battery. If you have a TI-82, TI-83, or TI-83+, you may need to leave the batteries out for a couple of hours, as some things in the display controller may keep some of their state for that long. After putting the batteries back in, remember the contrast will be back to default levels, so you may need to increase it to get the screen visible again.

How do I greatly lower the chances of crashes?

The first thing to do is to get the latest versions of every program you have. In many cases, they fix bugs in previous versions which might have caused crashes. Users sometimes complain about problems which have been fixed for months or years. Please don't be one of them.

Additionally, read comments about programs by other users (but keep in mind they may be outdated); especially if a program has a news item on ticalc.org, read the comments under it to see if lots of users have problems.

Of course, the only way to see if a program will surely work on your configuration is to test it on your configuration. Most programs will either crash frequently or never, so just running it a few times will allow you to determine whether it is safe. If you do this testing when you have your Graph-Link available, you will no longer need to worry much about crashes occuring when you're away from your Graph-Link.

How can I protect my data from a crash?

On the TI-89 and TI-92+, you can almost certainly protect everything from a crash by putting it in archive memory, if you have either AMS 2.0x, or have installed Archive Utility (which isn't an option for all users). See the TI-89/92+ section of the FAQ for lots of details on this. This protection is virtually foolproof. However, some things can only be used in RAM. In such cases, you should keep copies of them archived also.

There are also other methods, which can protect even your RAM from crashes. One way is with shells/kernels that provide crash protection by trapping exceptions (TI-89 and up only) and/or allowing you to exit locked-up programs with special key combinations. Be sure to note that these programs are generally not foolproof, as a program might have corrupted memory contents before you exit it.

Additionally, on the TI-86 you can use the 'Chmasc' program to give you some chance of recovering TI-86's memory. See the TI-86 section of the FAQ for details. Since variables are kept in a different page of memory, this gives somewhat better, though still incomplete, protection.

If you have used either method to recover your RAM, don't trust it completely. As soon as you get the chance, you should reset your memory and replace all your files with previous copies, as it is possible that they may have been corrupted. If one program has corrupted another program, the other program might crash (even if it originally had no bugs) at a later time and cause additional programs. Of course, if any files were on your calculator only, back them up before resetting it.


Do I need to worry about viruses or other malicious programs?

Not very much. Archive sites like ticalc.org generally will protect users from hidden harmful programs; if one were snuck in, it would probably be removed as soon as someone complained. As the previous section mentions, the potential for a program to do harm is limited (though an intentionally malicious program could defeat all the memory protection mechanisms).

Some proof of concept viruses have been created for the TI-89, and it is possible they could be made for the other calculators. They have not caused any serious problems however.

Essentially, you just need to avoid any program which is specifically identified as malicious (ticalc.org includes various "virus" or "prank" programs that may be used to annoy users, all of which are clearly identified as such) and don't run anything that someone untrustworthy tells you to run. Even though such programs called "viruses" have been released, they aren't really viruses in that they don't duplicate themselves. They may erase your memory or annoy you though.

In the case of the calculators with flash memory, the flash ROM protection can be cracked, and it is possible that a malicious program could overwrite a section of the ROM needed to receive a new ROM image. Thus it would be possible for the malicious program to permanently ruin the calculator. Such attacks have not yet happened however.


Why is it impractical or impossible to type in assembly programs?

For one thing, on the TI-82, TI-85, and TI-92, you must modify system memory areas to get the assembly programs to run, so you must send a backup to run the programs in the first place. Thus even if you could type them in, you couldn't run them, so what would be the point?

On the other calculators, it is possible to type in assembly programs, but generally not practical. There are built-in assembly facilities on these calculators that you could use. However, using them requires you to type in every byte of the program (in its hexadecimal representation, since it can include characters hard to find and/or not used in regular programs). This means you must enter 2 hexadecimal digits for each byte of the program, easily running into the thousands or even tens of thousands for most substantial games. And making even a slight error can cause the program to fail completely, likely crashing the calculator. If you think you can enter thousands of digits of hexadecimal numbers with no mistakes, then maybe you should try typing in assembly programs. But the rest of us should get Graph-Links.

As a side note, shells/kernels have special program formats, so even this wouldn't be enough for them. You would also have to write and type in an assembly program to read in the main code you'd typed in and convert it into the needed format.


Why are additional programs sometimes needed to run assembly programs?

On the TI-82, TI-85, and TI-92, there is no TI-supported interface to run your own machine code, so the only way to run it is to install a backup which modifies some system memory areas, allowing a user machine code to run. Quite logically, the program of choice is a program which allows you to run any other machine code program you store in memory.

On the TI-83 and TI-83+, the reason for using a shell (Ion) is simply that using TI's format wastes a lot of memory. On the TI-89 and TI-92+, the custom format (supported by the various kernels) is designed mainly to allow more direct access to ROM functions, and to allow use of libraries. But keep in mind that using the special format is not required on any of these calculators.

For more details on these utilities, see the sections referring to each specific calculator.


What should I do if a program doesn't seem to work?

It's possible that the program just doesn't work. If the program will run, but seems to run incorrectly, see the next section. If a program can't run at all, the following might solve the problem:


How do I report a bug in a program?

If you encounter any bug in a program, especially a serious one like a crash, you should report it to the program's author immediately. Normally, E-Mail is used; check the program and/or its documentation for the author's E-Mail address. Please use the following guidelines to ensure that your report will be useful:



What is grayscale?

Grayscale refers to displaying more than two different colors on the calculator's screen. Even though the screen was designed to display only two colors, the illusion of having more colors can be made by changing between different images very rapidly; pixels that are drawn in all images appear just as dark as pixels drawn normally, those that are clear in all images appear as the regular clear color, and pixels drawn in only some of the images will appear as having colors somewhere between them.

Grayscale can be used very effectively on the TI-85 and above. There have been some problems with grayscale on TI-89 and TI-92+ calculators with hardware version 2, but these problems have now been solved. Grayscale has also been attempted on the other TI calculators, but due to the display controller causes it to use a large amount of CPU time, and there are also some problems with flickering.

Grayscale is most commonly used to display 4 colors (which requires two screen buffers; one is usually shown 1/3 of the time and the other 2/3 of the time, but other frequencies such as 2/5 and 3/5 have also been used). Sometimes 3-color (two buffers shown an equal amount of time), 7-color, and 8-color grayscale is also used.

Since drawing 4-color grayscale images requires drawing into two buffers, it takes (nearly) twice as much processing to draw such images. However, other parts of a program aren't slowed down, so well-programmed games can still run at a high speed using 4-color grayscale (using more than 4 colors is not common, except for still images, as it probably couldn't be perceived clearly on a changing display and thus mainly wastes memory and processing time).

The appearance of grayscale depends heavily on the contrast setting; if it is too high, intermediate colors may appear fully dark, and if too low, they may appear fully light. To get the best results you may need to experiment with changing the contrast setting of your display.