Unity is an assembly program loader for the Texas Instruments TI-81 graphing calculator. It serves as an extension to the TI-81's operating system, allowing you to run your own Z80 assembly programs on the calculator.
Assembly programs can be considerably faster than those written in the calculator's built-in, BASIC-like language. Assembly programs can also do many things that are impossible or extremely difficult in BASIC. Unfortunately, this power also means that assembly programs can easily crash the calculator, destroying any data and programs you have saved, and often requiring a full reset of the calculator. Unity has been tested a fair amount, but bugs do creep in, and there is, of course, no warranty of any kind for this software.
The latest version of this program can be found on ticalc.org.
Unity is intended to work on any version of the TI-81, either the "old" or "new" style hardware. While Unity has not been tested on every ROM version in existence, it is likely that it will work on all of them.
Most assembly programs, however, use ROM subroutines (e.g., for printing text or scanning the keypad), and these routines need to be catalogued separately for each ROM version. The example programs in this package currently support ROM versions 1.1K, 1.6K, 1.8K, and 2.0V. To find your ROM version, press 2nd MATH ALPHA LN. (Then press CLEAR to exit the screen.)
Information about other ROM versions is always welcome; you can contact me at floppusmaximus@users.sourceforge.net.
Unity will work on any true TI-81 emulator (one that emulates the "ghost RAM" space.) I'm aware that some folks have tried running a TI-81 ROM image with a TI-85, TI-86, or TI-82 emulator; although Unity itself would work fine on such an emulator, the installation procedure described below will not. A special (and somewhat more complex) installation procedure would have to be developed in order to support those emulators.
Unity will not work on TI's PC-81 emulator, since that program does not emulate the calculator's Z80 CPU at all.
Read the following instructions carefully and follow the steps in the order shown. If you type something incorrectly, the calculator may or may not crash, but it almost certainly won't work right.
Note: Installing Unity will replace any existing assembly loader or shell on your calculator.
To begin, enter the following three programs into the calculator. The first program must be entered as Prgm0; the other two can use different program slots if you prefer. The left column shows the program as it appears on the calculator screen; the right column shows the individual keys to press.
Don't forget the blank line at the end of Prgm0; it's important.
Prgm0: UDATA | |
---|---|
:JRTVWIHIWTUKHRS | 2nd ALPHA EE; ×; 4; 6; -; x²; ^; x²; -; 4; 5; (; ^; ×; LN |
VTHJKHTJHWQVSJIH | 6; 4; ^; EE; (; ^; 4; EE; ^; -; 9; 6; LN; EE; x²; ^ |
OHHTUQSUKUPTHPOJ | 7; ^; ^; 4; 5; 9; LN; 5; (; 5; 8; 4; ^; 8; 7; EE |
PWPVUNRKHWQJJPWU | 8; -; 8; 6; 5; LOG; ×; (; ^; -; 9; EE; EE; 8; -; 5 |
KHNHRKNHITUQSUKK | (; ^; LOG; ^; ×; (; LOG; ^; x²; 4; 5; 9; LN; 5; (; ( |
PIPJHIIPOJPWNTSI | 8; x²; 8; EE; ^; x²; x²; 8; 7; EE; 8; -; LOG; 4; LN; x² |
NKHWQJKKNHIIHWLJ | LOG; (; ^; -; 9; EE; (; (; LOG; ^; x²; x²; ^; -; ); EE |
SOVSUJPVLKVUKJWV | LN; 7; 6; LN; 5; EE; 8; 6; ); (; 6; 5; (; EE; -; 6 |
OTQOQVNWPJHWNWST | 7; 4; 9; 7; 9; 6; LOG; -; 8; EE; ^; -; LOG; -; LN; 4 |
UTUUKWWKVHQKJHPV | 5; 4; 5; 5; (; -; -; (; 6; ^; 9; (; EE; ^; 8; 6 |
KKJHTVKTQVMJRUHW | (; (; EE; ^; 4; 6; (; 4; 9; 6; ÷; EE; ×; 5; ^; - |
IKOVUMJVIUPIRTNI | x²; (; 7; 6; 5; ÷; EE; 6; x²; 5; 8; x²; ×; 4; LOG; x² |
LTPTNQKWVISKPIHT | ); 4; 8; 4; LOG; 9; (; -; 6; x²; LN; (; 8; x²; ^; 4 |
MVMJIWOUKHIHMHHV | ÷; 6; ÷; EE; x²; -; 7; 5; (; ^; x²; ^; ÷; ^; ^; 6 |
USIOQVITITHTNISV | 5; LN; x²; 7; 9; 6; x²; 4; x²; 4; ^; 4; LOG; x²; LN; 6 |
UMKTVWIIKRQHOHOH | 5; ÷; (; 4; 6; -; x²; x²; (; ×; 9; ^; 7; ^; 7; ^ |
OLWVNWPWNHLSWTQH | 7; ); -; 6; LOG; -; 8; -; LOG; ^; ); LN; -; 4; 9; ^ |
HHHHHHHHHWMTMUMV | ^; ^; ^; ^; ^; ^; ^; ^; ^; -; ÷; 4; ÷; 5; ÷; 6 |
MKVSWUKHIUSHIVVV | ÷; (; 6; LN; -; 5; (; ^; x²; 5; LN; ^; x²; 6; 6; 6 |
VJHHLWUTSHIUVJIT | 6; EE; ^; ^; ); -; 5; 4; LN; ^; x²; 5; 6; EE; x²; 4 |
UUKWUTSHHMNTLLOU | 5; 5; (; -; 5; 4; LN; ^; ^; ÷; LOG; 4; ); ); 7; 5 |
KVIUITIWITKKPHHH | (; 6; x²; 5; x²; 4; x²; -; x²; 4; (; (; 8; ^; ^; ^ |
HVTTMWULHUKSQVTJ | ^; 6; 4; 4; ÷; -; 5; ); ^; 5; (; LN; 9; 6; 4; EE |
NJNOU | LOG; EE; LOG; 7; 5; ENTER |
:SXUGBTYICV"UNV? | 2nd ALPHA LN; STO▸; 5; TAN; MATRX; 4; 1; x²; PRGM; 6; +; 5; LOG; 6; (-) |
FHLEMCJ θYYAAθPH | COS; ^; ); SIN; ÷; PRGM; EE; 0; 3; 1; 1; MATH; MATH; 3; 8; ^ |
UQMGNFWCLHU LCT | 5; 9; ÷; TAN; LOG; COS; -; PRGM; ); ^; 5; 0; 0; ); PRGM; 4 |
CWBLBMZIAXPOBIRA | PRGM; -; MATRX; ); MATRX; ÷; 2; x²; MATH; STO▸; 8; 7; MATRX; x²; ×; MATH |
J,? AFY NHD"AAB | EE; .; (-); 0; MATH; COS; 1; 0; 0; LOG; ^; x⁻¹; +; MATH; MATH; MATRX |
AAFJJD,LAXPOBMRE | MATH; MATH; COS; EE; EE; x⁻¹; .; ); MATH; STO▸; 8; 7; MATRX; ÷; ×; SIN |
"PYHTGBNθ"QLXθZθ | +; 8; 1; ^; 4; TAN; MATRX; LOG; 3; +; 9; ); STO▸; 3; 2; 3 |
WRT YELI ERINSUθ | -; ×; 4; 0; 1; SIN; ); x²; 0; SIN; ×; x²; LOG; LN; 5; 3 |
?XZTFAGOAJJAIRNθ | (-); STO▸; 2; 4; COS; MATH; TAN; 7; MATH; EE; EE; MATH; x²; ×; LOG; 3 |
V"VNZVSTI"XCUNA | 0; 6; +; 6; LOG; 2; 6; LN; 4; x²; +; STO▸; PRGM; 5; LOG; MATH |
HKBπPTPPRJθE | ^; (; MATRX; 2nd ^; 2nd ALPHA 8; 4; 8; 8; ×; EE; 3; SIN; ENTER |
: |
Prgm1: USETUP | |
---|---|
:"Y3−OffH0Wtan-1 | ALPHA +; 2nd VARS ← 4; ALPHA ^; 0; ALPHA -; 2nd TAN |
* nCr tan = nPr | ×; MATH ← 3; TAN; 2nd MATH 1; MATH ← 2 |
Xmax≤Sci8(≠ClrHo | VARS ← 2; 2nd MATH 6; MODE 2; 8; (; 2nd MATH 2; PRGM → 5 |
mePT−On(XmaxFPar | 2nd PRGM 3; VARS ← 2; MATH → 3 |
t Bcol2 √Y4−OnPT | VARS ← ← 4; 2; ALPHA 0; 2nd x²; 2nd VARS → 5; 2nd PRGM 3 |
−On(≠2DispHomeAl | 2nd MATH 2; 2; PRGM → 3; 2nd VARS → 1 |
l−OnScatterlog 8 | 2nd MATRX → 2; LOG; 8 |
aY1T+W+X3T−OnF≤ | VARS → → 1; 2nd VARS 6; +; ALPHA -; +; 2nd VARS → 8; ALPHA COS; 2nd MATH 6; ALPHA 0 |
≠ DispHomeConnec | 2nd MATH 2; ALPHA 0; PRGM → 3; MODE → 3 |
tedR▸P(log 0.38A | MATH 1; LOG; 0; .; 3; 8; 2nd VARS → 1 |
ll−OnXminY3−Off0 | VARS ← 1; 2nd VARS ← 4; 0 |
SequenceY25PT−Of | MODE → 5; 2nd VARS 2; 5; 2nd PRGM 4 |
f(Y2−OffY2−On≠PT | 2nd VARS ← 3; 2nd VARS → 3; 2nd MATH 2; 2nd PRGM 4 |
−Off(!ClrDrawY2− | MATH 5; 2nd PRGM 1; 2nd VARS → 3 |
On*Row+(All−OffY | MATRX 4; 2nd VARS ← 1; 2nd VARS → 3 |
2−On≠PT−Off(sinh | 2nd MATH 2; 2nd PRGM 4; MATH → → 1 |
"≠→PT−Off(All−O | ALPHA +; 2nd MATH 2; STO▸; 2nd PRGM 4; 2nd VARS → 1 |
nY3−OffDispHomeB | 2nd VARS ← 4; PRGM → 3; VARS ← ← 3 |
rowY3)PT−Off(≠ D | 2nd VARS 3; ); 2nd PRGM 4; 2nd MATH 2; ALPHA 0; PRGM → 3 |
ispHome1-1All−Off | 1; x⁻¹; 2nd VARS ← 1 |
Round(.BcolCcol2 | MATH → 1; .; VARS ← ← 4; VARS ← ← 6; 2 |
≤→Y2−PT−Off(X3T" | 2nd MATH 6; STO▸; 2nd VARS 2; -; 2nd PRGM 4; 2nd VARS 9; ALPHA + |
→Y2 | STO▸; 2nd VARS 2; ENTER |
:"PT−On("→Y3T | ALPHA +; 2nd PRGM 3; ALPHA +; STO▸; 2nd VARS 0; ENTER |
:"(⁻1)^π"→Y1 | ALPHA +; (; (-); 1; ); ^; 2nd ^; ALPHA +; STO▸; 2nd VARS 1; ENTER |
:0→X | 0; STO▸; ALPHA STO▸ |
Prgm2: ULAUNCH | |
---|---|
:"PT−On(PT−On(PT | ALPHA +; 2nd PRGM 3; 2nd PRGM 3; 2nd PRGM 3 |
−On(PT−On(PT−On( | 2nd PRGM 3; 2nd PRGM 3 |
PT−On(PT−On(PT−O | 2nd PRGM 3; 2nd PRGM 3; 2nd PRGM 3 |
n(PT−On(PT−On(PT | 2nd PRGM 3; 2nd PRGM 3; 2nd PRGM 3 |
−On(PT−On(PT−On( | 2nd PRGM 3; 2nd PRGM 3 |
PT−On(PT−On(PT−O | 2nd PRGM 3; 2nd PRGM 3; 2nd PRGM 3 |
n("→X3T | ALPHA +; STO▸; 2nd VARS 9; ENTER |
:X+1→X | ALPHA STO▸; +; 1; STO▸; ALPHA STO▸; ENTER |
:If X<9 | PRGM 3; ALPHA STO▸; 2nd MATH 5; 9; ENTER |
:Prgm2 | PRGM ← 2; ENTER |
:0→X | 0; STO▸; ALPHA STO▸; ENTER |
:Input X | PRGM → 2; ALPHA STO▸ |
Once you've entered the programs above (and double-checked Prgm1 to be sure it's correct), do the following:
After a few seconds, one of the following will be displayed:
Note: after erasing the installer programs, you may notice that you have 442 fewer bytes of free memory than you had before (unless you previously had a different assembly loader or shell installed.) This is normal and expected.
To run an assembly program, just type it in and run it as you would a normal BASIC program. (If you want, you can call an assembly program as a subroutine from a BASIC program, or even embed assembly code in the middle of a BASIC program.) Assembly programs begin with a Pause command (PRGM 6), followed by ++ and a long line of text.
If you type something incorrectly in an assembly program, you will receive the message ERROR 53 INVALID. Press ENTER to view the location where the error was detected (the actual incorrect character is probably either immediately after the cursor or somewhere in the line above it.)
Here is an example program you can try:
Program: HELLO | |
---|---|
:Pause | PRGM 6; ENTER |
:++RπθRCF?VIMYEN | +; +; ALPHA ×; 2nd ^; 2nd ALPHA 3; ×; PRGM; COS; (-); 6; x²; ÷; 1; SIN; LOG |
XWθRRJ?"FXK NOEE | STO▸; -; 3; ×; ×; EE; (-); +; COS; STO▸; (; 0; LOG; 7; SIN; SIN |
NEBL",GBQLπPI ,G | LOG; SIN; MATRX; ); +; .; TAN; MATRX; 9; ); 2nd ^; 2nd ALPHA 8; x²; 0; .; TAN |
A | MATH |
When a BASIC program crashes, you can always halt it by pressing ON. This is not true for most assembly programs, because by their nature they take full control of the CPU. If an assembly program freezes, you can force the calculator to power off by pressing and holding the Y= and GRAPH keys, then pressing ON. This will work so long as the assembly program does not disable interrupts; I highly recommend that, in writing assembly programs, you leave interrupts enabled whenever possible.
You can use the asm81 assembler, included with this package, to assemble programs. The ti81.inc header file defines a large collection of ROM routines, RAM areas, and constants that you can use. Many of the ROM routines are similar to their counterparts on later TI calculators, but there are some important differences. See program.txt for more information.
When you change the calculator's batteries, the CPU is reset, thus disabling Unity (or any other IM 2 hook.) The RAM contents, however, are retained (you are using a backup battery, right?) Assuming Unity was properly installed prior to removing the batteries, you can use the following program to re-enable it, rather than having to retype the full installer code.
If Unity was not previously installed correctly, running this program will crash the calculator completely.
Enter the following program, as well as Prgm2 from above.
Prgm3: URELOAD | |
---|---|
:"log 8sinh Y1−O | ALPHA +; LOG; 8; MATH → → 1; 2nd VARS ← 2 |
ff2-12Fsinh 0Disp | 2; x⁻¹; 2; ALPHA COS; MATH → → 1; 0; PRGM → 3 |
HomeBrowY3X1T−Of | VARS ← ← 3; 2nd VARS 3; 2nd VARS ← 6 |
fPT−On(≠X2T−OnPT | 2nd PRGM 3; 2nd MATH 2; 2nd VARS → 7; 2nd PRGM 3 |
−On(XmaxFPart Bc | VARS ← 2; MATH → 3; VARS ← ← 4 |
ol√All−OffPT−On( | 2nd x²; 2nd VARS ← 1; 2nd PRGM 3 |
≠Y4−OffPT−On(All | 2nd MATH 2; 2nd VARS ← 5; 2nd PRGM 3; 2nd VARS → 1 |
−OnY3−Off≠2DispH | 2nd VARS ← 4; 2nd MATH 2; 2; PRGM → 3 |
omeAll−OnScatter | 2nd VARS → 1; 2nd MATRX → 2 |
8PT−On("→Y2 | 8; 2nd PRGM 3; ALPHA +; STO▸; 2nd VARS 2; ENTER |
:"PT−On("→Y3T | ALPHA +; 2nd PRGM 3; ALPHA +; STO▸; 2nd VARS 0; ENTER |
:"(⁻1)^π"→Y1 | ALPHA +; (; (-); 1; ); ^; 2nd ^; ALPHA +; STO▸; 2nd VARS 1; ENTER |
:0→X | 0; STO▸; ALPHA STO▸ |
To run this program, use basically the same procedure as for the original installation:
The programs in this package are free software, and you are permitted (and encouraged) to modify and/or redistribute them, under the terms of the GNU General Public License.
There is no warranty of any kind for this software; please see the GNU General Public License for more information.
A few people deserve a lot of credit for helping to make this program possible:
Joerg Woerner has published a lot of great information about the hardware internals of the TI-81 (and lots of other devices besides.)
Xavier Andreani (aka critor) has been extremely helpful in finding information about the less common early versions of the TI-81.
And Randy Compton (aka Mr. Z) discovered the OS bug that is used to launch the Unity installation, not to mention publishing some very helpful documentation of ROM 1.8K.
Finally, thanks to the entire calculator programming community for being so awesome!