Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: annoyingcalc on July 06, 2011, 01:58:57 pm

Title: Axe dissasembler
Post by: annoyingcalc on July 06, 2011, 01:58:57 pm
Can someone make an Axe dissasembler (dissasembles Asm programs and gives source code) on calculator? That would be nice
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:04:44 pm
Can someone make an Axe dissasembler (dissasembles Asm programs and gives source code) on calculator? That would be nice

That sounds like yet another Axe Disassembler request. Unfortunately, that's not just very hard, but really impossible.
Title: Re: Axe dissasembler
Post by: Ashbad on July 06, 2011, 02:06:01 pm
It would be possible, but I'm sure you would have a ton of errors in translation along the way.
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:06:57 pm
It would be possible, but I'm sure you would have a ton of errors in translation along the way.

Ashbad, that looks like it would get a few things right, but all it could properly do is Bcalls.
Title: Re: Axe dissasembler
Post by: TIfanx1999 on July 06, 2011, 02:07:20 pm
It would be quite difficult. Most Axe programs include the source anyway though don't they?
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:07:56 pm
It would be quite difficult. Most Axe programs include the source anyway though don't they?

Since (for now) we're an open-source community yes :)
Title: Re: Axe dissasembler
Post by: Ashbad on July 06, 2011, 02:11:50 pm
It would be possible, but I'm sure you would have a ton of errors in translation along the way.

Ashbad, that looks like it would get a few things right, but all it could properly do is Bcalls.

Well, it would technically work if it searched for patterns of opcodes in chunks and correlate them to Axe commands -- though I can imagine some errors in places where there are a ton of complex routines mixed with pointers and curly braces.  However, the one place it would definitely be different is that it would put all data declarations together and in hexadecimal delimiting, probably at the start of the program for compilation's sake.  For all non-matches with commands, it would simply insert a Asm(hEx here) instead.

I think it is very possible and very impractical.
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:14:32 pm
I spent a few months making a Z80 ASM Disassembler to find out it's impossible to make a perfect one due to the "data vs instructions" thing.

So, if a disassembler is complex know, an Axe Disassembler would be crazy.
Title: Re: Axe dissasembler
Post by: Ashbad on July 06, 2011, 02:21:11 pm
Fortunately, Axe DOES do better with data handling :) in fact, it reserves a .data section where all data is stored soon after the last Return.  Everything in the .data section would then be easily distinguishable -- though only as raw data and not in forms of strings, etc. Unless you go through the program and literally see how the program handles all of the data byte by byte, and that wouldn't be near perfect still.  If someone does try to attempt one (maybe I will after the contest...) I think it should decompile to multiple programs, one for each .section.
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:24:21 pm
Fortunately, Axe DOES do better with data handling :) in fact, it reserves a .data section where all data is stored soon after the last Return.  Everything in the .data section would then be easily distinguishable -- though only as raw data and not in forms of strings, etc. Unless you go through the program and literally see how the program handles all of the data byte by byte, and that wouldn't be near perfect still.  If someone does try to attempt one (maybe I will after the contest...) I think it should decompile to multiple programs, one for each .section.

I personally was not aware of that and I could use my disassembler to make it return all the data used and all the instructions used separated and from the instructions work on disassembling instructions and bcalls.
Title: Re: Axe dissasembler
Post by: annoyingcalc on July 06, 2011, 02:43:45 pm
I want to use some code from a mario ame similar to mine only done
Title: Re: Axe dissasembler
Post by: Runer112 on July 06, 2011, 02:50:10 pm
As far as I know, the only finished and released Mario games were written in z80 assembly, not Axe. So it sounds like you don't want an Axe disassembler, just a regular z80 disassembler.

However, unless the author of a program explicitly tells you that you can use their code in your own project, do not use their code. Even if it's not illegal, more importantly it's just not right.
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 02:53:09 pm
Yes, no Axe Mario game has been made, why do you want an Axe Disassembler? (as Runer said)
Title: Re: Axe dissasembler
Post by: FinaleTI on July 06, 2011, 02:59:44 pm
Perhaps he wants to get whatever the Axe source would be for a program that was written in ASM, not necessarily one that was written in Axe. Of course, that's even more impossible than trying to disassemble a program written in Axe back to its source.
Title: Re: Axe dissasembler
Post by: Munchor on July 06, 2011, 05:07:36 pm
Perhaps he wants to get whatever the Axe source would be for a program that was written in ASM, not necessarily one that was written in Axe. Of course, that's even more impossible than trying to disassemble a program written in Axe back to its source.

Oh I see, that looks a bit too complex and unlikely to work.
Title: Re: Axe dissasembler
Post by: TIfanx1999 on July 06, 2011, 05:18:58 pm
Perhaps he wants to get whatever the Axe source would be for a program that was written in ASM, not necessarily one that was written in Axe. Of course, that's even more impossible than trying to disassemble a program written in Axe back to its source.
If that's the case, that kind of makes my head hurt even thinking about it.
Title: Re: Axe dissasembler
Post by: annoyingcalc on July 06, 2011, 05:45:30 pm
As far as I know, the only finished and released Mario games were written in z80 assembly, not Axe. So it sounds like you don't want an Axe disassembler, just a regular z80 disassembler.

However, unless the author of a program explicitly tells you that you can use their code in your own project, do not use their code. Even if it's not illegal, more importantly it's just not right.
Actually it includes the Asm source code
http://www.ticalc.org/archives/files/fileinfo/174/17451.html
but It looks as if it is in Axe though
Title: Re: Axe dissasembler
Post by: FinaleTI on July 06, 2011, 05:47:44 pm
That file was submitted in 2001, so it was written at least 9 years prior to Axe's release.
Title: Re: Axe dissasembler
Post by: annoyingcalc on July 06, 2011, 06:20:38 pm
Spoiler For oh:
*.* *.* *.* *.* *.* *.* *.*
Title: Re: Axe dissasembler
Post by: BrownyTCat on July 06, 2011, 07:06:02 pm
Possible: Yes
Feasible: No
And I'm sure Axe programmers wouldn't like it.
Title: Re: Axe dissasembler
Post by: Quigibo on July 07, 2011, 12:16:57 am
An Axe disassembler is nearly impossible for the following reasons:

-You lose the names of Pointers, Labels, and Variables
-You lose comments and code formatting
-You can't tell if specific data was a string, or number list, or sprite, or picture, etc.
-Each new version of axe changes the routines used so the disassembler would have to be rewritten each version
-Peephole opts make it even more difficult to disassemble.
-Axioms, inline assembly, and other things like that would not translate

It is however, fairly trivial to disassemble it to assembly, and then map native Axe routines and variable locations to the assembly program.  But you would definitely not be able to turn it back into Axe language unless you do it by hand or something.
Title: Re: Axe dissasembler
Post by: DrDnar on July 07, 2011, 12:22:58 am
A decompiler is most certainly possible, but it would require as much work as creating Axe itself. It's no trivial undertaking. It's not worth the trouble.
Title: Re: Axe dissasembler
Post by: SirCmpwn on July 07, 2011, 12:29:57 am
Can someone make an Axe dissasembler (dissasembles Asm programs and gives source code) on calculator? That would be nice
Will do.
Title: Re: Axe dissasembler
Post by: ralphdspam on July 07, 2011, 01:51:06 am
Can someone make an Axe dissasembler (dissasembles Asm programs and gives source code) on calculator? That would be nice
Will do.
That would be awesome!  :D
Title: Re: Axe dissasembler
Post by: Munchor on July 07, 2011, 06:29:33 am
An Axe disassembler is nearly impossible for the following reasons:

-You lose the names of Pointers, Labels, and Variables
-You lose comments and code formatting
-You can't tell if specific data was a string, or number list, or sprite, or picture, etc.
-Each new version of axe changes the routines used so the disassembler would have to be rewritten each version
-Peephole opts make it even more difficult to disassemble.
-Axioms, inline assembly, and other things like that would not translate

It is however, fairly trivial to disassemble it to assembly, and then map native Axe routines and variable locations to the assembly program.  But you would definitely not be able to turn it back into Axe language unless you do it by hand or something.

Can someone make an Axe dissasembler (dissasembles Asm programs and gives source code) on calculator? That would be nice
Will do.

And this is SirCmpwn challenging the Universe limits! :P I wish him good luck although it is very unlikely to get fairly accurate code.
Title: Re: Axe dissasembler
Post by: Keoni29 on October 20, 2011, 02:01:24 am
:( I lost the source of my awesome game. I have a rlly outdated backup, but I'd rather deasm my executable asm script.
Title: Re: Axe dissasembler
Post by: Jonius7 on October 20, 2011, 10:21:06 am
Axe Disassembling would be cool but, it's quite hard due to its compiled nature. Unfortunate that SirCmpWn is no longer among us, and this project may never come to fruition
Title: Re: Axe dissasembler
Post by: ISSOtm on November 09, 2013, 07:39:03 am
A friend of mine (Natch) made a hex decompiler ; he wrote the code, I made the design (the home screen, and two bugfixes)

I gave an example, but it sometimes fails (it seems it's linked with Axe compilation ?) at the step "Name of the hex prgm ?", then quit, shut down, and retry

I gave a pack with the source and two libs needed

Do NOT ask me anything about the code, even Natch doesn't know how it works !

NEVER DECOMPILE : - already decompiled programs (you get a bugged program, and mem losses; - the decompiler itself (RAM clear if you set any split setting to "Yes"

Sometimes, the split settings create glitches (bytes half-cut, or program corruptions), so use them carefully
Title: Re: Axe dissasembler
Post by: Sorunome on November 09, 2013, 08:01:42 am
So all this does is convert an existing prog to its hex? Because i thought decompiling was a bit more ???
Title: Re: Axe dissasembler
Post by: Matrefeytontias on November 09, 2013, 08:57:49 am
I wrote a 500-bytes equivalent in Axe a while ago that doesn't need any of your restrictions. It's called PROG2HEX, and what it does is simply getting a name from an input and unsquishing it in a program which has the same name starting with theta. http://www.ticalc.org/archives/files/fileinfo/449/44973.html
Title: Re: Axe dissasembler
Post by: Hayleia on November 09, 2013, 09:07:53 am
Also, even if the "disassembler" part was right, what does it have to do with Axe ?
Title: Re: Axe dissasembler
Post by: SpiroH on November 09, 2013, 09:19:37 am
So all this does is convert an existing prog to its hex? Because i thought decompiling was a bit more ???
And it is, in general! So, do not despair. ;)
That, i would call simply an object code dumper. A disassembler converts binary to assembly mnemonics (a bit more useful).
A decompiler 'tries' to retrieve the source statements of an higher-level language such as 'C', by inspecting and converting the binary.

Title: Re: Axe dissasembler
Post by: ClrDraw on November 09, 2013, 11:49:49 am
Quote
I wrote a 500-bytes equivalent in Axe a while ago that doesn't need any of your restrictions. It's called PROG2HEX, and what it does is simply getting a name from an input and unsquishing it in a program which has the same name starting with theta.
I've used prog2hex a couple times and I like it a lot.

But I don't like the idea of an Axe decompiler because, even though I usually include the source with my projects (sadly not with CMDv2, it got deleted after I compiled the app and the backup was too outdated to rewrite), there are some times that I don't want to release my entire source.
Title: Re: Axe dissasembler
Post by: Digital on April 07, 2014, 08:17:29 am
I understand you, but what if for example just runner112 has the decompiler so you can send him the asm programm(cmdv2) and he gives you the decompiled source(for easier rewrite)?
Title: Re: Axe dissasembler
Post by: Aspiring on April 07, 2014, 10:36:52 am
Writing a decompiler would be a lot of work.  There is already a lack of motivation for many comunity projects as it is.  The problem is that the decompiler would have to have a version for (most) every version of axe.  Doing it would be a nightmare.  Not to mention it would probrably be harder to decompile the axe programs than it would to originally assemble them.  As nice as it might be, there will probably never be a axe program to axe source decompiler.  :(
Title: Re: Axe dissasembler
Post by: TIfanx1999 on April 07, 2014, 10:54:15 am
I understand you, but what if for example just runner112 has the decompiler so you can send him the asm programm(cmdv2) and he gives you the decompiled source(for easier rewrite)?

This has pretty much already been answered in the thread by the man that made Axe himself:
An Axe disassembler is nearly impossible for the following reasons:

-You lose the names of Pointers, Labels, and Variables
-You lose comments and code formatting
-You can't tell if specific data was a string, or number list, or sprite, or picture, etc.
-Each new version of axe changes the routines used so the disassembler would have to be rewritten each version
-Peephole opts make it even more difficult to disassemble.
-Axioms, inline assembly, and other things like that would not translate

It is however, fairly trivial to disassemble it to assembly, and then map native Axe routines and variable locations to the assembly program.  But you would definitely not be able to turn it back into Axe language unless you do it by hand or something.


You should try to read through the thread first to see if your question has already been answered. In this case, it has been.
Title: Re: Axe dissasembler
Post by: Runer112 on April 07, 2014, 12:34:22 pm
I understand you, but what if for example just runner112 has the decompiler so you can send him the asm programm(cmdv2) and he gives you the decompiled source(for easier rewrite)?

As others have said, decompiling arbitrary Axe programs is nigh impossible. But I can decompile (probably) any Axe program by hand. Give me a program and a good reason (ex. you lost the source to a project you put a lot of work into but still have a recent compiled version, not that someone else published a closed-source program and you want the source), and if I can allocate the time, I'll do it for you. There may be a few others who can do this as well, although I probably shouldn't be volunteering others.
Title: Re: Axe dissasembler
Post by: Digital on April 08, 2014, 07:11:32 am
You should try to read through the thread first to see if your question has already been answered. In this case, it has been.
 

I have red the thread

@Runner112: nice from you  ;D
Title: Re: Axe dissasembler
Post by: Digital on April 08, 2014, 07:31:12 am
@Streetwalrus: Oooops, you are right.
Title: Re: Axe dissasembler
Post by: Streetwalrus on April 08, 2014, 08:33:24 am
Please don't double post, you have an Edit button. ;)
Title: Re: Axe dissasembler
Post by: DJ Omnimaga on April 08, 2014, 03:31:16 pm
If I took a Supersonic Ball executable then tried to decompile it back into Axe code using such disassembler, I bet that the resulting Axe source would be far different than the original.