TI-85 Link Protocol Guide v1.0 - Variable formats


Variable Formats

A TI-85 variable has two parts: a header and a data section. While the header may be different, the format of the data section never changes whether the variable is in a file, in a transfer packet, or in the calculator's memory. This section describes the format of the data section for most types of variables. The format for the header is described in the packet format and the file format section.

Variable Types

There are several types of variables that the TI-85 uses.

Real Numbers are basic floating-point numbers.
Complex Numbers are basic complex numbers with real and imaginary floating-point components.
Vectors are one-dimensional matrices with real or complex components.
Lists are sequences of real or complex numbers used in statistical calculations.
Matrices are two-dimensional matrices with real or complex components.
Constants are real or complex user-defined variables that cannot be changed from the home screen or a program.
Equations are functions that evaluate based on the values of one or more variables.
Strings are sequences of text characters.
Graphics Databases (GDB's) are stored sets of graphing functions.
Pictures are stored bitmaps of the graph screen.
Programs are sequences of commands.
Ranges are stored sets of graph screen range parameters.

Real Numbers

The TI-85's representation of a real number has the following format:

Offset Length Description
0 1 byte Flags (see table below)
1 2 bytes Base-10 exponent
3 7 bytes Mantissa

The flags byte has the following format:

Bit (Mask) Description
0 (01h) If set, the number is half of a complex value.
6 (40h) Uncertain. Most likely if set, the number has not been modified since the last graph.
7 (80h) Sign bit: If set, the number is negative.

The exponent is a 16-bit unsigned little-endian (LSB first) binary number normalized at FC00h. The real exponent can be computed by subtracting FC00h from the value stored here. Valid exponents are in the range -999 to 999.

The mantissa is stored as a 14-digit unsigned binary-coded-decimal number. The most significant digit is first and the implied decimal point is always between the first two digits. Every nybble (4 bits or half a byte) contains one digit, according to the following table:

Binary Value Decimal Digit

0000

0

0001

1

0010

2

0011

3

0100

4

0101

5

0110

6

0111

7

1000

8

1001

9

Complex Numbers

A complex number is represented as a two real numbers, both with flag bit 0 set. The format is shown below.

Offset Length Description
0 10 bytes A real number describing the "real" component of the complex number.
10 (Ah) 10 bytes A real number describing the "imaginary" component of the complex number.

Vectors

A vector is represented as a one-column matrix. The format is shown below.

Offset Length Description
0 1 byte Always set to 1
1 1 byte Number of elements in the vector (no more than 255)
2 n bytes Element values, one by one, first to last. If the vector is a real vector, then each element is a 10-byte real number. If the vector is a complex vector, then each element is a 20-byte complex number.

Lists

A list is represented as a sequence of numbers. The format is shown below.

Offset Length Description
0 2 bytes Number of elements in the list
1 n bytes Element values, one by one, first to last. If the list is a real list, then each element is a 10-byte real number. If the list is a complex list, then each element is a 20-byte complex number.

Matrices

A matrix is represented as a two-dimensional array of numbers. The format is shown below.

Offset Length Description
0 1 byte Number of columns in the matrix (no more than 255)
1 1 byte Number of rows in the matrix (no more than 255)
1 n bytes Element values, one by one (see explanation below). If the matrix is a real matrix, then each element is a 10-byte real number. If the matrix is a complex matrix, then each element is a 20-byte complex number.

The element values are arranged in row definitions from top to bottom. Each row consists of a number of real or complex elements from left to right. Under this scheme, [ [ 1, 2 ] [ 3, 4 ] ] would be ordered (1,2,3,4) in memory.

Constants

Real constants share the same format as real numbers. Complex constants share the same format as complex numbers.

Equations

Equations share the same format as strings. They are always tokenized. Click here for a table of token definitions.

Strings

Strings are represented as a sequence of characters following a length byte:

Offset Length Description
0 2 bytes Number of characters in the string
2 n bytes Characters, first to last. The string is not zero-terminated.

Graphics Databases (GDB's)

GDB's for each graphing mode are different, but they all consist of a window setup portion and a function library portion.

A function-mode GDB has the following format:

Offset Length Description
0 2 bytes Length, in bytes, of GDB, minus two.
2 1 byte Mode settings (see mode setting table below)
3 10 bytes A real number: xMin
13 (Dh) 10 bytes A real number: xMax
23 (17h) 10 bytes A real number: xScl
33 (21h) 10 bytes A real number: yMin
43 (2Bh) 10 bytes A real number: yMax
53 (35h) 10 bytes A real number: yScl
63 (3Fh) 10 bytes A real number: xRes
73 (49h) 1 byte Number of functions defined (up to 99)
74 (4Ah) n bytes Function table - several function definitions one after another (see function table below)

A polar-mode GDB has the following format

Offset Length Description
0 2 bytes Length, in bytes, of GDB, minus two.
2 1 byte Mode settings (see mode setting table below)
3 10 bytes A real number: Min
13 (Dh) 10 bytes A real number: Max
23 (17h) 10 bytes A real number: Step
33 (21h) 10 bytes A real number: xMin
43 (2Bh) 10 bytes A real number: xMax
53 (35h) 10 bytes A real number: xScl
63 (3Fh) 10 bytes A real number: yMin
73 (49h) 10 bytes A real number: yMax
83 (53h) 10 bytes A real number: yScl
93 (5Dh) 1 byte Number of functions defined (up to 99)
94 (5Eh) n bytes Function table - several function definitions one after another (see function table below)

A parametric-mode GDB has the following format:

Offset Length Description
0 2 bytes Length, in bytes, of GDB, minus two.
2 1 byte Mode settings (see mode setting table below)
3 10 bytes A real number: tMin
13 (Dh) 10 bytes A real number: tMax
23 (17h) 10 bytes A real number: tStep
33 (21h) 10 bytes A real number: xMin
43 (2Bh) 10 bytes A real number: xMax
53 (35h) 10 bytes A real number: xScl
63 (3Fh) 10 bytes A real number: yMin
73 (49h) 10 bytes A real number: yMax
83 (53h) 10 bytes A real number: yScl
93 (5Dh) 1 byte Number of functions defined (up to 99)
94 (5Eh) n bytes Function table - several function definitions one after another (see parametric function table below)

A differential-equation-mode GDB has the following format:

Offset Length Description
0 2 bytes Length, in bytes, of GDB, minus two.
2 1 byte Mode settings (see mode setting table below)
3 10 bytes A real number: difTol (.001)
13 (Dh) 10 bytes A real number: tPlot (0)
23 (17h) 10 bytes A real number: tMin (0)
33 (21h) 10 bytes A real number: tMax (6.2...)
43 (2Bh) 10 bytes A real number: tStep (.1308...)
53 (35h) 10 bytes A real number: xMin
63 (3Fh) 10 bytes A real number: xMax
73 (49h) 10 bytes A real number: xScl
83 (53h) 10 bytes A real number: yMin
93 (5Dh) 10 bytes A real number: yMax
103 (67h) 10 bytes A real number: yScl
113 (71h) 1 byte x Axis (see axis table below)
114 (72h) 1 byte y Axis (see axis table below)
148 (94h) 1 byte Number of functions defined (up to 9)
149 (95h) n bytes Function table - several function definitions one after another (see differential function table below)

The mode setting byte has the following format:

Bit (Mask) Mode if set (1) Mode if clear (0)
0 (01h) DrawDot DrawLine (unavailable in DifEq)
1 (02h) SimulG SeqG (unavailable in DifEq)
2 (04h) GridOn GridOff
3 (08h) PolarGC RectGC (unavailable in DifEq)
4 (10h) CoordOff CoordOn
5 (20h) AxesOff AxesOn
6 (40h) LabelOn LabelOff
7 (80h) This bit is always clear.

The differential equation axis bytes have the following format:

Value Axis

0

t

16 (10h)

Q

17-25 (11h-19h)

Q1 ... Q9

32 (20h)

Q'

33-41 (21h-29h)

Q'1 ... Q'9


Function- and polar-mode function definitions have the following format:

Offset Length Description
0 1 byte Function ID (the number of the function) - bit 7 (0x80) is set if the function is selected
1 n bytes An equation defining the function

Parametric-mode function definitions have the following format:

Offset Length Description
0 1 byte Function ID (the number of the function) - bit 7 (0x80) is set if the function is selected
1 n bytes An equation defining the x function
1+n m bytes An equation defining the y function

Differential equation function definitions have the following format:

Offset Length Description
0 1 byte Function ID (the number of the function) - bit 7 (0x80) is set if the function is selected
1 n bytes An equation defining the function
1+n 1 byte Unknown
2+n 10 bytes Initial condition. If the initial condition is defined, this is a real number representing QIf, where f is the number of the function. If the condition is undefined, the first two bytes are {FFh 03h}, followed by the characters "QIf" (again, f is the number of the function), followed by five 0-valued bytes.

Pictures

Pictures are 128x63-pixel bitmaps. They have the following format:

Offset Length Description
0 2 bytes Size of picture data (always 3F0h)
2 1008 (3F0h) bytes 1-bit-per-pixel bitmap data, arranged top-to-bottom in rows. Each row is defined left-to-right. (See figure below)

The following figure demonstrates byte ordering of the pixels if the bitmap is in a 1008-element array data[]:

[pixel grid diagram]

Programs

Programs share the same format as strings.

TI-BASIC programs can be plain-text or tokenized.

Plain-text programs start with one NULL character (00h).
Tokenized programs start with a valid token other than the edit-lock token.

Click here for a table of token definitions.

Ranges

Like GDB's, range formats vary with graphing mode.

A function-mode window has the following format:

Offset Length Description
0 2 bytes Always has a value of 51h.
2 1 byte Unknown
3 10 bytes A real number: xMin
13 (Dh) 10 bytes A real number: xMax
23 (17h) 10 bytes A real number: xScl
33 (21h) 10 bytes A real number: yMin
43 (2Bh) 10 bytes A real number: yMax
53 (35h) 10 bytes A real number: yScl
63 (3Fh) 20 bytes Unknown

A polar-mode window has the following format

Offset Length Description
0 2 bytes Always has a value of 5Bh.
2 1 byte Unknown
3 10 bytes A real number: [theta]Min
13 (Dh) 10 bytes A real number: [theta]Max
23 (17h) 10 bytes A real number: [theta]Step
33 (21h) 10 bytes A real number: xMin
43 (2Bh) 10 bytes A real number: xMax
53 (35h) 10 bytes A real number: xScl
63 (3Fh) 10 bytes A real number: yMin
73 (49h) 10 bytes A real number: yMax
83 (53h) 10 bytes A real number: yScl

A parametric-mode window has the following format:

Offset Length Description
0 2 bytes Always has a value of 5Bh.
2 1 byte Unknown
3 10 bytes A real number: tMin
13 (Dh) 10 bytes A real number: tMax
23 (17h) 10 bytes A real number: tStep
33 (21h) 10 bytes A real number: xMin
43 (2Bh) 10 bytes A real number: xMax
53 (35h) 10 bytes A real number: xScl
63 (3Fh) 10 bytes A real number: yMin
73 (49h) 10 bytes A real number: yMax
83 (53h) 10 bytes A real number: yScl

A differential-equation-mode window has the following format:

Offset Length Description
0 2 bytes Always has a value of 71h.
2 1 byte Unknown
3 10 bytes A real number: difTol
13 (Dh) 10 bytes A real number: tPlot
23 (17h) 10 bytes A real number: tMin
33 (21h) 10 bytes A real number: tMax
43 (2Bh) 10 bytes A real number: tStep
53 (35h) 10 bytes A real number: xMin
63 (3Fh) 10 bytes A real number: xMax
73 (49h) 10 bytes A real number: xScl
83 (53h) 10 bytes A real number: yMin
93 (5Dh) 10 bytes A real number: yMax
103 (67h) 10 bytes A real number: yScl
113 (71h) 1 byte x Axis (see axis table)
114 (72h) 1 byte y Axis (see axis table)

A saved window (ZSTO) has the following format:

Offset Length Description
0 2 bytes Always has a value of 82h.
2 10 bytes A real number: z[theta]Min
12 (Ch) 10 bytes A real number: z[theta]Max
22 (16h) 10 bytes A real number: z[theta]Step
32 (20h) 10 bytes A real number: ztPlot
42 (2Ah) 10 bytes A real number: ztMin
52 (34h) 10 bytes A real number: ztMax
62 (3Eh) 10 bytes A real number: ztStep
72 (48h) 10 bytes A real number: zxMin
82 (52h) 10 bytes A real number: zxMax
92 (5Ch) 10 bytes A real number: zxScl
102 (66h) 10 bytes A real number: zyMin
112 (70h) 10 bytes A real number: zyMax
122 (7Ah) 10 bytes A real number: zyScl

[previous page]
Backups

[home]
Table of Contents

[next page]
File Formats


Site maintained by Romain Liévin (roms@lpg.ticalc.org) and Tim Singer (tsinger@gladstone.uoregon.edu)