Hello everyone. I'm creating a new project called z80 program UN-SQUISHIER, hence the title. This tool is intended to do the exact opposite of the AsmComp( command. So for example, if you compiled AsmPrgmFDCB24DEC9, the result of that is ?xyLinecosh¯¹(fnInt(Disp sinh¯¹(. The program reverses that. Mainly so you can copy and paste it and show it to others so they can type it in. I'm sorry to say this program doesn't decompile the whole program at once, rather line-by-line. But either there are kinks in the program coding or in Celtic 3, not all assembly programs are un-squished correctly. The hex code is available, but I cannot guarantee it is 100% correct. Here is the source code below of what I have:

Code:

:"Asm Program Unsquisher
If det([[1:Then
   Disp "Celtic 3 Is","Not Installed!","
   Return
End
Disp "Asm Program","Unsquisher v1.2
Disp "Input An","Existing Program","
Lbl 0
Repeat 9>length(Str9) and not(inString("rowSwap(*row(",sub(Str9,1,1
   det(20,"FD361251
   Input ">",Str9
End
det(0,7,Str9
If Ans=".P:NT:FN
Disp "Does Not Exist","
If Ans=".P:NT:FN
Goto 0
sub(det(5,Str9,1),1,1
If Ans!=det(17,"BB6D
Disp "Not An Asm Prgm","
If Ans!=det(17,"BB6D
Goto 0
Disp "Type An Output","Program Name","
Lbl Z0
Repeat 9>length(Str8) and not(inString("rowSwap(*row(",sub(Str8,1,1
   det(20,"FD361251
   Input ">",Str8
End
det(0,7,Str8
If Ans!=".P:NT:FN
Disp "Program Exists","
If Ans!=".P:NT:FN
Goto Z0
real(7,0
2expr(sub(det(0,7,Str9),4,5
If 1000>det(4)-Ans
Disp "RAM Memory","Too Low","
If 1000>det(4)-Ans
Goto 0
det(0,5,Str8
det(5,Str9->R
Disp "Unsquishing","Prgm "+Str9+"...","Lines: "+det(1,R
Output(7,1,"Complete: 0%
For(I,1,R
   det(18,det(5,Str9,I
   det(6,Str8,Ans,I
   int(100I/R
   Output(7,11,det(1,Ans)+"%
End
DelVar EDisp "Checking","Contents...","
For(I,1,R
   det(17,det(5,Str8,I
   If Ans!=det(5,Str9,I
   1->E
If not(E:End
If E:Then
   det(0,4,Str8
   Disp "Prgm "+Str9,"Could Not Be","Decompiled
Return:End
det(5,Str8,1
det(8,Str8,"AsmPrgm"+sub(Ans,5,length(Ans)-4),1
det(6,Str8,"C9",I
Disp "Un-Squishing","Completed


Overall the un-squishing process is pretty quick, I tried to make this as simple and small as possible. Let me know what you guys think if there are any improvements that can be made with my program. I uploaded this to ticalc.org, upload pending.
Note: this process is usually referred to as "unsquishing."
I like to be more technical when I name my projects.
Well too bad because this has nothing to do with a "decompiler" :p
The actual name that even TI used is indeed squishing/unsquishing.
One step further would be disassembling (to get asm code from the bytes/hex), then further again would be decompiling, to (pseudo-)C if it applies.
Sounds silly tbh to not use decompile and compile. If TI prefers squish/unsquish, they should have used AsmComp( with AsmSqish(... or something like that.
AsmComp( probably stands for AssemblyCompress(, not AssemblyCompile(. Also, TI is just bad at naming things. "Compile" already has a meaning, which is to convert a higher-level language like C into assembly code or machine code. Likewise, "decompile" means to convert assembly code or machine code into the original higher-level language. This is much harder to do than desquishing, which is just converting bytes to hex, and disassembly, which is converting machine code into opcodes, because most compilers make optimizations to the code which are difficult to reverse. Naming your program a "decompiler" would imply that it performed the much more sophisticated task of converting programs into the original ICE or C source, which would be misleading.
Yup, I'm with the others: you're already doing the right thing by using the "unsquisher" name now.
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement