SuperCharge Decompiler

Anything QL Software or Programming Related.
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

Here is an update of the SuperCharge decompiler as it stands at the moment.

In addition to improvements to the decompiler, I have added a system to to identify most of the library routines during the ProcessDump_bas program. This cuts out most of the tedious and error prone manual identification process. And it fills in the '_codes' file for you.

I have also included a user manual, which I hope makes some sense.
Attachments
DisChargeDocs.zip
(256.04 KiB) Downloaded 164 times
DisCharge.zip
(98.5 KiB) Downloaded 171 times


RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: SuperCharge Decompiler

Post by RWAP »

It looks as though now might be the time for Martyn to approach Simon Goodwin - he probably still has the original Supercharge sources, and would be interested in this project no doubt. It would also be nice if someone asked him about releasing Supercharge as public domain, in line with Turbo (which he released as public domain some time ago).


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

If anyone is trying to use the decompiler, I have noticed a problem with it identifying the string = and <> routines.

The checksum system I introduced combines the number of bytes in the routine, and a total of those bytes added together.

By sod's law both routines have the same checksum! They both have the same number of bytes, and only differ by 2 bytes, and the two differences cancel each other out in the checksum.

The routines are almost exactly the same, You can differentiate between them by looking near the end of the routines for an instruction ‘movea.w $000000E6,a2’. just before it is a ‘moveq #$.. ,d0’ instruction.
‘moveq #$02,d0’ is an equals, and ‘moveq #$03,d0’ is a not equals.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: SuperCharge Decompiler

Post by stephen_usher »

Martin_Head wrote:By sod's law both routines have the same checksum! They both have the same number of bytes, and only differ by 2 bytes, and the two differences cancel each other out in the checksum.
Use a cryptographic hash instead, such as md5sum or even 3des?


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

Another update.

Amongst improvements are that END FOR's now get the variable name added, and END DEFines get the procedure/function names added.
Attachments
DisChargeDocs.zip
(218.51 KiB) Downloaded 150 times
DisCharge.zip
(99.36 KiB) Downloaded 153 times


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Super/TurboCharge Decompiler

Post by Martin_Head »

Here is preview of a decompiler for TurboCharge
TurboDisCharge.zip
(49.02 KiB) Downloaded 152 times
It's not complete, or working completely right. But it hase produced this
tools.zip
(1.53 KiB) Downloaded 150 times
From this program http://www.dilwyn.me.uk/tk/Tools_v1_10.zip by Emmanuel Verbeeck.

The original program was compiled without line numbers, so the decompiler has had to create line numbers, hence the odd line numbering. Also note that the decompiler has decompiled to one statement per line, due to the lack of line numbers.

While SuperCharged and TurboCharged programs are similar, There are enough differences to make me create a separate decompiler for Turbo. I will be making some changes to the SuperCharge decompiler (changing the checksums) So I have not included it here.

Here is some documentation for the decompiler
Documents.zip
(310.73 KiB) Downloaded 145 times
Note that the technical manual is just odd notes I have made, and isn't very well organized.

I have downloaded a few programs from Dilwyn Jones web site that state they are Turbo compiled.
But before I start using any more of them for expanding the Turbo decompiler, Is there any copyright free programs that are actually wanted to be decompiled. If I am going to put the time and effort into decompiling something. I would rather it was something that was wanted.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: SuperCharge Decompiler

Post by martyn_hill »

Amazing work, Martin - thank you!

Is there any value in my applying your decompiler to some of my own TURBO'd routines and comparing against my source - feeding back any insights here?

If so, are there particular internal compiled codes or program sequences that you'd be most interested in?

M.


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

martyn_hill wrote:Is there any value in my applying your decompiler to some of my own TURBO'd routines and comparing against my source - feeding back any insights here?
It would be nice to get some feedback as to how easy/hard people find trying to use the decompiler. And how close it gets to the original.
Note that the Turbo decompiler I have posted here is very young, and it is going to give problems. Especially when trying to decompile anything with omitted line numbers. The SuperCharge decompiler makes a lot of use of the starts of lines as reference points. When these references disappear, things start getting tricky.


Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Super/TurboCharge Decompiler

Post by Derek_Stewart »

Martin_Head wrote:I have downloaded a few programs from Dilwyn Jones web site that state they are Turbo compiled.
But before I start using any more of them for expanding the Turbo decompiler, Is there any copyright free programs that are actually wanted to be decompiled. If I am going to put the time and effort into decompiling something. I would rather it was something that was wanted.
Hi Martin,

The source to Diskmate 5 is lost and only the Turbo compiled executable exists. I was trying to rewrite Diskmate 5 based on the way it works. I have extracted some of the Easyptr menu definitions, which were added to the end of the Turbo compiled code.

Maybe your discharge programme could be used to analyse the compiled code.


Regards,

Derek
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: SuperCharge Decompiler

Post by martyn_hill »

Martin_Head wrote: It would be nice to get some feedback as to how easy/hard people find trying to use the decompiler. And how close it gets to the original.
Sure - let me try some of my more complex compiled jobs and report back.

I always leave line-numbers enabled - the value of the extra troubleshooting info this provides (when you have the source to compare against) far outweighs the larger job-size...


Post Reply