📜 ⬆️ ⬇️

TI-89 Titanium Calculator and C Programming

Not so long ago on Habré there was an article about the TI-83 graphing calculator, and since I am the owner of TI-89 Titanium, the next generation calculator from Texas Instruments, I decided to talk about it under the cut and show how you can create your own calculator for this calculator. own programs in C.

Unlike the TI-83, which is based on the 8-bit microprocessor z80, the TI-89 Titanium is created using the 32-bit Motorola 68000:

image

In addition, TI-89 Titanium has a number of other improvements. Here I will give a brief description of it:
')
The processor is 12 MHz MC68000, the screen is monochrome, 160x100 pixels, 256K RAM (188K available to the user), 4M Flash ROM (approximately 2.7M available to the user), Standard I / O (never used), USB Mini Port (used for sharing information with a regular computer):

image

It is powered by four AAA batteries (I must say that it consumes quite a lot, so with intensive use, the batteries have to be changed quite often). There is also an additional battery that saves the settings when replacing the main batteries:

image

There are many online resources dedicated to TI calculators and, in particular, TI-89 Titanium. An example is www.ticalc.org . On this resource you can find a huge number of different descriptions, programs and sources for this and other TI calculators, for example, toys.

In fact, this calculator is designed for mathematical calculations, and contains a CAS (computer algebra system), which allows you to perform not only numerical calculations, but also calculations in symbolic form:

image

But we are interested in how to create our own C programs. For this, there is a tigcc compiler (http://tigcc.ticalc.org) created on the basis of gcc. Unfortunately, this project has not been updated for a long time, but, nevertheless, the compiler is working. Download it and install it on your Linux workstation. After that, with its help we compile some simple console application of the “Hello world!” Type and get a file with extension 89z. This is our executable file.

The next step is to upload our program to the calculator. To do this, install the tilp application by running "sudo apt install tilp2", connect the USB cable and run tilp. Next, select the files that need to be unloaded (for example, our program) and start the unloading process. As soon as one or several files are uploaded to the calculator, you can view their list by pressing 2nd + VAR-LINK. In order to start the loaded program, go to the calculator in HOME, where the usual calculations are performed and type the name of the program, followed by parentheses, that is, simply call the program as a function without arguments.

Regular console programs are not so interesting, so there are functions for drawing various primitives on the screen, reading keystrokes, etc. As one of the interactive applications, I adapted my program for playing reversi. It looks like this:

image

The source of this program can be downloaded from my site here .

It should be noted that, unfortunately, tigcc does not know how to optimize the code well, so programs are not the fastest. This can be corrected if you write in assembler, and at the same time understand how much the command system of Motorola 68000 is better than that of x86. Many examples of assembler programs can be downloaded from ticalc.org.

And last but not least. If you do not have such a calculator, you can still play around with it. To do this, you need to install the emulator “sudo apt install tiemu”, which looks and works exactly like its iron counterpart:

image

Source: https://habr.com/ru/post/449764/


All Articles