packet.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <html>
  3. <head>
  4. <meta name="GENERATOR" content="Visual Page 1.0 for Windows">
  5. <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
  6. <title>TI-83 Link Protocol Guide - Packet formats</title>
  7. </head>
  8. <body bgcolor="#ffffe8">
  9. <p><b>TI-83 Link Protocol Guide v1.0</b> - Packet formats</p>
  10. <center>
  11. <h2>
  12. <hr align="center"> Packet Formats</h2>
  13. </center>
  14. <p>Texas Instruments calculators always send data and responses in
  15. self-contained "packets."<br>
  16. Packets have the following format:<br>
  17. <i>Note - all 2-byte integers are transmitted little-endian Intel-style
  18. (least significant byte first).</i></p>
  19. <p>
  20. <table border="1" cellspacing="0" width="92%">
  21. <tbody>
  22. <tr>
  23. <th bgcolor="#008800" width="7%"><font color="#ffffff">Offset</font></th>
  24. <th bgcolor="#008800" width="8%"><font color="#ffffff">Length</font></th>
  25. <th bgcolor="#008800" width="85%"><font color="#ffffff">Description</font></th>
  26. </tr>
  27. <tr>
  28. <td bgcolor="#ffffff" width="7%">0</td>
  29. <td bgcolor="#ffffff" width="8%">1 byte</td>
  30. <td bgcolor="#ffffff" width="85%">Machine ID byte</td>
  31. </tr>
  32. <tr>
  33. <td bgcolor="#ffffff" width="7%">1</td>
  34. <td bgcolor="#ffffff" width="8%">1 byte</td>
  35. <td bgcolor="#ffffff" width="85%">Command ID byte</td>
  36. </tr>
  37. <tr>
  38. <td bgcolor="#ffffff" width="7%">2</td>
  39. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  40. <td bgcolor="#ffffff" width="85%">Length of data (see note below)</td>
  41. </tr>
  42. <tr>
  43. <td bgcolor="#ffffff" width="7%">4</td>
  44. <td bgcolor="#ffffff" width="8%"><i>n</i> bytes</td>
  45. <td bgcolor="#ffffff" width="85%">Data (if attached)</td>
  46. </tr>
  47. <tr>
  48. <td bgcolor="#ffffff" width="7%">4+<i>n</i></td>
  49. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  50. <td bgcolor="#ffffff" width="85%">Checksum (if data is attached)</td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. <i>Note - The "Length of data" element may not be equal to zero if the
  55. packet contains no data. In this case, the Command ID byte will
  56. indicate that the packet contains no data.</i></p>
  57. <p></p>
  58. <h4>The Machine ID Byte</h4>
  59. <p>The Machine ID byte identifies the machine that is sending the
  60. packet. It can have one of the following values:
  61. <table border="1" cellspacing="0" width="66%">
  62. <tbody>
  63. <tr>
  64. <th bgcolor="#dddddd" width="13%">Value</th>
  65. <th bgcolor="#dddddd">Description</th>
  66. </tr>
  67. <tr>
  68. <td width="13%">02h</td>
  69. <td>Computer sending TI-82 data</td>
  70. </tr>
  71. <tr>
  72. <td width="13%">03h</td>
  73. <td>Computer sending TI-83 data</td>
  74. </tr>
  75. <tr>
  76. <td width="13%">82h</td>
  77. <td>TI-82</td>
  78. </tr>
  79. <tr>
  80. <td width="13%">83h</td>
  81. <td>TI-83</td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <i>Note: The TI-83 accepts TI-82 Machine ID bytes in order to transfer
  86. data between a TI-82 and a TI-83.</i></p>
  87. <p></p>
  88. <h4>The Command ID Byte</h4>
  89. <p>The Command ID byte identifies the request or response that the
  90. machine is sending. It can have one of the following values:</p>
  91. <p>
  92. <table border="1" cellspacing="0" width="66%">
  93. <tbody>
  94. <tr>
  95. <th bgcolor="#dddddd" width="22%">Value</th>
  96. <th bgcolor="#dddddd" width="259">Description</th>
  97. <th bgcolor="#dddddd">Data Included</th>
  98. </tr>
  99. <tr>
  100. <td width="22%">06h</td>
  101. <td width="259">Variable Header (VAR)</td>
  102. <td>A <a href="#varheader">variable header</a></td>
  103. </tr>
  104. <tr>
  105. <td width="22%">09h</td>
  106. <td width="259">Clear to send (CTS)</td>
  107. <td><i>None</i></td>
  108. </tr>
  109. <tr>
  110. <td width="22%">15h</td>
  111. <td width="259">Data packet (DATA)</td>
  112. <td>Screenshot/variable/backup data</td>
  113. </tr>
  114. <tr>
  115. <td width="22%">36h</td>
  116. <td width="259">Skip/Exit (SKIP/EXIT)</td>
  117. <td>A one-byte rejection code (see codes below)</td>
  118. </tr>
  119. <tr>
  120. <td width="22%">56h</td>
  121. <td width="259">Acknowledge (ACK)</td>
  122. <td><i>None</i></td>
  123. </tr>
  124. <tr>
  125. <td width="22%">5Ah</td>
  126. <td width="259">Checksum Error (ERR)<br>
  127. The previous packet must be sent again.</td>
  128. <td><i>None</i></td>
  129. </tr>
  130. <tr>
  131. <td width="22%">6Dh</td>
  132. <td width="259"><i>Silent</i> - Request Screenshot (SCR)</td>
  133. <td><i>None</i></td>
  134. </tr>
  135. <tr>
  136. <td width="22%">92h</td>
  137. <td width="259">End of Transmission (EOT)</td>
  138. <td><i>None</i></td>
  139. </tr>
  140. <tr>
  141. <td width="22%">A2h</td>
  142. <td width="259"><i>Silent</i> - Request Variable (REQ)</td>
  143. <td>A <a href="#varheader">variable header</a></td>
  144. </tr>
  145. <tr>
  146. <td width="22%">C9h</td>
  147. <td width="259"><i>Silent</i> - Request to Send Variable (RTS)</td>
  148. <td>A <a href="#varheader">variable header</a></td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. </p>
  153. <p></p>
  154. <p>Rejection codes (used with Command ID 36h) can have one of the
  155. following values:</p>
  156. <p>
  157. <table border="1" cellspacing="0" width="66%">
  158. <tbody>
  159. <tr>
  160. <th bgcolor="#dddddd" width="13%">Value</th>
  161. <th bgcolor="#dddddd">Description</th>
  162. </tr>
  163. <tr>
  164. <td width="13%">01h</td>
  165. <td>EXIT - The entire transmission has been cancelled.</td>
  166. </tr>
  167. <tr>
  168. <td width="13%">02h</td>
  169. <td>SKIP - The current variable has been skipped.</td>
  170. </tr>
  171. <tr>
  172. <td width="13%">03h</td>
  173. <td>OUT OF MEMORY (silent transmissions only) - The receiving
  174. calculator is out of memory.</td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. </p>
  179. <p></p>
  180. <h4>The Checksum</h4>
  181. <p>The checksum is a 16-bit value used to verify the integrity of the
  182. data in the packet. It only present if data is present.<br>
  183. The checksum is calculated by taking the lower 16 bits of the sum of
  184. the data bytes, as shown below:</p>
  185. <pre>int calculateChecksum(unsigned char* data, unsigned short datalength) {<br> unsigned short x, checksum;<br> for(x=0; x&lt;datalength; x++) {<br> checksum+=data[x]; //overflow automatically limits to 16 bits<br> }<br> return checksum;<br>}</pre>
  186. <center>
  187. <h3>
  188. <hr align="center"> <a name="varheader"></a>Variable Headers</h3>
  189. </center>
  190. <p style="font-style: italic;">A Variable header contains information
  191. about one variable in the calculator.<br>
  192. <table border="1" cellspacing="0" width="92%">
  193. <tbody>
  194. <tr>
  195. <th bgcolor="#008800" width="7%"><font color="#ffffff">Offset</font></th>
  196. <th bgcolor="#008800" width="8%"><font color="#ffffff">Length</font></th>
  197. <th bgcolor="#008800" width="85%"><font color="#ffffff">Description</font></th>
  198. </tr>
  199. <tr>
  200. <td bgcolor="#ffffff" width="7%">0</td>
  201. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  202. <td bgcolor="#ffffff" width="85%">Size of actual variable data,
  203. in
  204. bytes</td>
  205. </tr>
  206. <tr>
  207. <td bgcolor="#ffffff" width="7%">2</td>
  208. <td bgcolor="#ffffff" width="8%">1 byte</td>
  209. <td bgcolor="#ffffff" width="85%">Type ID Byte (see type ID's
  210. below)</td>
  211. </tr>
  212. <tr>
  213. <td bgcolor="#ffffff" width="7%">3</td>
  214. <td bgcolor="#ffffff" width="8%">8 bytes</td>
  215. <td bgcolor="#ffffff" width="85%">Variable name, padded on the
  216. right
  217. with NULL characters (0h). This field is always tokenized.<br>
  218. <i></i></td>
  219. </tr>
  220. </tbody>
  221. </table>
  222. <i>Note: These bytes only make up the "data" section of the packet.<br>
  223. </i><i>Note2:</i><br>
  224. - for lists: there are 10 lists (L1..L0). The varname is 5D00 for L1 to
  225. 5D09 for L0. But, there may be other lists. The varname is 5D[Name (7
  226. chars max)].<br>
  227. - for matrix: there are 10 matrix ([A]..[J]). The varname is 5C00 for
  228. [A] to 5C09 for [J].<br>
  229. - for equations: there are 31 equations (Y1..Y0 in func mode, X1t..X6t
  230. and Y1t..Y6t in param mode, r1..r6 in polar mode and u..w in seq mode).
  231. &nbsp;The varname is 5E10 for Y1 to 5E19 for Y0. The varname is 5E20
  232. for X1t, 5E21 for Y1t to 5E2A for X6t, 5E2B for Y6t. The varname is
  233. 5E40 for r1 to 5E45 for r6. The varname is 5E80 for u to 5E82 for w.<br>
  234. - for strings: there are 10 strings (Str1..Str9). The varname is AA00
  235. for Str1 to AA09 for Str0.<br>
  236. - for pictures: there are 10 pictures (Pic1..Pic0). The varname is 6000
  237. for Pic1 to 6009 for Pic0.<br>
  238. - for gdbs: there are 10 gdbs (GDB1..GDB0). The varname is 6100 for
  239. GDB1 to 6109 for GDB9.</p>
  240. <p></p>
  241. <h4><a name="vartypes"></a>The Type ID Byte</h4>
  242. <p>The type ID byte specifies the type of variable that is being
  243. transmitted. It can have one of the following values:</p>
  244. <p>
  245. <table border="1" cellspacing="0" width="66%">
  246. <tbody>
  247. <tr>
  248. <th bgcolor="#dddddd" width="13%">Value</th>
  249. <th bgcolor="#dddddd">Description (click for variable format)</th>
  250. </tr>
  251. <tr>
  252. <td width="13%">00h</td>
  253. <td><a href="vars.html#real">Real Number</a></td>
  254. </tr>
  255. <tr>
  256. <td width="13%">01h</td>
  257. <td><a href="vars.html#list">Real List</a></td>
  258. </tr>
  259. <tr>
  260. <td width="13%">02h</td>
  261. <td><a href="vars.html#matrix">Matrix</a></td>
  262. </tr>
  263. <tr>
  264. <td width="13%">03h</td>
  265. <td><a href="vars.html#equation">Y-Variable</a></td>
  266. </tr>
  267. <tr>
  268. <td width="13%">04h</td>
  269. <td><a href="vars.html#string">String</a></td>
  270. </tr>
  271. <tr>
  272. <td width="13%">05h</td>
  273. <td><a href="vars.html#program">Program</a></td>
  274. </tr>
  275. <tr>
  276. <td width="13%">06h</td>
  277. <td>Edit-locked <a href="vars.html#program">Program</a></td>
  278. </tr>
  279. <tr>
  280. <td width="13%">07h</td>
  281. <td><a href="vars.html#picture">Picture</a></td>
  282. </tr>
  283. <tr>
  284. <td width="13%">08h</td>
  285. <td><a href="vars.html#gdb">GDB</a></td>
  286. </tr>
  287. <tr>
  288. <td width="13%">0Ch</td>
  289. <td><a href="vars.html#complex">Complex Number</a></td>
  290. </tr>
  291. <tr>
  292. <td width="13%">0Dh</td>
  293. <td><a href="vars.html#list">Complex List</a></td>
  294. </tr>
  295. <tr>
  296. <td width="13%">0Fh</td>
  297. <td><a href="vars.html#window">Window Settings</a><i> (See note
  298. below)</i></td>
  299. </tr>
  300. <tr>
  301. <td width="13%">10h</td>
  302. <td><a href="vars.html#window">Saved Window Settings</a><i> (See
  303. note
  304. below)</i></td>
  305. </tr>
  306. <tr>
  307. <td width="13%">11h</td>
  308. <td><a href="vars.html#table">Table Setup</a><i> (See note below)</i></td>
  309. </tr>
  310. <tr>
  311. <td width="13%">13h</td>
  312. <td><a href="backup.html">Backup</a></td>
  313. </tr>
  314. <tr>
  315. <td width="13%">19h</td>
  316. <td><a name="19h"></a>Directory <i>(See note below)</i> - only
  317. used
  318. when requesting a directory</td>
  319. </tr>
  320. </tbody>
  321. </table>
  322. <i>Note - If the Type ID is in the range 0Fh - 12h or 19h, then the
  323. contents of the name field of the header do not matter.</i></p>
  324. <p></p>
  325. <h4><a name="backup"></a>Backup Header Format</h4>
  326. <p>If the type ID byte specifies a backup, the variable header takes
  327. the following 9-byte format:</p>
  328. <p>
  329. <table border="1" cellspacing="0" width="92%">
  330. <tbody>
  331. <tr>
  332. <th bgcolor="#008800" width="7%"><font color="#ffffff">Offset</font></th>
  333. <th bgcolor="#008800" width="8%"><font color="#ffffff">Length</font></th>
  334. <th bgcolor="#008800" width="85%"><font color="#ffffff">Description</font></th>
  335. </tr>
  336. <tr>
  337. <td bgcolor="#ffffff" width="7%">0</td>
  338. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  339. <td bgcolor="#ffffff" width="85%">Size of first backup section,
  340. in
  341. bytes</td>
  342. </tr>
  343. <tr>
  344. <td bgcolor="#ffffff" width="7%">2</td>
  345. <td bgcolor="#ffffff" width="8%">1 byte</td>
  346. <td bgcolor="#ffffff" width="85%">Type ID Byte (1Dh in this case)</td>
  347. </tr>
  348. <tr>
  349. <td bgcolor="#ffffff" width="7%">3</td>
  350. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  351. <td bgcolor="#ffffff" width="85%">Size of second backup section,
  352. in
  353. bytes</td>
  354. </tr>
  355. <tr>
  356. <td bgcolor="#ffffff" width="7%">5</td>
  357. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  358. <td bgcolor="#ffffff" width="85%">Size of third backup section,
  359. in bytes</td>
  360. </tr>
  361. <tr>
  362. <td bgcolor="#ffffff" width="7%">7</td>
  363. <td bgcolor="#ffffff" width="8%">2 bytes</td>
  364. <td bgcolor="#ffffff" width="85%">Memory address of the second
  365. data section </td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. </p>
  370. <p></p>
  371. <p>
  372. <table border="0" cellspacing="0" width="100%">
  373. <tbody>
  374. <tr>
  375. <td width="32%">
  376. <p align="center"><a href="cable.html"><img
  377. src="graphics/prevpage.gif" alt="[previous page]" align="bottom"
  378. border="2" height="32" width="32"><br>
  379. Link Cables</a> </p>
  380. </td>
  381. <td width="34%">
  382. <p align="center"><a href="index.html"><img
  383. src="graphics/home.gif" alt="[home]" align="bottom" border="2"
  384. height="32" width="32"><br>
  385. Table of Contents</a> </p>
  386. </td>
  387. <td width="34%">
  388. <p align="center"><a href="remote.html"><a href="remote.html"><img
  389. src="graphics/nextpage.gif" alt="[next page]"
  390. style="border: 2px solid ; width: 32px; height: 32px;"></a><br>
  391. Remote Control</a> </p>
  392. </td>
  393. </tr>
  394. </tbody>
  395. </table>
  396. </p>
  397. <hr align="center"> <i>Site maintained by Romain Li&eacute;vin (</i><a
  398. href="mailto:roms@lpg.ticalc.org"><i>roms@lpg.ticalc.org</i></a><i>)
  399. and Tim Singer (</i><a href="mailto:tsinger@gladstone.uoregon.edu"><i>tsinger@gladstone.uoregon.edu</i></a><i>)</i>
  400. </body>
  401. </html>