From c3d9edc7245fcc114754c33f41a710708b094275 Mon Sep 17 00:00:00 2001 From: Linus Date: Tue, 4 Mar 2025 12:08:22 +0100 Subject: [PATCH 1/5] 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 73ac6d46e28b0c87142bb039847e01cdafeb9d48 Mon Sep 17 00:00:00 2001 From: Linus Date: Tue, 4 Mar 2025 12:12:42 +0100 Subject: [PATCH 2/5] 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 From 0356d6fb4e53a1bf69728871d8ec2984ab1c905a Mon Sep 17 00:00:00 2001 From: Linus Date: Sat, 11 Oct 2025 08:28:52 +0200 Subject: [PATCH 3/5] start an (incomplete) char encoding file --- encodings/ti83.tbl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 encodings/ti83.tbl diff --git a/encodings/ti83.tbl b/encodings/ti83.tbl new file mode 100644 index 00000000..73cdb073 --- /dev/null +++ b/encodings/ti83.tbl @@ -0,0 +1,13 @@ +01=>DMS +02=>Dec +03=>Frac +04=-> +05=BoxPlot +06=[ +07=] +08={ +09=} +0A=rad +0B=° + +DE=Disp \ No newline at end of file From a3545c05cb7677132077e7ed53cc998cc949dbf1 Mon Sep 17 00:00:00 2001 From: Linus Warnatz Date: Sat, 11 Oct 2025 09:27:05 +0200 Subject: [PATCH 4/5] continue ti encoding --- encodings/ti83.tbl | 141 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 135 insertions(+), 6 deletions(-) diff --git a/encodings/ti83.tbl b/encodings/ti83.tbl index 73cdb073..aeb55b66 100644 --- a/encodings/ti83.tbl +++ b/encodings/ti83.tbl @@ -1,13 +1,142 @@ -01=>DMS -02=>Dec -03=>Frac -04=-> +01=►DMS +02=►Dec +03=►Frac +04=→ 05=BoxPlot 06=[ 07=] 08={ 09=} -0A=rad +0A=ʳ 0B=° +0C=⁻¹ +0D=² +0E=ᵀ +0F=³ -DE=Disp \ No newline at end of file +10=( +11=) +12=round( +13=pxl-Test( +14=augment +15=rowSwap( +16=row+( +17=*row( +18=*row+( +19=max( +1A=min( +1B=R►Pr( +1E=R►Pθ( +1D=P►Rx( +1E=P►Ry( +1F=median( + +20=randM( +21=mean( +22=solve( +23=seq( +24=fnInt( +25=nDeriv( + +27=fMin( +28=fMax( +29= +2A=" +2B=, +2C=𝒾 +2D=! +2E=CubicReg +2F=QuartReg + +30=0 +31=1 +32=2 +33=3 +34=4 +35=5 +36=6 +37=7 +38=8 +39=9 +3A=. +3B=ᴇ +3C= or +3D= xor +3E=: +3F=␤ + +40= and +41=A +42=B +43=C +44=E +45=F +46=G +47=G +48=H +49=I +4A=J +4B=K +4C=L +4D=M +4E=N +4F=O +50=P +51=Q +52=R +53=S +54=T +55=U +56=V +57=W +58=X +59=Y +5A=Z +5B=θ +5F=prgm + +64=Radian +65=Degree +66=Normal +67=Sci +68=Eng +69=Float +6A== +6B=< +6C=> +6D=≤ +6E=≥ +6F=≠ + +70=+ +71=- +72=Ans +73=Fix +74=Horiz +75=Full +76=Func +77=Param +78=Polar +79=Seq +7A=IndpntAuto +7B=IndpntAsk +7C=DependAuto +7D=DependAsk +7E=▫ + +80=﹢ +81=◆ +82=* +83=/ +84=Trace +85=ClrDraw +86=ZStandard +87=ZTrig +88=ZBox +89=Zoom In +8A=Zoom Out +8B=ZSquare +8C=ZInteger +8D=ZPrevious +8E=ZDecimal +8F=ZoomStat \ No newline at end of file From 2ae3b7443199b687374c99793221f2e91f73abee Mon Sep 17 00:00:00 2001 From: Linus Warnatz Date: Sat, 11 Oct 2025 09:27:35 +0200 Subject: [PATCH 5/5] start with TI variable content patterns --- patterns/ti83f.hexpat | 91 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/patterns/ti83f.hexpat b/patterns/ti83f.hexpat index d7a5699a..e6017595 100644 --- a/patterns/ti83f.hexpat +++ b/patterns/ti83f.hexpat @@ -2,6 +2,7 @@ import std.array; import std.io; import std.mem; import type.magic; +import type.bcd; /// Source: https://merthsoft.com/linkguide/ti83+/fformat.html @@ -18,6 +19,7 @@ enum StorageType: u8 { }; // Source: https://merthsoft.com/linkguide/ti83+/packet.html#vartypes +// Source: https://education.ti.com/en/customer-support/knowledge-base/ti-83-84-plus-family/product-usage/34933 // 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 @@ -25,8 +27,8 @@ enum VariableType: u8 { Matrix = 0x02, // 8xm Yvar = 0x03, // 8xy String = 0x04, // 8xs - Program = 0x05, // 8xp - ProtectedProgram = 0x06, // 8xp + Program = 0x05, // 8xp, 8xz + ProtectedProgram = 0x06, // 8xp, 8xz Picture = 0x07, // 8xi GDB = 0x08, // 8xd Window = 0x0B, // 8xw @@ -35,12 +37,12 @@ enum VariableType: u8 { Window = 0x0F, // 8xw RclWindw = 0x10, // 8xz TblSet = 0x11, // 8xt - Backup = 0x13, // Packet header + Backup = 0x13, // Packet header, 8xb DeleteFlash = 0x14, // Packet header - AppVar = 0x15, // 8xv + AppVar = 0x15, // 8xv, 8xy Group = 0x17, // 8xg DirectoryList = 0x19, // Packet header - FlashOS = 0x23, // Packet header, 8eu, 8xu apparently? + FlashOS = 0x23, // Packet header, 8eu, 8xu, 8cu apparently? FlashApp = 0x24, // Packet header, 8ek, 8xk apparently? IDLIST = 0x26, // Packet header Certificate = 0x27, // Packet header, 8xq apparently? @@ -58,9 +60,86 @@ struct Variable { } le u16 length2; u8 content[length]; - }; +struct TIReal { + bitfield Flags { + padding : 1 + isUndefined : 1 + padding : 2 + isComplex : 2 + isModified : 1 + padding : 1 + }; + flags Flags; + u8 biasedExponent; + type::bcd<7> mantissa; +} [[static]]; + +struct TIComplex { + TIReal real; + TIReal imag; +} [[static]]; + +struct TIList { + le u16 count; + TIReal content[count]; +}; + +struct TIMatrix { + u8 col; + u8 row; + TIReal content[col][row]; +}; + +enum TIToken { + //TODO +}; + +/// Used for Yvar, Str and Prgm +struct TITokens { + le u16 count; + TIToken content[count]; +}; + +struct TIGDB { + //TODO +}; + +struct TIWindowSet { + le u16 magic; + if (magic == 0xD0) { u8 mystery; } + u8 mystery; + TIReal Xmin; + TIReal Xmax; + TIReal Xscl; + TIReal Ymin; + TIReal Ymax; + TIReal Yscl; + TIReal Thmin; + TIReal Thmax; + TIReal Thstep; + TIReal Tmin; + TIReal Tmax; + TIReal Tstep; + TIReal PlotStart; + TIReal nMax; + TIReal uFirst; + TIReal vFirst; + TIReal uSecond; + TIReal vSecond; + TIReal wFirst; + TIReal PlotStep; + TIReal Xres; + TIReal wSecond; +}; + +struct TITblSet { + le u16 magic; + TIReal TblMin; + TIReal TblStep; +} [[static]]; + Header header @ 0; std::ByteSizedArray content @ 0x37; le u16 checksum @ 0x37+header.datasize;