+ else if (TagType == 0xfe) {\r
+ PrintToScrollback("Info: Rewriteable TI tag detected.");\r
+\r
+ // put 64 bit data into shift1 and shift0\r
+ shift0 = (shift0>>24) | (shift1 << 8);\r
+ shift1 = (shift1>>24) | (shift2 << 8);\r
+\r
+ // align 16 bit crc into lower half of shift2\r
+ shift2 = ((shift2>>24) | (shift3 << 8)) & 0x0ffff;\r
+\r
+ // align 16 bit "end bits" or "ident" into lower half of shift3\r
+ shift3 >>= 16;\r
+\r
+ if ( (shift3^shift0)&0xffff ) {\r
+ PrintToScrollback("Error: Ident mismatch!");\r
+ }\r
+ // calculate CRC\r
+ crc=0;\r
+ crc = update_crc16(crc, (shift0)&0xff);\r
+ crc = update_crc16(crc, (shift0>>8)&0xff);\r
+ crc = update_crc16(crc, (shift0>>16)&0xff);\r
+ crc = update_crc16(crc, (shift0>>24)&0xff);\r
+ crc = update_crc16(crc, (shift1)&0xff);\r
+ crc = update_crc16(crc, (shift1>>8)&0xff);\r
+ crc = update_crc16(crc, (shift1>>16)&0xff);\r
+ crc = update_crc16(crc, (shift1>>24)&0xff);\r
+ PrintToScrollback("Info: Tag data = %08X%08X", shift1, shift0);\r
+ if (crc != (shift2&0xffff)) {\r
+ PrintToScrollback("Error: CRC mismatch, calculated %04X, got ^04X", crc, shift2&0xffff);\r
+ } else {\r
+ PrintToScrollback("Info: CRC %04X is good", crc);\r