Author Topic: Pgrm File Format  (Read 5827 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Pgrm File Format
« on: November 13, 2010, 04:27:48 pm »
What is the file format for a Ti-Basic Program?  I know all about tokens, but I don't know what comes before and after the token data.

Thanks!

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Pgrm File Format
« Reply #1 on: November 13, 2010, 04:33:02 pm »
i believe the first two bytes are the number token bytes in the program, and then the rest is the data of the program.


Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Pgrm File Format
« Reply #2 on: November 13, 2010, 05:00:16 pm »
i believe the first two bytes are the number token bytes in the program, and then the rest is the data of the program.

When I look at the binary/hex code for an .8xp file on the computer, there's more at the beginning than that.

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: Pgrm File Format
« Reply #3 on: November 13, 2010, 05:04:25 pm »
This File Format Guide documents it, along with all the other TI file formats.

On a calculator, it's what nemo said- the first two bytes are the length, then it's followed by the data.

This is the text of the guide (minus HTML formatting):

Quote
The TI-83+ variable file format
The TI-83+ variable file format has two parts: a header and several variable entries.

The header appears at the beginning of the file and takes the following format:
Note - All 2-byte integers are stored little-endian Intel-style (least significant byte first).

Offset Length Description
0 8 bytes 8-character signature. The signature is always "**TI83F*".
8 3 bytes 3-byte further signature. These three bytes always contain {1Ah, 0Ah, 00h} = {26, 10, 0}
11 (Bh) 42 (2Ah) bytes Comment. The comment is either zero-terminated or padded on the right with space characters.
53 (35h) 2 bytes Length, in bytes, of the data section of the file. This number should be 57 (39h) bytes less than the file size.
55 (37h) n bytes Data section - consists of a number of variable entries (described below).
55 (37h)+n 2 bytes File checksum. This is the lower 16 bits of the sum of all bytes in the data section.



Each variable entry follows this format:

Offset Length Description
0 2 bytes Always has a value of 11 or 13 (Bh or Dh).
2 2 bytes Length, in bytes, of the variable data.
4 1 byte variable type ID byte (see variable type ID's)
5 8 bytes Variable name, padded with NULL characters (0h) on the right.
13 (Dh) 1 byte Version. Usually set to 0 (present if first bytes are Dh).
 
14 (Eh) 1 byte Flag. Set to 80h if variable is archived, 00h else (present if first bytes are Dh).
15 (Fh) 2 bytes Length, in bytes, of the variable data. (This is a copy of the value in offset 2)
17 (11h) n bytes Variable data. Click here for variable data formats.




The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Pgrm File Format
« Reply #4 on: November 13, 2010, 05:07:44 pm »
oh, and the type ID for a program is either 5 or 6. 5 for most programs, 6 if the program is protected.


Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Pgrm File Format
« Reply #5 on: November 13, 2010, 11:48:53 pm »
i believe the first two bytes are the number token bytes in the program, and then the rest is the data of the program.

When I look at the binary/hex code for an .8xp file on the computer, there's more at the beginning than that.

On the calc it just the two size bytes and a mess of data, though.
* Deep Thought wonders what this is for




Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Pgrm File Format
« Reply #6 on: November 14, 2010, 10:40:22 pm »
i believe the first two bytes are the number token bytes in the program, and then the rest is the data of the program.

When I look at the binary/hex code for an .8xp file on the computer, there's more at the beginning than that.

On the calc it just the two size bytes and a mess of data, though.
* Deep Thought wonders what this is for

probably for Correlation project.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Pgrm File Format
« Reply #7 on: November 15, 2010, 12:08:48 am »
i believe the first two bytes are the number token bytes in the program, and then the rest is the data of the program.

When I look at the binary/hex code for an .8xp file on the computer, there's more at the beginning than that.

On the calc it just the two size bytes and a mess of data, though.
* Deep Thought wonders what this is for

probably for Correlation project.  ;)

Exactly.  I just finished turning bmp fonts into .8xp files

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Pgrm File Format
« Reply #8 on: November 15, 2010, 12:22:10 am »
Cool to hear Hot Dog! I like to design stuff on Paint or other computer drawing softwares so this might be useful. :)


SirCmpwn

  • Guest
Re: Pgrm File Format
« Reply #9 on: November 15, 2010, 12:55:57 am »
If you don't mind using C#, I have a library for modifying all sorts of files, including .8xp.  Let me know if you are interested.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Pgrm File Format
« Reply #10 on: November 15, 2010, 12:58:05 am »
If you don't mind using C#, I have a library for modifying all sorts of files, including .8xp.  Let me know if you are interested.

I really appreciate that!  But I think I've got it made for right now.  Thanks, though :)

SirCmpwn

  • Guest
Re: Pgrm File Format
« Reply #11 on: November 15, 2010, 12:58:43 am »
Sure thing.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Pgrm File Format
« Reply #12 on: November 15, 2010, 02:21:23 pm »
Quote from: Hot_Dog
Exactly.  I just finished turning bmp fonts into .8xp files

Nice, that sounds really easy to use :D Can't wait till this is out.