Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: pimathbrainiac on March 26, 2013, 12:36:44 pm

Title: Creating .8xp programs (Axe) in Java
Post 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.
Title: Re: Creating .8xp programs (Axe) in Java
Post by: Streetwalrus on March 26, 2013, 01:42:52 pm
You should write a tokenizer, then look at DEVPAC8x to make a binary file into an 8xp.
Title: Re: Creating .8xp programs (Axe) in Java
Post by: pimathbrainiac on March 26, 2013, 02:47:17 pm
tokenizer? I don't know what that is...
Title: Re: Creating .8xp programs (Axe) in Java
Post by: Streetwalrus on March 26, 2013, 02:48:58 pm
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).
Title: Re: Creating .8xp programs (Axe) in Java
Post by: pimathbrainiac on March 26, 2013, 02:55:57 pm
Gotcha!

Java's string manipulation is horrible, but I'll try my best.

/me wishes he knew perl
Title: Re: Creating .8xp programs (Axe) in Java
Post by: shmibs on March 27, 2013, 11:10:32 am
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
Title: Re: Creating .8xp programs (Axe) in Java
Post by: cooliojazz on March 27, 2013, 11:35:02 am
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)
Title: Re: Creating .8xp programs (Axe) in Java
Post by: pimathbrainiac on March 27, 2013, 12:43:20 pm
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?
Title: Re: Creating .8xp programs (Axe) in Java
Post by: cooliojazz on March 27, 2013, 02:14:46 pm
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:
Code: [Select]
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
Title: Re: Creating .8xp programs (Axe) in Java
Post by: pimathbrainiac on March 27, 2013, 03:10:39 pm
Thank you so much!
Title: Re: Creating .8xp programs (Axe) in Java
Post by: pimathbrainiac on March 28, 2013, 12:32:28 pm
How do you write a file, exactly? (create a file to write to, I guess)
Title: Re: Creating .8xp programs (Axe) in Java
Post by: cooliojazz on March 29, 2013, 01:53:17 am
Like this:

Code: [Select]
ProgramFile pf = new ProgramFile();
pf.Tokens = "YAY! TOKENS!";
pf.Name = "TOKENPRG";
pf.saveFile("Cool File.8xp");
Title: Re: Creating .8xp programs (Axe) in Java
Post by: LocoPocoBirdy on September 07, 2016, 10:03:17 pm
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.