This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Technology & Calculator Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Calculator Tech Support => Technology & Calculator Open Topic
Author Message
Deo Favente


Newbie


Joined: 17 Sep 2008
Posts: 10

Posted: 17 Sep 2008 10:28:50 pm    Post subject:

Iv'e gotten so frusterated! I can't figure out how to read these stupid ****ing files! 8xp 8xl etc.
I'm using java but if anyone can give me a general idea that could help too.

My problem:
One method i use simple file reader to read files.

Code:
BufferedReader reader = new BufferedReader(new FileReader(file));
while( (s = reader.readLine()) != null) {
data += new String(s.getBytes()) + "\n";
}

Then i replace all the ascii codes with what it is on the calculator and i get most of it right, only all the funny characters pop up as 0xFFFF! poop

Luckily thnaks to this: http://www.ticalc.org/archives/files/fileinfo/247/24750.html i have not learned much. I think it says that the funny characters are stored in reveresed! whoa.
So with method two i read tthis file in binary.

Code:
FileInputStream in = null;
        try {
            in = new FileInputStream(filename);

            int read;

            while ((read = in.read()) != -1) {

                nums+= Integer.toBinaryString(read);
            }
            
            return nums;

but now what? Well ive decided i will take chunks of 8 and then replace the chunks with the character codes i do know. Only it comes up completely wrong! And i tried to look for a pattern like in the file i have "AX+BY+CZ->D" so i shoud notice a similar bunch of 1s and 0s the length of two of them a part from each other. but i have not found anything like that. I even have a line "! ! ! !" in another program but i can't even find that. So i need to find the normal characters first, the the other characters i can worry about later.

HOW DO I READ THESE FILES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (It would be particallary helpful to know how to do it in java)!!!

And btw how do u like my base converter: http://whitehat.servehttp.com/calculators/ABC.html


Last edited by Guest on 17 Sep 2008 10:29:27 pm; edited 1 time in total
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 18 Sep 2008 04:40:34 am    Post subject:

.8xp files are structured binary files, not text files. If you wish to open files created in the calculator's program editor (rather than assembly programs) you will need to detokenise the files using the information in the TI Link Protocol & File Format Guide (as you linked to).

Edit: To clarify, the programs are not stored as plain text (ie, "For(" is not four bytes) but as special tokens ("For(" is stored as the single byte $D3).


Last edited by Guest on 18 Sep 2008 05:25:24 am; edited 1 time in total
Back to top
Deo Favente


Newbie


Joined: 17 Sep 2008
Posts: 10

Posted: 18 Sep 2008 06:37:23 am    Post subject:

Well i know that the special characters arnt like four bytes but what does least significat digit mean? I had thought that it meas the smaller place goes first (1s, 2s, 4s, 8s,etc)? B/c when i try to read the file in binary, cunk it into chunks of 8, then replace the chunks with the correct character code from the reference, it doesnt work like sourcecoder does, the characters are all wrong in the wrong places.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 18 Sep 2008 07:07:42 am    Post subject:

No, you got it backwards it goes 128,64,32,16,8,4,2,1. So, if you are looking for $D3 (which is hexidecimal), you are looking for 11010011.
Back to top
Deo Favente


Newbie


Joined: 17 Sep 2008
Posts: 10

Posted: 18 Sep 2008 09:04:41 pm    Post subject:

I know what binary is, its a numbering system like ours, that only has two possible values for each digit. And i know how to count with out kinda numbering system too. I even made a base converter applet so that means i need to know how to count and convert to different bases.
But anyway i figured it out. Here is the code i have

Code:
        //READ
        FileInputStream in = null;
        in = new FileInputStream("COMBINE.8xp");
        int read;
        while ((read = in.read()) != -1) {
            if (read < 32) {
                input += ("(*" + read + "*)");
            } else {
                input += "(" + (char)read + ")";
            }
        }

        //DE-TOKENIZING PROCESSING
        Not shown (i havent completely coded this yet)

       System.out.println(input);


I'm gonna make a java applet that decodes and recodes programs and lists etc. I dont know why cause my ***** **** *** **** school blocks applets and java archives and file archives and disables java scipts. The only place it would work at schhol would be on the server computers with admin login or the programming lab (but i;d have to download it cause applets are disabled in the webbroswer)


Last edited by Guest on 18 Sep 2008 09:06:37 pm; edited 1 time in total
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 19 Sep 2008 05:50:40 am    Post subject:

Why are you reading a binary file, converting to a text string, then detokenising that? You should handle each byte value you pull from the input file as you go.
Back to top
Deo Favente


Newbie


Joined: 17 Sep 2008
Posts: 10

Posted: 19 Sep 2008 06:36:21 am    Post subject:

If i use java's whatever its called that reads it as a string, then all the two byte tokens show up as 0xFFFF in decimal. So instead of figuring out what was wrong with that i just made this hack job here.
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 20 Sep 2008 10:31:03 pm    Post subject:

are you trying to write a (basic) disassembler? like ben pointed out, you'll need to detokenize.

doesn't java have libraries to handle these kinds of things?
Back to top
Deo Favente


Newbie


Joined: 17 Sep 2008
Posts: 10

Posted: 21 Sep 2008 10:10:40 pm    Post subject:

Well im trying to make a decompiler, editor, and compiler for programs, lists, matrices, groups, etc for multiple ti calculators.
And java has no libraries that im aware of (at least the ones that come in jdk) that will let me enter in a list of strings and what i want to replace each one with. darn. If you can find one that'd be awesome.
Right now i got the disasemble part YAY! I have text files filled with the tokens, and the two-byte ones are done first cause obvoisuly if i do the one bytes first that wont work. I'm still getting around to adding the last few toekens tho. I'm going to put the applet here: http://whitehat.servehttp.com/calculators/TIBASIC.html.
when i'm done theres going to be a palette to the left with a few tabs and a bunch of buttons inside each tab that corresponds to all of the commands. To the top of the tabs you can select what calculator format you want to save the file as (decompiling will always auto-detect (if i can do that). To the right, there will be a big text area with save and load buttons below that. Above the text area there will be a bunch of fields like the name, the file type (list, program, matrix, function, etc. This selection will determine how the user can enter in stuff into the text area. I was also hoping that the heading of programs determine if the program is hidden, locked, or some other options so i can add those to the fields above.


Last edited by Guest on 21 Sep 2008 10:17:28 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement