TI-85 Link Protocol Guide v1.0 - 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
--- | ---
05h | Computer sending TI-85 data
85h | TI-85

#### 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 variable header
09h | Clear to send (CTS) | None
15h | Data packet (DATA) | Screenshot/variable/backup data
36h | Skip/Exit (SKIP/EXIT) | A one-byte rejection code (see codes below)
56h | Acknowledge (ACK) | None
5Ah | Checksum Error (ERR) The previous packet must be sent again. | None
6Dh | Silent - Request Screenshot (SCR) | None
92h | End of Transmission (EOT) | None
A2h | Silent - Request Variable (REQ) | A NUL padded (fixed-length) variable header
C9h | Silent - Request to Send Variable (RTS) | A SPC padded (fixed-length) variable header

Rejection codes (used with Command ID 36h) can have one of the following values:

Value | Description
--- | ---
01h | EXIT - The entire transmission has been cancelled.
02h | SKIP - The current variable has been skipped.
03h | OUT OF MEMORY (silent transmissions only) - The receiving calculator is out of memory.

#### 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.
Standard and padded variable headers have the following format:

Offset | Length | Description
--- | --- | ---
0 | 2 bytes | Size of actual variable data, in bytes
2 | 1 byte | Type ID Byte (see type ID's below)
3 | 1 byte | Size of variable name, in characters
4 | n bytes | Variable name (not zero-terminated)

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

A padded variable header will always be 12 bytes long. The unused bytes at the end are padded with space characters (20h) or NULLs (0h). The standard and padded formats for variable headers are interchangeable.

#### 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 | Real Number
01h | Complex Number
02h | Real Vector
03h | Complex Vector
04h | Real List
05h | Complex List
06h | Real Matrix
07h | Complex Matrix
08h | Real Constant
09h | Complex Constant
0Ah | Equation
0Ch | String
0Dh | Function GDB
0Eh | Polar GDB
0Fh | Parametric GDB
10h | Differential Equation GDB
11h | Picture
12h | Program
14h | Screenshot sent by PrtScrn (See note below)
17h | Func: Function Window Settings (See note below)
18h | Pol: Polar Window Settings (See note below)
19h | Param: Parametric Window Settings (See note below)
1Ah | DifEq: Differential Equation Window Settings (See note below)
1Bh | ZRCL: Saved Window Settings (See note below)
1Dh | Backup (No meaningful name)
1Eh | Unknown (only used when requesting variables of unknown type)

Note - If the Type ID is in the range 14h - 1Bh, then the name length byte has a value of 0 and the name field consists of a single 0 byte.

#### Backup Header Format

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

Offset | Length | Description
--- | --- | ---
0 | 2 bytes | Size of first backup section, in bytes
2 | 1 byte | Type ID Byte (1Dh in this case)
3 | 2 bytes | Size of second backup section, in bytes
5 | 2 bytes | Size of third backup section, in bytes
7 | 2 bytes | Memory address of second section

Link Cables | Table of Contents | Screenshots

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