A85: Re: TI Format again HELP!


[Prev][Next][Index][Thread]

A85: Re: TI Format again HELP!




It took me a while to figure out the formats.  I learned it from
ti86prot.txt, which isn't *entirely* correct or clear.  I ended up printing
it out in hex and comparing the info in the text file to the actual hex
bytes.  Here is the final C structures I came up with.  If you want all the
functions to read an save prorgam files and strings, send me an email.

Each file has a header, followed by an entry for each variable.  If it's a
single variable file (i.e. .85s or .85p), then there will only be one entry.
If it is a group file, there will be multiple entries (I think...you can
keep reading until you have read file_len - 2 [for the checksum]).  After
the entry header (which is the same for all var types) you will have the
variable data.  For strings and programs, there is the header info for
those, followed by the raw data.  The last two bytes of the file is a 16-bit
checksum of the MODed (checksum % 65535) to fit into 16 bits.  All the
checksum is is the sum of all the bytes following the file header and not
including the checksum itself.

//======== TYPEDEFS/STRUCTS ===============================================
typedef struct
{
  char  sig[8],         // "**TI86**"
        ext_sig[3],     // EOF, CR, NULL byte (1a, 0a, 00)
        comment[42];    // padded with NULL bytes to len of 42
  short file_len;       // file length minus 0x39
} FileHeader;

typedef struct
{
  short data_ptr,       // points to var_len2 at end of entry
        var_len;        // length of variable
  char  type,           // variable type
        name_len,       // variable name length
        name[8];        // variable name
  short var_len2;       // exactly the same as var_len
} FileEntry;

typedef struct
{
  short len;            // length of the program
  char  token[2];       // for a compiled asm prgm, (8e, 28)
} VarPrgm;

typedef struct
{
  short len;            // length of the string
} VarString;


--
David Phillips <electrum@tfs.net>
ICQ: 13811951
AOL/AIM: Electrum32
86 Central: http://www.tfs.net/~electrum/


-----Original Message-----
From: Franck Galliat <fgalliat@iut-etu-src.ujf-grenoble.fr>
To: assembly-85@lists.ticalc.org <assembly-85@lists.ticalc.org>
Date: Tuesday, November 03, 1998 10:33 AM
Subject: A85: TI Format again HELP!


>
>It's me again
>
> For TI Files Format, what I don't understand is the part just after
>  the comment ('file dated ...) & just before the var-header.
>   these are ascii symboles which don't seem to be Check Sum !!!
>Can ya help me?