diff --git a/tivars/flash.py b/tivars/flash.py index 05d04fb..6ec95b4 100644 --- a/tivars/flash.py +++ b/tivars/flash.py @@ -31,7 +31,7 @@ class BCDDate(Converter): """ Converter for dates stored in four byte BCD - A date (dd, mm, yyyy) is stored in BCD as ddmmyyyy + A date (dd, mm, yyyy) is stored in BCD as ``ddmmyyyy``. """ _T = tuple[int, int, int] @@ -63,7 +63,7 @@ class BCDRevision(Converter): """ Converter for revision numbers stored in two byte BCD - A revision xx.yy is stored in BCD as xxyy + A revision xx.yy is stored in BCD as ``xxyy``. """ _T = str @@ -93,6 +93,14 @@ def set(cls, value: _T, **kwargs) -> bytes: class FlashDevices(Converter): + """ + Converter for the device field of a flash header + + The device field contains at least one device type and type ID pair (xx, yy), stored as ``xxyy`. + A flash header usually contains only has one pair in this field; the remainder of the field is null-padded. + The exception is a `TILicense`, which can hold licenses for multiple devices. + """ + _T = list[tuple[int, int]] @classmethod diff --git a/tivars/types/flash.py b/tivars/types/flash.py index 65eeeb9..181c79c 100644 --- a/tivars/types/flash.py +++ b/tivars/types/flash.py @@ -1,9 +1,18 @@ +""" +Flash types +""" + + from tivars.data import * from tivars.flash import TIFlashHeader from tivars.models import * class TIOperatingSystem(TIFlashHeader, register=True): + """ + Parser for operating systems (OSes) + """ + extensions = { None: "8eu", TI_82A: "82u", @@ -17,6 +26,10 @@ class TIOperatingSystem(TIFlashHeader, register=True): class TIApp(TIFlashHeader, register=True): + """ + Parser for apps + """ + extensions = { None: "8ek", TI_83P: "8xk", @@ -28,6 +41,12 @@ class TIApp(TIFlashHeader, register=True): class TICertificate(TIFlashHeader, register=True): + """ + Parser for certificate files + + To date, no external certificate files have been found in the wild. + """ + extensions = { None: "8eq", TI_83P: "8xq", @@ -39,6 +58,12 @@ class TICertificate(TIFlashHeader, register=True): class TILicense(TIFlashHeader, register=True): + """ + Parser for licenses + + A license is simply a string containing the TI license agreement, possibly spanning multiple devices and languages. + """ + extensions = { None: "8eu", TI_82A: "82u",