SuperCharge Decompiler

Anything QL Software or Programming Related.
Martin_Head
Gold Card
Posts: 300
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Postby Martin_Head » Wed Apr 25, 2018 2:11 pm

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 15 times
DisCharge.zip
(98.5 KiB) Downloaded 15 times


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

Re: SuperCharge Decompiler

Postby RWAP » Wed Apr 25, 2018 9:14 pm

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
Gold Card
Posts: 300
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Postby Martin_Head » Sat May 12, 2018 10:33 am

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
ROM Dongle
Posts: 28
Joined: Tue Mar 11, 2014 8:00 pm

Re: SuperCharge Decompiler

Postby stephen_usher » Sat May 12, 2018 11:41 am

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
Gold Card
Posts: 300
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Postby Martin_Head » Sat May 19, 2018 4:06 pm

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 8 times
DisCharge.zip
(99.36 KiB) Downloaded 9 times


Martin_Head
Gold Card
Posts: 300
Joined: Tue Dec 17, 2013 1:17 pm

Re: Super/TurboCharge Decompiler

Postby Martin_Head » Mon Jun 18, 2018 11:05 am

Here is preview of a decompiler for TurboCharge
TurboDisCharge.zip
(49.02 KiB) Downloaded 9 times

It's not complete, or working completely right. But it hase produced this
tools.zip
(1.53 KiB) Downloaded 10 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 8 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
Gold Card
Posts: 391
Joined: Sat Oct 25, 2014 9:53 am

Re: SuperCharge Decompiler

Postby martyn_hill » Mon Jun 18, 2018 1:47 pm

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
Gold Card
Posts: 300
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Postby Martin_Head » Mon Jun 18, 2018 3:48 pm

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
QL Wafer Drive
Posts: 1039
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: Super/TurboCharge Decompiler

Postby Derek_Stewart » Mon Jun 18, 2018 4:29 pm

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
Gold Card
Posts: 391
Joined: Sat Oct 25, 2014 9:53 am

Re: SuperCharge Decompiler

Postby martyn_hill » Mon Jun 18, 2018 5:39 pm

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...



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 4 guests