TI-89 Link Protocol Guide - Packet formats

##

Packet Formats

Texas Instruments calculators always send data and responses in self-contained "packets."
Packets have the following format:
Note - all 2-byte integers are transmitted little-endian Intel-style (least significant byte first).

Offset | Length | Description
--- | --- | ---
0 | 1 byte | Machine ID byte
1 | 1 byte | Command ID byte
2 | 2 bytes | Length of data (see note below)
4 | n bytes | Data (if attached)
4+n | 2 bytes | Checksum (if data is attached)

Note - The "Length of data" element may not be equal to zero if the packet contains no data. In this case, the Command ID byte will indicate that the packet contains no data.

#### The Machine ID Byte

The Machine ID byte identifies the machine that is sending the packet. It can have one of the following values:

Value | Description
--- | ---
08h | Computer sending TI-89/92+/V200 data
88h | TI-92+/V200 to Computer or TI-92+/V200 to TI-92+/V200
98h | TI-89 (Titanium) to Computer or TI89 (Titanium) to TI89 (Titanium)

#### The Command ID Byte

The Command ID byte identifies the request or response that the machine is sending. It can have one of the following values:

Value | Description | Data Included
--- | --- | ---
06h | Variable Header (VAR) | A standard or padded variable header
09h | Clear to send (CTS) | None
15h | Data packet (DATA) | Screenshot/variable/backup data
2Dh | Silent - Request Versions (VER) | None
36h | Skip/Exit (SKIP/EXIT) | A five-byte rejection code (see codes below)
56h | Acknowledge (ACK) | None
5Ah | Checksum Error (ERR) The previous packet must be sent again. | None
68h | Check Ready (RDY) | None
6Dh | Silent - Request Screenshot (SCR) | None
78h | Continue (CONT) | None
87h | Direct command (CMD) | None - all data needed is in the packet header. There is no checksum.
88h | DeleteVariable (DEL) | A standard variable header
92h | End of Transmission (EOT) | None
A2h | Silent - Request Variable (REQ) | A standard or padded variable header
C9h | Silent - Request to Send Variable (RTS) | A standard or padded variable header

#### The SKP packet

It is made up of 5 bytes: 05 00 XX 00 00 where XX seems to be an error ID:
- 03: can't delete application
- 07: FLASH app not targeted for this model (01 00 07 00 81)
- 1E: can't overwrite variable
- 21: can't delete variable
- 24: malformed RTS packet
- 25: invalid varname

#### The Checksum

The checksum is a 16-bit value used to verify the integrity of the data in the packet. It only present if data is present.
The checksum is calculated by taking the lower 16 bits of the sum of the data bytes, as shown below:

    int calculateChecksum(unsigned char* data, unsigned short datalength) {
       unsigned short x, checksum;
       for(x=0; x<datalength; x++) {
          checksum+=data[x];  //overflow automatically limits to 16 bits
       }
       return checksum;
    }

###

Variable Headers

A Variable header contains information about one variable in the calculator.

Offset | Length | Description
--- | --- | ---
0 | 4 bytes | Size of actual variable data, in bytes, with or without the first four bytes of each data packet.
4 | 1 byte | Type ID Byte (see type ID's below)
5 | 1 byte | Size of variable name, in characters
6 | n bytes | Variable name (not zero-terminated)
6+n | 1 bytes | Extra byte for FLASH transfers

Note: These bytes only make up the "data" section of the packet.

#### The Type ID Byte

The type ID byte specifies the type of variable that is being transmitted. It can have one of the following values:

Value | Description (click for variable format)
--- | ---
00h | Expression
04h | List
06h | Matrix
0Ah | Data
0Bh | Text
0Ch | String
0Dh | GDB
0Eh | Figure
10h | Picture
12h | Program
13h | Function
14h | Macro
15h | Cause execution of assembly block (never encountered)
18h | Set/Get calculator date
1Ah | List the folder/apps table entries (global/local directory list request)
1Bh | with 1Ah, list content of a given folder (local dirlist)
1Ch | Other file
1Dh | Backup (See Backup Header Format below) (used only in sending mode)
1Fh | with 1Ah: list all main folders (global dirlist)
20h | Get a certificate
21h | Assembly program
22h | Get IDLIST
23h | Advanced Mathematic Software: the Operating System of the calculator (AMS)
24h | FLASH application (free apps, at least)
25h | Certificate

Note - If the Type ID is 1Ah, 1Bh or 22h, then the name length byte has a value of 0 and the name field is empty. Moreover, the upper byte of the length field (offset 0) is a byte used for filtering file types.

#### Backup Header Format (in sending only)

If the type ID byte specifies a backup, the variable header takes the following format:

Offset | Length | Description
--- | --- | ---
0 | 4 bytes | Always {00h, 00h, 00h, 00h}.
3 | 1 byte | Type ID Byte (1Dh in this case).
4 | 1 bytes | Length, in characters, of the name field. Always 04h.
5 | n bytes | Name: "main".

If the header is a request-style header, then the data length field (offset 0) contains 4 and the name field (offset 5) contains "main".

A remark: the backup request is only used in sending mode. Indeed, the TI89 (and also the TI92+) does not have a true backup mode. A backup is simply a group of all variables.

Link Cables | Table of Contents | Remote control

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