From 1db018cebe45d7d98e494c7acbf7e8e3229906b0 Mon Sep 17 00:00:00 2001 From: Linus Date: Tue, 4 Mar 2025 12:08:22 +0100 Subject: [PATCH 1/2] Add a pattern for TI83/84 calculator exports This applies to multiple files created by TI software such as TI Connect (CE), as well as community replacements such as TILP. These files all have a 3-character file extension starting with `8x`. --- patterns/ti83f.hexpat | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 patterns/ti83f.hexpat diff --git a/patterns/ti83f.hexpat b/patterns/ti83f.hexpat new file mode 100644 index 00000000..d7a5699a --- /dev/null +++ b/patterns/ti83f.hexpat @@ -0,0 +1,78 @@ +import std.array; +import std.io; +import std.mem; +import type.magic; + +/// Source: https://merthsoft.com/linkguide/ti83+/fformat.html + +struct Header { + type::Magic<"**TI83F*">; + char mysteryBytes[3]; + char comment[0x2A]; + le u16 datasize; +} [[static]]; + +enum StorageType: u8 { + Archive = 0x80, + RAM = 0x00 +}; + +// Source: https://merthsoft.com/linkguide/ti83+/packet.html#vartypes +// Although 8e (TI 84 Plus CE flash) files are listed for completeness, they use a different file format and magic number +enum VariableType: u8 { + RealNumber = 0x00, // 8xn + RealList = 0x01, // 8xl + Matrix = 0x02, // 8xm + Yvar = 0x03, // 8xy + String = 0x04, // 8xs + Program = 0x05, // 8xp + ProtectedProgram = 0x06, // 8xp + Picture = 0x07, // 8xi + GDB = 0x08, // 8xd + Window = 0x0B, // 8xw + Complex = 0x0C, // 8xc + ComplexList = 0x0D, // 8xl + Window = 0x0F, // 8xw + RclWindw = 0x10, // 8xz + TblSet = 0x11, // 8xt + Backup = 0x13, // Packet header + DeleteFlash = 0x14, // Packet header + AppVar = 0x15, // 8xv + Group = 0x17, // 8xg + DirectoryList = 0x19, // Packet header + FlashOS = 0x23, // Packet header, 8eu, 8xu apparently? + FlashApp = 0x24, // Packet header, 8ek, 8xk apparently? + IDLIST = 0x26, // Packet header + Certificate = 0x27, // Packet header, 8xq apparently? + Clock = 0x29 // Packet header +}; + +struct Variable { + le u16 entryFormat; + le u16 length; + VariableType type; + char name[8]; + if (entryFormat == 0xD) { + u8 version; + StorageType storage; + } + le u16 length2; + u8 content[length]; + +}; + +Header header @ 0; +std::ByteSizedArray content @ 0x37; +le u16 checksum @ 0x37+header.datasize; + +fn makeChecksum() { + u32 sum = 0; + for (u32 i = 0, i < header.datasize, i = i + 1) { + sum += std::mem::read_unsigned(0x37+i, 8, std::mem::Endian::Little); + } + u16 result = sum & 0xFFFF; + return result; +}; + +u16 realChecksum out; +realChecksum = makeChecksum(); From be48b095a3f0592a45fbcd68a43ca0badb0e8ecb Mon Sep 17 00:00:00 2001 From: Linus Date: Tue, 4 Mar 2025 12:12:42 +0100 Subject: [PATCH 2/2] Add small TI program file for testing --- tests/patterns/test_data/ti83f.hexpat.8xp | Bin 0 -> 101 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/patterns/test_data/ti83f.hexpat.8xp diff --git a/tests/patterns/test_data/ti83f.hexpat.8xp b/tests/patterns/test_data/ti83f.hexpat.8xp new file mode 100644 index 0000000000000000000000000000000000000000..65b299d71768c537d0870a3cf81fcdde3e42cb53 GIT binary patch literal 101 zcmdPW3h}fscGHsL;&LuZO)N=GQAny(2=P>K&dT~>lQ!& literal 0 HcmV?d00001