Backups and backup files on the TI-85 (Sep 21 1996)
---------------------------------------------------
- Compiled by Jani Halme (jaadha@utu.fi)
- 85g format compiled by David Brodbeck (gull@cyberspace.com) and 
  Magnus Hagander (mha@algonet.se)
- TI-85 link protocol info compiled by Per Finander (pfimdt93@hvdc.hv.se)

WARNING: This is a real hack, so don't be surprised to find inaccurate
info. I pulled this thing together with two hexdumps. ;) If you find 
something suspicious, tell me - I'll try to fix it.

  Backup-entry format in a grouped file:
(see 85g.txt by David Brodbeck and Magnus Hagander for more info)

	00h	08h	Signature "**TI85**"
	08h	03h	EOF and some other stuff (1a 0c 00)
	0bh	2ah	File comment
	35h	02h	Total bytes in the backup entry

	37h	02h	header length 		(0009h?)
	39h	02h	data block A length 	
	3bh	01h	type code 		(1dh)
	3ch	02h	data block B length	
	3eh	02h	data block C length     
	40h	02h	unknown			

	42h	02h	data block A length 	
	44h	xxx	data block A 
	
	xxx	xxx	data block B length	
	xxx	xxx	data block B 

	xxx	xxx	data block C length
	xxx	xxx	data block C

	xxx	02h	Checksum of the backup entry
	
  So, how to send the data to the calculator? The variable header differs 
a bit from the normal:
(see linkprot.txt by Per Finander for more info)

	00	id 			(05 or 85)
	01	packet 			(06)
	02	var header length 	(0009h?)
	04	data block A length 	(08b1h?)
	05	type code 		(1d)
	07	data block B length     (varies)
	09	data block C length 	(varies)
	0b	unknown			(8bf7h?)
	0d	checksum

  The data itself is sent in (surprise!) three data packets, whose lengths
are saved before each packet (they are also in the header). I have no clue
whatsoever of the use of the unknown word.

  There is no need to send a 'no more variables' packet after a backup 
transfer. The packet order of a backup transfer (pc to ti85) is:

	pc:	variable header
	85:	ack
	85:	req. data 
	pc:	data block A
	85:	ack
	pc:	data block B
	85:	ack
	pc:	data block C
	85:	ack
	
  If you want to make your own studies from the hexdumps, I'll
include them here. 

1. Hexdump of the transfer from TI-85 to PC
-------------------------------------------
in:        85 06 09 00 b1 08 1d 19 00 23 00 f7 8b 94 02 
out:       05 56 00 00 
out:       05 09 00 00 
in:        85 56 00 00 
in:        85 15 b1 08 20 00 10 01 00 04 00 01 0c 08 00 00
	   32 12 00 00 
[...lots of data deleted...]
           8c 10 8c 10 8c 4c fa 4c fa 00 00 00 00 4c fa 54 
	   52 41 4e 53 4d 49 53 53 49 de a4 
out:	   05 56 00 00 
in:        85 15 19 00 00 00 00 00 00 04 fc 35 83 10 00 00 
	   00 00 00 00 07 00 44 38 0b 0f 37 04 00 a0 02 
out:       05 56 00 00
in:        85 15 23 00 23 01 8c 07 12 21 01 8c 05 12 73 6e 
	   41 03 8b fb 00 74 61 74 53 79 05 8b f9 04 74 61 
	   74 53 78 05 8b f7 04 7a 0b 
out:	   05 56 00 00 


2. Hexdump of the resulting .85b file
-------------------------------------
00000000 : 2a 2a 54 49 38 35 2a 2a 1a 0c 00 42 61 63 6b 75 
00000010 : 70 20 66 69 6c 65 20 64 61 74 65 64 20 30 39 2f 
00000020 : 31 39 2f 39 36 2c 20 31 33 3a 31 35 00 28 00 50 
00000030 : 24 96 59 02 90 fe 08 09 00 b1 08 1d 19 00 23 00 
00000040 : f7 8b b1 08 20 00 10 01 00 04 00 01 0c 08 00 00 
00000050 : 32 12 00 00 
[...lots of data deleted...]
000008d0 :                                     8c 10 8c 10 
000008e0 : 8c 4c fa 4c fa 00 00 00 00 4c fa 53 59 53 54 45 
000008f0 : 4d 20 42 61 63 19 00 00 00 00 00 00 04 fc 35 83 [length B at 08f5h] 
00000900 : 10 00 00 00 00 00 00 07 00 44 38 0b 0f 37 04 00 
00000910 : 23 00 23 01 8c 07 12 21 01 8c 05 12 73 6e 41 03 [length C at 0910h]
00000920 : 8b fb 00 74 61 74 53 79 05 8b f9 04 74 61 74 53 
00000930 : 78 05 8b f7 04 88 b6 
00000937
