Omnimaga
General Discussion => Technology and Development => Computer Programming => Topic started by: pimathbrainiac on March 26, 2013, 12:36:44 pm
-
Does anybody know how to do this?
I am trying to make a program that will convert some stuffs to an Axe program, but I don't know how to create .8xp programs in Java.
-
You should write a tokenizer, then look at DEVPAC8x to make a binary file into an 8xp.
-
tokenizer? I don't know what that is...
-
Basically a text parser that converts your program into tokens (every element in the BASIC editor is 1 or 2 bytes instead of a string, for example Disp is a token).
-
Gotcha!
Java's string manipulation is horrible, but I'll try my best.
/me wishes he knew perl
-
perl is really easy to get into, and the benefits of easy string manipulation and extensive regex support would be helpful in a tokenizer to the extent of making it probably more worth your time to learn how to use it and then write the program rather than trying to use java :P
-
would you like the back end from tfe? i already kind of have it almost in a library form (since i was planning on making it a library eventually anyway)
-
would you like the back end from tfe? i already kind of have it almost in a library form (since i was planning on making it a library eventually anyway)
Yes please! Is that C/C++, or Java?
-
Java. Here is the com.up.ti package. This is the source, so if you can't figure out how to directly use, you can maybe just extract the read/write routines. Or if you need more help using this just ask. Note: There is the PictureFile class in there, and also a Real class, they arent actually needed for the program stuff, but theres some references that would break if i took them out, so i left them :P (actually, there are quite a few excess classes that are there for multiple file-type stuff. if they really bug you, i can give you a version without them)
To read a file:
ProgramFile pf = new ProgramFile();
pf.openFile("Cool File.8xp");
pf.Tokens //String-ization of all the tokens
pf.Name //Program name
//To get a short[] of all the bytes of the program:
pf.ts.stringToData(pf.Tokens);
//To load a custom token set (see the file syntax in the main tfe thread)
short[] temp = pf.ts.stringToData(pf.Tokens);
pf.ts.changeTokens("Custom Tokens.tokens");
pf.Tokens = pf.ts.dataToString(temp);
//Or easier
pf = new ProgramFile();
pf.ts.changeTokens("Custom Tokens.tokens");
pf.openFile("Cool File.8xp");
So have fun!
Also: Credit would be appreciated :P
-
Thank you so much!
-
How do you write a file, exactly? (create a file to write to, I guess)
-
Like this:
ProgramFile pf = new ProgramFile();
pf.Tokens = "YAY! TOKENS!";
pf.Name = "TOKENPRG";
pf.saveFile("Cool File.8xp");
-
Sorry to post but I have successfully used your code to create an 8xp decompiler for android. Is it ok if use it? I will definitely credit you.